-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmultiple-drag.min.js
2 lines (2 loc) · 1.13 KB
/
multiple-drag.min.js
1
2
/*! angular-multiple-drag 0.0.1 */
angular.module("multipleDrag",["multipleSelection"]).directive("multipleDragItem",["$document",function(a){return{scope:!0,restrict:"A",link:function(b,c){function d(a){a.preventDefault(),a.stopPropagation();for(var b=a.pageX-f,d=a.pageY-g,e=c.parent().children(),h=0;h<e.length;h++)if(child=angular.element(e[h]),child.scope().isDraggable&&child.scope().isSelected){child.scope().isDragging||(child.scope().isDragging=!0,child.scope().$apply());var i=parseInt(child.css("left").replace("px","")),j=parseInt(child.css("top").replace("px",""));child.css({left:i+b+"px",top:j+d+"px"})}f=a.pageX,g=a.pageY}function e(){for(var b=c.parent().children(),f=0;f<b.length;f++)child=angular.element(b[f]),child.scope().isDragging&&(child.scope().isDragging=!1,child.scope().$apply());a.off("mousemove",d),a.off("mouseup",e)}b.isDraggable=!0,b.isDragging=!1;var f=0,g=0;c.css({position:"absolute",cursor:"pointer"}),c.css("top")||c.css({top:c.prop("offsetTop")+"px"}),c.css("left")||c.css({left:c.prop("offsetLeft")+"px"}),c.on("mousedown",function(b){b.preventDefault(),f=b.pageX,g=b.pageY,a.on("mousemove",d),a.on("mouseup",e)})}}}]);