small modifications for space module

This commit is contained in:
Harry Bomrah 2016-04-14 18:38:47 +08:00
parent ff9f15535c
commit 7148a53dc8
2 changed files with 14 additions and 17 deletions

View File

@ -76,17 +76,19 @@
cover.append(dragBox);
}
})
cover.on("mousemove",function(e){
e.preventDefault();
if(isDragging){
diffX = e.offsetX - offsetX;
diffY = e.offsetY - offsetY;
if(diffX > 0 && diffY > 0){
console.log(diffX,diffY);
currentDragBox.css({
width : diffX + "px",
height : diffY + "px"
})
}
}
})
cover.on("mouseup",function(){
@ -97,6 +99,7 @@
btn = $("<button class='make-box-permanent btn-flat btn-flat-has-icon btn-flat-primary btn-flat-small absolute-center'><i class='fa fa-check'></i>OK</button>");
btn.on("click",selectAreaOkBtnHandler);
currentDragBox.append(btn);
currentDragBox.addClass("hover");
currentDragBox.hover(function(){
$(this).addClass("hover");
},function(){

View File

@ -88,26 +88,19 @@
cover.append(dragBox);
}
})
var tempX = 0,
tempY = 0;
cover.on("mousemove",function(e){
e.preventDefault();
if(isDragging){
diffX = e.offsetX - offsetX;
diffY = e.offsetY - offsetY;
if(diffX > 0 && diffY > 0){
console.log("Difference :", diffX, diffY);
console.log("Old :", tempX, tempY);
tempX = diffX;
tempY = diffY;
if(diffX >= tempX && diffY >= tempY){
console.log(diffX,diffY);
currentDragBox.css({
width : diffX + "px",
height : diffY + "px"
})
}
}
}
})
cover.on("mouseup",function(){
@ -123,6 +116,7 @@
btn = $("<button class='make-box-permanent btn-flat btn-flat-has-icon btn-flat-primary btn-flat-small absolute-center'><i class='fa fa-check'></i>OK</button>");
btn.on("click",selectAreaOkBtnHandler);
currentDragBox.append(btn);
currentDragBox.addClass("hover");
currentDragBox.hover(function(){
$(this).addClass("hover");
},function(){