diff --git a/Gruntfile.js b/Gruntfile.js index 3d06462..874d826 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,3 +1,22 @@ +var srcFiles = [ + 'src/core.js', + 'src/directives/dndDraggable.js', + 'src/directives/dndDroppable.js', + 'src/directives/dndRotatable.js', + 'src/directives/dndResizable.js', + 'src/directives/dndSortable.js', + 'src/directives/dndSelectable.js', + 'src/directives/dndRect.js', + 'src/directives/dndModel.js', + 'src/directives/dndLassoArea.js', + 'src/directives/dndFittext.js', + 'src/directives/dndKeyModel.js', + 'src/directives/dndContainment.js', + 'src/services/dndKey.js', + 'src/services/dndLasso.js', + 'src/services/EventEmitter.js' +]; + module.exports = function (grunt) { grunt.initConfig({ concat: { @@ -5,24 +24,7 @@ module.exports = function (grunt) { separator: ';\n\n', }, dist: { - src: [ - 'src/core.js', - 'src/directives/dndDraggable.js', - 'src/directives/dndDroppable.js', - 'src/directives/dndRotatable.js', - 'src/directives/dndResizable.js', - 'src/directives/dndSortable.js', - 'src/directives/dndSelectable.js', - 'src/directives/dndRect.js', - 'src/directives/dndModel.js', - 'src/directives/dndLassoArea.js', - 'src/directives/dndFittext.js', - 'src/directives/dndKeyModel.js', - 'src/directives/dndContainment.js', - 'src/services/dndKey.js', - 'src/services/dndLasso.js', - 'src/services/EventEmitter.js' - ], + src: srcFiles, dest: 'dist/angular-dnd.js', }, }, @@ -45,24 +47,7 @@ module.exports = function (grunt) { } }, watch: { - files: [ - 'src/core.js', - 'src/directives/dndDraggable.js', - 'src/directives/dndDroppable.js', - 'src/directives/dndRotatable.js', - 'src/directives/dndResizable.js', - 'src/directives/dndSortable.js', - 'src/directives/dndSelectable.js', - 'src/directives/dndRect.js', - 'src/directives/dndModel.js', - 'src/directives/dndLassoArea.js', - 'src/directives/dndFittext.js', - 'src/directives/dndKeyModel.js', - 'src/directives/dndContainer.js', - 'src/services/dndKey.js', - 'src/services/dndLasso.js', - 'src/services/EventEmitter.js' - ], + files: srcFiles, tasks: [ "concat", "wrap", diff --git a/dist/angular-dnd.js b/dist/angular-dnd.js index 94e7e43..ffd819b 100644 --- a/dist/angular-dnd.js +++ b/dist/angular-dnd.js @@ -3129,7 +3129,7 @@ module.directive('dndContainment', ['$parse', function($parse){ this.get = function () { var selector = getterSelector($scope); - return selector ? $element.dndClosest().eq(0) : $element.parent(); + return selector ? $element.dndClosest(selector).eq(0) : $element.parent(); } } diff --git a/dist/angular-dnd.min.js b/dist/angular-dnd.min.js index f345213..d815ed5 100644 --- a/dist/angular-dnd.min.js +++ b/dist/angular-dnd.min.js @@ -1,2 +1,2 @@ !function(a,b,c,d){"use strict";function e(){}function f(){return!1}function g(){return!0}function h(a,b){return function(){b.apply(a,arguments)}}function i(a){return a*(Math.PI/180)}function j(a){return a*(180/Math.PI)}function k(a,b,c){return a>b?a:b>c?c:b}function l(a){var c=a.data("events");return c!==b?c:(c=t.data(a,"events"),c!==b?c:(c=t._data(a,"events"),c!==b?c:(c=t._data(a[0],"events"),c!==b?c:b)))}function m(a,b,c,d){3===arguments.length&&"boolean"!=typeof c&&(d=c,c=!1);var e;return function(){var f=arguments;d=d||this,c&&!e&&a.apply(d,f),clearTimeout(e),e=setTimeout(function(){c||a.apply(d,f),e=null},b)}}function n(a,b,c){var d,e;return function(){d||(e=arguments,c=c||this,a.apply(c,e),d=setTimeout(function(){d=null},b))}}function o(a,b){isNaN(b)&&(b=0);var c=Math.pow(10,b);return Math.round(a*c)/c}var p,q,r,s="0.1.12",t=a.element,u=(t(c),t(d)),v={mode:!1,helpers:{}},w=a.forEach,x=a.extend;!function(){c.console=c.console||{log:e,info:e,warn:e,error:e}}(),function(){var a=navigator.userAgent;/webkit\//i.test(a)?(p="-webkit-transform",q="-webkit-transform-origin",r="webkitMatchesSelector"):/gecko\//i.test(a)?(p="-moz-transform",q="-moz-transform-origin",r="mozMatchesSelector"):/trident\//i.test(a)?(p="-ms-transform",q="ms-transform-origin",r="msMatchesSelector"):/presto\//i.test(a)?(p="-o-transform",q="-o-transform-origin",r="oMatchesSelector"):(p="transform",q="transform-origin",r="matches")}();var y=function(){function a(a,b){"object"==typeof a&&(b=a.y||a.top,a=a.x||a.left),this.x=a||0,this.y=b||0}return a.prototype={equal:function(b){return b instanceof a||(b=new a(b)),this.x===b.x&&this.y===b.y},plus:function(b){return b instanceof a||(b=new a(b)),new a(this.x+b.x,this.y+b.y)},minus:function(b){return b instanceof a||(b=new a(b)),new a(this.x-b.x,this.y-b.y)},scale:function(b){return new a(this.x*b,this.y*b)},magnitude:function(){return this.distance(new a(0,0),this)},distance:function(b){return b instanceof a||(b=new a(b)),Math.sqrt(Math.pow(this.x-b.x,2)+Math.pow(this.y-b.y,2))},angle:function(a,b){var c=Math.atan2(a.y-this.y,a.x-this.x);return b===!0&&(c*=180/Math.PI),c},deltaAngle:function(a,c,d){c=c===b?{x:0,y:0}:c;var e=this.angle(c)-a.angle(c);return 0>e&&(e=2*Math.PI+e),d===!0&&(e*=180/Math.PI),e},transform:function(a){return a.transformPoint(this)},deltaTransform:function(a){return a.deltaTransformPoint(this)},rotate:function(a,b){var c=(new z).rotate(a,b);return this.transform(c)},getAsCss:function(){return{top:this.y,left:this.x}}},function(b,c){return new a(b,c)}}(),z=function(){function a(a,c,d,e,f,g){this.a=a!==b?a:1,this.b=c||0,this.c=d||0,this.d=e!==b?e:1,this.tx=f||0,this.ty=g||0}a.prototype={concat:function(b){return new a(this.a*b.a+this.c*b.b,this.b*b.a+this.d*b.b,this.a*b.c+this.c*b.d,this.b*b.c+this.d*b.d,this.a*b.tx+this.c*b.ty+this.tx,this.b*b.tx+this.d*b.ty+this.ty)},inverse:function(){var b=this.a*this.d-this.b*this.c;return new a(this.d/b,-this.b/b,-this.c/b,this.a/b,(this.c*this.ty-this.d*this.tx)/b,(this.b*this.tx-this.a*this.ty)/b)},rotate:function(b,c){var d=new a(Math.cos(b),Math.sin(b),-Math.sin(b),Math.cos(b));return c&&(d=this.translate(c.x,c.y).concat(d).translate(-c.x,-c.y)),this.concat(d)},scale:function(b,c,d){c=c||b;var e=new a(b,0,0,c);return d&&(e=e.translate(d.x,d.y).translate(-d.x,-d.y)),e},translate:function(b,c){var d=new a(1,0,0,1,b,c);return this.concat(d)},transformPoint:function(a){return new y(this.a*a.x+this.c*a.y+this.tx,this.b*a.x+this.d*a.y+this.ty)},deltaTransformPoint:function(a){return new y(this.a*a.x+this.c*a.y,this.b*a.x+this.d*a.y)},toStyle:function(){var a=o(this.a,3),b=o(this.b,3),c=o(this.c,3),d=o(this.d,3),e=o(this.tx,3),f=o(this.ty,3);return"matrix("+a+", "+b+", "+c+", "+d+", "+e+", "+f+")"}};var c=function(b,c,d,e,f,g){return new a(b,c,d,e,f,g)};return c.IDENTITY=new a,c.HORIZONTAL_FLIP=new a(-1,0,0,1),c.VERTICAL_FLIP=new a(1,0,0,-1),c}(),A=function(){function a(a,b,c,d){this.tl=a,this.tr=b,this.bl=c,this.br=d}a.prototype={applyMatrix:function(c,d){var e,f,g,h,i=new z(1,0,0,1,d.x,d.y),j=new z(1,0,0,1,-d.x,-d.y);return d!==b?(e=this.tl.transform(j).transform(c).transform(i),f=this.tr.transform(j).transform(c).transform(i),g=this.bl.transform(j).transform(c).transform(i),h=this.br.transform(j).transform(c).transform(i)):(e=this.tl.transform(c),f=this.tr.transform(c),g=this.bl.transform(c),h=this.br.transform(c)),new a(e,f,g,h)},width:function(){var a=this.tl.x-this.tr.x,b=this.tl.y-this.tr.y;return Math.sqrt(a*a+b*b)},height:function(){var a=this.tl.x-this.bl.x,b=this.tl.y-this.bl.y;return Math.sqrt(a*a+b*b)},client:function(){var a=Math.min(this.tl.y,this.tr.y,this.bl.y,this.br.y),b=Math.min(this.tl.x,this.tr.x,this.bl.x,this.br.x),c=Math.max(this.tl.y,this.tr.y,this.bl.y,this.br.y)-a,d=Math.max(this.tl.x,this.tr.x,this.bl.x,this.br.x)-b;return{top:o(a,1),left:o(b,1),height:o(c,1),width:o(d,1),bottom:o(a+c,1),right:o(b+d,1)}},getAngle:function(a){var b=this.tl.y-this.tr.y,c=this.tl.x-this.tr.x;return 180*Math.tan(c/b)/Math.PI}};var c=function(b,c,d,e){var f=arguments;return"object"==typeof f[0]&&(c=f[0].top,b=f[0].left,d=f[0].width,e=f[0].height),new a(new y(b,c),new y(b+d,c),new y(b,c+e),new y(b+d,c+e))};return c.fromPoints=function(b,c,d,e){return new a(b,c,d,e)},c}();x(t.prototype,{dndDisableSelection:function(){this.on("dragstart selectstart",f).dndCss({"-moz-user-select":"none","-khtml-user-select":"none","-webkit-user-select":"none","-o-user-select":"none","-ms-user-select":"none","user-select":"none"})},dndEnableSelection:function(){this.off("dragstart selectstart",f).dndCss({"-moz-user-select":"auto","-khtml-user-select":"auto","-webkit-user-select":"auto","-o-user-select":"auto","-ms-user-select":"auto","user-select":"auto"})},dndClientRect:function(){if(this[0]){var a=this[0]===c?{top:0,bottom:0,left:0,right:0,width:0,height:0}:this[0].getBoundingClientRect();return{bottom:a.bottom,height:a.height,left:a.left,right:a.right,top:a.top,width:a.width}}},dndStyleRect:function(){var a=this.dndCss(["width","height","top","left"]),b=parseFloat(a.width),c=parseFloat(a.height),d="auto"===a.top?0:parseFloat(a.top),e="auto"===a.left?0:parseFloat(a.left);return{top:d,right:e+b,bottom:d+c,left:e,width:b,height:c}},dndGetParentScrollArea:function(){var a,b,e,f,g,h,i,j=[],k=this.dndClosest();d.documentElement;return w(k,function(c){i=t(c).dndCss(["padding-top","padding-right","padding-bottom","padding-left"]),a=c.scrollWidth,b=c.clientWidth,e=c.scrollHeight,f=c.clientHeight,h=parseFloat(i["padding-top"])+parseFloat(i["padding-bottom"]),g=parseFloat(i["padding-left"])+parseFloat(i["padding-right"]),(a-g!==b||e-h!==f)&&j.push(c)}),j.push(c),t(j)},dndGetFirstNotStaticParent:function(){var a,b,c=this.dndClosest();return w(c,function(c){return b=t(c).dndCss("position"),"absolute"===b||"relative"===b||"fixed"===b?(a=c,!1):void 0}),a||(a=d.documentElement),t(a)},dndClosest:function(a){a=a||"*";for(var b=this[0],c=[];b;)b[r](a)&&c.push(b),b=b.parentElement;return t(c)},dndGetAngle:function(a){var b=this.dndCss(p);if("none"===b||""===b)return 0;var c=b.split("(")[1].split(")")[0].split(","),d=c[0],e=c[1],f=Math.atan2(e,d);return f=0>f?f+=2*Math.PI:f,a?Math.round(180*f/Math.PI):f},dndCloneByStyles:function(){for(var b=[],d=0,e=this.length;e>d;d++){var f=this[d].cloneNode();a.element(f).append(a.element(this[0].childNodes).dndCloneByStyles()),1===this[d].nodeType&&(f.style.cssText=c.getComputedStyle(this[d],"").cssText),b.push(f)}return a.element(b)},dndCss:function(){function a(a){return a.replace(e,function(a,b,c,d){return d?c.toUpperCase():c}).replace(f,"Moz$1")}function d(){var a=arguments;if(1===a.length&&(a[0]instanceof Array||"string"==typeof a[0]))return j(this,a[0]);if(1===a.length&&"object"==typeof a[0])return i(this,a[0]);if(2===a.length){var b={};return b[a[0]]=a[1],i(this,b)}return this}var e=/([\:\-\_\.]+(.))/g,f=/^moz([A-Z])/,g={};!function(){var a={width:["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],height:["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"]};w(a,function(a,b){g[b]={get:function(d){var e=c.getComputedStyle(d),f=e[b];if("border-box"!==e.boxSizing||"%"===f[f.length-1])return f;f=parseFloat(f);for(var g=0;g-1&&this.get().splice(b,1)},has:function(a){return this.get().indexOf(a)>-1},add:function(a){if(!this.has(a)){this.get().push(a);var b=this;t(a).on("$destroy",function(){b.remove(a)})}}},a}(),i=function(){function a(a,b){this.el=a,this.$el=t(a),this.listeners={dragstart:[],drag:[],dragend:[],dragenter:[],dragover:[],dragleave:[],drop:[]},this.regions=new g(b),this.layer=function(){return b},this.setCurrentManipulator(null)}var b=["dragstart","drag","dragend","dragenter","dragover","dragleave","drop"],h=["dragstart","drag","dragend"],i=["dragenter","dragover","dragleave","drop"];h.has=i.has=function(a){return this.indexOf(a)>-1};var j;return j="ontouchstart"in d.documentElement?{start:"touchstart",move:"touchmove",end:"touchend",cancel:"touchcancel"}:"pointerEnabled"in c.navigator?{start:"pointerdown",move:"pointermove",end:"pointerup",cancel:"pointercancel"}:"msPointerEnabled"in c.navigator?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp",cancel:"MSPointerCancel"}:{start:"touchstart",move:"touchmove",end:"touchend",cancel:"touchcancel"},a.prototype={_isEmptyListeners:function(a){if(a instanceof Array){for(var b=0;b0)return!1;return!0},addListener:function(a,d){return-1===b.indexOf(a)?(console.error("jquery.dnd: invalid event name - ",a),this):(this.listeners[a].push(d),i.has(a)?this.regions.add(this.el):!h.has(a)||this.mouse||this.touch||("onmousedown"in c&&(this.mouse=new e(this)),("ontouchstart"in c||"onmsgesturechange"in c)&&(this.touch=new f(this,j))),this)},removeListener:function(a,b){var c=arguments;if(0===c.length)for(var d in this.listeners)this.listeners[d].length=0;else if(1===c.length)this.listeners[a].length=0;else for(var e=this.listeners[a],f=0;f-1&&c.splice(a,1)},getTarget:function(){return c[0]},isTarget:function(){return this.getTarget()===this},start:function(){this.started=!0,this.targets=[],this.asPoint=!1,this.api=new j(this),this.$scrollareas=this.dnd.$el.dndGetParentScrollArea(),this.$reference=this.dnd.$el.dndGetFirstNotStaticParent(),this.$scrollareas.on("scroll",this.onscroll),this.dnd.trigger("dragstart",this.api)},onscroll:function(){this.clearCache(),this.dnd.trigger("drag",this.api)},getCache:function(a){return this.cache[a]},setCache:function(a,b){return this.cache[a]=b},clearCache:function(){this.cache={}},stop:function(){if(this.$scrollareas.off("scroll",this.onscroll),this.targets.length)for(var a=0,b=this.targets.length;b>a;a++)t(this.targets[a]).data("dnd")[this.dnd.layer()].trigger("drop",this.api,this.dnd.el);this.dnd.trigger("dragend",this.api,this.targets)},prepareRegions:function(){var a=this.dnd.regions.get(),b=[];for(var c in a){var d=t(a[c]).data("dnd")[this.dnd.layer()],e=d.$el.dndClientRect();this.dnd!==d&&b.push({dnd:d,rect:e})}return b},begin:function(b){return this.dnd.getCurrentManipulator()||t(b.target).dndClosest("[dnd-pointer-none]").length?!1:(this.dnd.setCurrentManipulator(this),this.addToTargets(),this.event=b,this.started=!1,this.clearCache(),a.element(d.body).dndDisableSelection(),!0)},progress:function(a){this.event=a,this.started||this.start();var b=this.getCache("regions");b||(b=this.setCache("regions",this.prepareRegions()),v.mode&&this.showRegioins()),this.dnd.trigger("drag",this.api);for(var c=this.getBorderedAxis(),d=c.x,e=c.y,f=(this.asPoint,0);fh&&i>d&&e>j&&k>e,m=this.targets.indexOf(g.dnd.el);l?-1===m?(this.targets.push(g.dnd.el),g.dnd.trigger("dragenter",this.api,this.dnd.el)):g.dnd.trigger("dragover",this.api,this.dnd.el):-1!==m&&(t(this.targets[m]).data("dnd")[this.dnd.layer()].trigger("dragleave",this.api,this.dnd.el),this.targets.splice(m,1))}},end:function(b){this.event=b,this.started&&this.stop(),a.element(d.body).dndEnableSelection(),this.removeFromTargets(),v.mode&&this.hideRegions(),this.dnd.setCurrentManipulator(null)},showRegioins:function(){this.hideRegions();for(var b=this.getCache("regions"),c=a.element(d.body),e=c.dndClientRect(),f=0,g=b.length;g>f;f++){var h=b[f];v.helpers.renderRect(h.rect.left-e.left,h.rect.top-e.top,h.rect.width,h.rect.height)}},hideRegions:function(){for(var a=d.querySelectorAll(".dnd-debug-rect"),b=0,c=a.length;c>b;b++)a[b].remove()}},b}();e.prototype={getClientAxis:function(a){return new y(this.event.clientX+(a?a.x:0),this.event.clientY+(a?a.y:0))},mousedown:function(a){this.manipulator.begin(a)&&(u.on("mousemove",this.mousemove),u.on("mouseup",this.mouseup))},mousemove:function(a){this.manipulator.progress(a)},mouseup:function(a){this.manipulator.end(a),u.off("mousemove",this.mousemove),u.off("mouseup",this.mouseup),this.dnd.setCurrentManipulator(null)},destroy:function(){this.dnd.$el.off("mousedown",this.mousedown)}},f.prototype={getClientAxis:function(a){var b=this.event.originalEvent||this.event;return b.changedTouches?y(b.changedTouches[0].clientX+(a?a.x:0),b.changedTouches[0].clientY+(a?a.y:0)):y(this.event.clientX+(a?a.x:0),this.event.clientY+(a?a.y:0))},touchstart:function(a){this.manipulator.begin(a)&&(u.on(this.te.move,this.touchmove),u.on(this.te.end+" "+this.te.cancel,this.touchend))},touchmove:function(a){a.preventDefault(),this.manipulator.progress(a)},touchend:function(a){this.manipulator.end(a),u.off(this.te.move,this.touchmove),u.off(this.te.end+" "+this.te.cancel,this.touchend),this.dnd.setCurrentManipulator(null)},destroy:function(){this.dnd.$el.off(this.te.start,this.touchstart)}},t.prototype.dndBind=function(a,c){if(!this.length)return this;var d,e,f,g=[];if("object"==typeof a){e=a;for(var h in e){d=h.replace(/\s+/g," ").split(" ");for(var j=0;j').dndCss({position:"absolute"});return b.prototype={init:function(a){return delete this.start,delete this.element,this.api=a,this.ready=!1,"clone"===this.templateUrl?this.createElementByClone():this.createElementByTemplate(),this.wrap().appendTo(t(d.body)),this.scope.$apply(),a.setReferenceElement(d.body),this.initBorderOffset(),this},createTemplateByUrl:function(b){return b=a.isFunction(b)?b():b,f.get(b,{cache:i}).then(function(a){this.template=a.data,this._offset=y(),this.ready=!0}.bind(this))},createElementByClone:function(){return this.element=this.mainElement.dndCloneByStyles().dndCss("position","static"),this._offset=y(this.mainElement.dndClientRect()).minus(this.api.getBorderedAxis()),this.ready=!0,this},createElementByTemplate:function(){return this.element=g(this.template)(this.scope),this},wrap:function(){return c.html(""),c.append(this.element),this},appendTo:function(a){return a.append(c),this},initBorderOffset:function(){var a=this.api.getBorderedAxis();if("clone"===this.templateUrl){var b=this.mainElement.dndClientRect();this.borderOffset={top:a.y-b.top,left:a.x-b.left,bottom:a.y-b.top-b.height,right:a.x-b.left-b.width}}else{var b=c.dndClientRect();this.borderOffset={top:0,left:0,bottom:-b.height,right:-b.width}}},updatePosition:function(){var a=this.api.getRelBorderedAxis(this.borderOffset).plus(this._offset);console.log(this.api.getRelBorderedAxis()),c.dndCss(a.getAsCss())},destroy:function(){this.element.remove()}},b}();return{require:["?dndRect","?dndModel","?dndContainment"],scope:!0,link:k}}]),B.directive("dndDroppable",["$parse","$timeout",function(a,c){return{require:"?dndModel",scope:!0,link:function(c,d,e,f){function g(a){var d=a.droplocal={};a.dropmodel=f?f.get():f,d.droppable=l(c,{$dragmodel:a.dragmodel,$dropmodel:a.dropmodel,$api:a}),d.droppable=d.droppable===b?!0:d.droppable,d.droppable&&(n(c,{$dragmodel:a.dragmodel,$dropmodel:a.dropmodel,$api:a}),c.$apply())}function h(a){var b=a.droplocal;b.droppable&&(o(c,{$dragmodel:a.dragmodel,$dropmodel:a.dropmodel,$api:a}),c.$apply())}function i(a){var d=a.droplocal;d.droppable&&(p(c,{$dragmodel:a.dragmodel,$dropmodel:a.dropmodel,$api:a}),a.dropmodel=b,c.$apply())}function j(a){q(c,{$dragmodel:a.dragmodel,$dropmodel:a.dropmodel,$api:a})}var k={layer:"common"},l=a(e.dndDroppable),m=x({},k,a(e.dndDroppableOpts)(c)||{}),n=a(e.dndOnDragenter),o=a(e.dndOnDragover),p=a(e.dndOnDragleave),q=a(e.dndOnDrop),r={};m.layer=m.layer||k.layer,r[m.layer+".dragenter"]=g,r[m.layer+".dragover"]=h,r[m.layer+".dragleave"]=i,r[m.layer+".drop"]=j,d.dndBind(r)}}}]),B.directive("dndRotatable",["$parse","$timeout",function(c,e){function f(f,g,h,k){function l(c){var e=c.local={};if(e.rotatable=r(f),e.rotatable=e.rotatable===b?!0:e.rotatable,e.rotatable||c.unTarget(),c.isTarget()){e.started=!0,c.setBounderElement(p?p.get():a.element(d.body));var h=c.getRelBorderedAxis();e.srect=g.dndStyleRect(),e.currAngle=g.dndGetAngle(),e.startPoint=y(h),e.borders=c.getBorders(),e.center=y(e.srect).plus(y(e.srect.width/2,e.srect.height/2)),f.$rotated=!0,t(f),f.$apply()}}function m(a){var b=a.local;if(b.started){var c=a.getRelBorderedAxis(),d=y(c).deltaAngle(b.startPoint,b.center),e=j(b.currAngle+d);e=Math.round(e/s.step)*s.step;var h=i(e),k=z().rotate(h),l=A(b.center.x-b.srect.width/2,b.center.y-b.srect.height/2,b.srect.width,b.srect.height).applyMatrix(k,b.center).client(),m=a.getReferencePoint();b.borders&&(l.left+m.xb.borders.right+1||l.top+m.y+l.height>b.borders.bottom+1)||(o?o.update("transform",k.toStyle()):g.dndCss("transform",k.toStyle()),u(f),f.$apply())}}function n(a){var b=a.local;b.started&&(v(f),e(function(){f.$rotated=!1}))}var o=k[0],p=k[1],q={step:5},r=c(h.dndRotatable),s=x({},q,c(h.dndRotatableOpts)(f)||{}),t=c(h.dndOnRotatestart),u=c(h.dndOnRotate),v=c(h.dndOnRotateend),w=g.dndCss("position");"fixed"!=w&&"absolute"!=w&&"relative"!=w&&(w="relative",g.dndCss("position",w));var B=a.element('
');g.append(B),f.$rotated=!1;var C={"$$rotatable.dragstart":l,"$$rotatable.drag":m,"$$rotatable.dragend":n};B.dndBind(C)}return{require:["?dndRect","?dndContainment"],scope:!0,link:f}}]),B.directive("dndResizable",["$parse","$timeout",function(c,e){function f(b){return a.element("
").addClass("angular-dnd-resizable-handle angular-dnd-resizable-handle-"+b)}function g(a,b){return b="object"==typeof b?b:{x:1,y:1},new y(a.left+a.width*b.x/2,a.top+a.height*b.y/2)}function h(h,i,j,l){function m(c){function f(c){var e=c.local={};if(e.resizable=q(h),e.resizable=e.resizable===b?!0:e.resizable,e.resizable||c.unTarget(),c.isTarget()){c.setBounderElement(o?o.get():a.element(d.body)),e.started=!0,e.$parent=i.parent(),e.rads=i.dndGetAngle(),e.rotateMatrix=z.IDENTITY.rotate(e.rads),e.inverseRotateMatrix=e.rotateMatrix.inverse(),e.parentRect=e.$parent.dndClientRect();var f=c.getBorderedAxis(),g=i.dndClientRect(),j=e.rect=i.dndStyleRect();e.borders=c.getBorders(),e.startAxis=f,e.minScaleX=r.minWidth/j.width,e.minScaleY=r.minHeight/j.height,e.maxScaleX=r.maxWidth/j.width,e.maxScaleY=r.maxHeight/j.height,e.deltaX=g.left-j.left+g.width/2-j.width/2,e.deltaY=g.top-j.top+g.height/2-j.height/2,h.$resized=!0,s(h),h.$apply()}}function j(a){var b=a.local;if(b.started){var d=a.getBorderedAxis(),e=y(d).minus(b.startAxis).transform(b.inverseRotateMatrix),f={x:1,y:1},j=b.rect.width,l=b.rect.height,m=b.rect.top,o=b.rect.left;switch(c){case"n":f.y=(l-e.y)/l;break;case"e":f.x=(j+e.x)/j;break;case"s":f.y=(l+e.y)/l;break;case"w":f.x=(j-e.x)/j;break;case"ne":f.x=(j+e.x)/j,f.y=(l-e.y)/l;break;case"se":f.x=(j+e.x)/j,f.y=(l+e.y)/l;break;case"sw":f.x=(j-e.x)/j,f.y=(l+e.y)/l;break;case"nw":f.x=(j-e.x)/j,f.y=(l-e.y)/l}f.x=k(b.minScaleX,f.x,b.maxScaleX),f.y=k(b.minScaleY,f.y,b.maxScaleY);var p,q=g(b.rect),r=g(b.rect,f);switch(c){case"n":p=y(o,m+l*f.y).rotate(b.rads,r).minus(y(o,m+l).rotate(b.rads,q));break;case"e":p=y(o,m).rotate(b.rads,r).minus(y(o,m).rotate(b.rads,q));break;case"s":p=y(o,m).rotate(b.rads,r).minus(y(o,m).rotate(b.rads,q));break;case"w":p=y(o+j*f.x,m).rotate(b.rads,r).minus(y(o+j,m).rotate(b.rads,q));break;case"ne":p=y(o,m+l*f.y).rotate(b.rads,r).minus(y(o,m+l).rotate(b.rads,q));break;case"se":p=y(o,m).rotate(b.rads,r).minus(y(o,m).rotate(b.rads,q));break;case"sw":p=y(o+j*f.x,m).rotate(b.rads,r).minus(y(o+j,m).rotate(b.rads,q));break;case"nw":p=y(o+j*f.x,m+l*f.y).rotate(b.rads,r).minus(y(o+j,m+l).rotate(b.rads,q))}var s={};s.width=j*f.x,s.height=l*f.y,s.left=o-p.x,s.top=m-p.y;var u=y(s.left+b.deltaX+s.width/2,s.top+b.deltaY+s.height/2),v=A(s.left+b.deltaX,s.top+b.deltaY,s.width,s.height).applyMatrix(b.rotateMatrix,u).client();b.borders&&(v.left+1b.borders.right||v.bottom-1>b.borders.bottom)||(n?n.update(s):i.dndCss(s),t(h),h.$apply())}}function l(a){var b=a.local;b.started&&(u(h),e(function(){h.$resized=!1}))}return{"$$resizable.dragstart":f,"$$resizable.drag":j,"$$resizable.dragend":l}}var n=l[0],o=l[1],p={handles:"ne, se, sw, nw, n, e, s, w",minWidth:20,minHeight:20,maxWidth:1e4,maxHeight:1e4},q=c(j.dndResizable),r=x({},p,c(j.dndResizableOpts)(h)||{}),s=c(j.dndOnResizestart),t=c(j.dndOnResize),u=c(j.dndOnResizeend),v=i.dndCss("position");"fixed"!==v&&"absolute"!==v&&"relative"!==v&&(v="relative",i.dndCss("position",v));for(var w=r.handles.replace(/\s/g,"").split(","),B=0;B"}function i(c,d,f){function g(a,b,c){var e=d.dndClientRect();return(p?(b.x-e.left)/e.width:(b.y-e.top)/e.height)>.5}function h(a,b,c,d){d=d||b,d.splice(c,0,b.splice(a,1)[0])}var i={layer:"common"},k=d[0].parentNode,l=a.element(k),m=l.data("dnd-sortable"),n=b(f.dndModel)||e,o=d.dndCss(["float","display"]),p=/left|right|inline/.test(o["float"]+o.display),q=x({},i,b(f.dndSortableOpts)(c)||{}),r=b(f.dndOnSortstart),s=b(f.dndOnSort),t=b(f.dndOnSortchange),u=b(f.dndOnSortend);b(f.dndOnSortenter),b(f.dndOnSortleave);if(!m||!m[q.layer]){m=m||{},m[q.layer]=!0;var v={};v[q.layer+".dragover"]=function(a){a.getEvent().target!==k||n(c).list.length>1||(a.$sortable.model=n(c),a.$sortable.insertBefore=!0,l.append(j[0]))},l.dndBind(v).data("dnd-sortable",m)}c.$$onDragStart=function(a){r(c),j=d.clone(),d.addClass("ng-hide"),j.addClass("angular-dnd-placeholder"),k.insertBefore(j[0],d[0]),a.$sortable={},a.clearCache(),c.$apply()},c.$$onDragOver=function(b,e,f){var h=g(b.getDragTarget(),b.getBorderedAxis());h?k.insertBefore(j[0],d[0].nextSibling):k.insertBefore(j[0],d[0]);var i=n(c);t===a.noop||b.$sortable.model&&b.$sortable.model.index===i.index||(t(c),c.$apply()),b.$sortable.model=i,b.$sortable.insertBefore=!h,b.clearCache()},c.$$onDragEnd=function(a){if(d.removeClass("ng-hide"),j.addClass("ng-hide"),a.$sortable.model){var b=c.$index,e=a.$sortable.model.index,f=n(c).list,g=a.$sortable.model.list;g===f?b>e?a.$sortable.insertBefore||e++:a.$sortable.insertBefore&&e--:a.$sortable.insertBefore||e++, -h(b,f,e,g),a.clearCache(),u(c),c.$apply()}},s!==a.noop&&(c.$$onDrag=function(a){s(c),c.$apply()})}var j,k=/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/;return{scope:!0,transclude:!0,template:h,replace:!0,link:i}}]),B.directive("dndSelectable",["$parse",function(a){function c(c,d,f){var g=a(d.dndModelSelecting),h=g.assign||e,i=a(d.dndModelSelected),j=i.assign||e,k=a(d.dndSelectable),l=(k.assign||e,a(d.dndOnSelected)),m=a(d.dndOnUnselected),n=a(d.dndOnSelecting),o=a(d.dndOnUnselecting);j(c,!1),h(c,!1),this.getElement=function(){return f},this.isSelected=function(){return i(c)},this.isSelecting=function(){return g(c)},this.isSelectable=function(){var a=k(c);return a===b||a},this.toggleSelected=function(a){return a=a===b?!this.isSelected():a,a?this.selected():this.unselected()},this.selecting=function(){return this.isSelectable()&&n(c)!==!1&&h(c,!0),this},this.unselecting=function(){return o(c)!==!1&&h(c,!1),this},this.selected=function(){return this.isSelectable()&&l(c)!==!1&&j(c,!0),this},this.unselected=function(){return m(c)!==!1&&j(c,!1),this},this.hit=function(a){var c=this.rectCtrl.getClient();for(var d in c)c[d]=parseFloat(c[d]);return c.bottom=c.bottom==b?c.top+c.height:c.bottom,c.right=c.right==b?c.left+c.width:c.right,a.bottom=a.bottom==b?a.top+a.height:a.bottom,a.right=a.right==b?a.left+a.width:a.right,a.top<=c.top&&c.top<=a.bottom&&(a.left<=c.left&&c.left<=a.right||a.left<=c.right&&c.right<=a.right)||a.top<=c.bottom&&c.bottom<=a.bottom&&(a.left<=c.left&&c.left<=a.right||a.left<=c.right&&c.right<=a.right)||a.left>=c.left&&a.right<=c.right&&(c.top<=a.bottom&&a.bottom<=c.bottom||c.bottom>=a.top&&a.top>=c.top||a.top<=c.top&&a.bottom>=c.bottom)||a.top>=c.top&&a.bottom<=c.bottom&&(c.left<=a.right&&a.right<=c.right||c.right>=a.left&&a.left>=c.left||a.left<=c.left&&a.right>=c.right)||a.top>=c.top&&a.right<=c.right&&a.bottom<=c.bottom&&a.left>=c.left}}function d(a){this.$element=a}return c.$inject=["$scope","$attrs","$element"],d.prototype={getClient:function(){return this.$element.dndClientRect()}},{restrict:"A",require:["dndSelectable","^dndLassoArea","?dndRect"],controller:c,scope:!0,link:function(c,f,g,h){function i(){h[1].remove(h[0]),c.$$phase||c.$apply()}c.$dndSelectable=h[0];var j=h[2];h[0].rectCtrl=j?j:new d(f),h[1].add(h[0]),f.on("$destroy",i);var k=a(g.dndOnSelected),l=a(g.dndOnUnselected),m=a(g.dndOnSelecting),n=a(g.dndOnUnselecting);(k||l)&&(k=k||e,l=l||e,c.$watch(g.dndModelSelected,function(a,d){a!==b&&d!==b&&a!==d&&(a?k(c):l(c))})),(m||n)&&(m=m||e,n=n||e,c.$watch(g.dndModelSelecting,function(a,d){a!==b&&d!==b&&a!==d&&(a?m(c):n(c))}))}}}]),B.directive("dndRect",["$parse",function(a){function c(c,f,g){function h(a){var c;a="object"==typeof a?a:{};for(var f=0;f-1},c.$inject=["$scope","$attrs","$element"],{restrict:"A",controller:c}}]),B.directive("dndModel",["$parse",function(a){function b(b,c){var d=a(c.dndModel),e=d.assign;this.set=function(a){e(b,a)},this.get=function(){return d(b)}}return b.$inject=["$scope","$attrs"],{restrict:"A",controller:b}}]),B.directive("dndLassoArea",["DndLasso","$parse","$timeout","dndKey",function(a,c,d,e){function f(){var a=[],c={};this.data=function(){return c},this.add=function(b){a.push(b)},this.remove=function(b){for(var c=0;c").dndCss({position:"absolute",left:-99999,top:-99999,opacity:0,"z-index":-9999});return t(d.body).append(h),{restrict:"A",link:function(a,d,e){function h(c){c=c===b?{}:c;var h=d.dndCss(["font-size","font-family","font-weight","text-transform","border-top","border-right","border-bottom","border-left","padding-top","padding-right","padding-bottom","padding-left"]),i=c.text==b?d.text()||d.val():c.text,j=[];c.width===b&&j.push("width"),c.height===b&&j.push("height"),j.length&&(j=d.dndCss(j));for(var l in j){var m=j[l];if("%"==m[m.length-1])return;c[l]=j[l]}var n=f(i,h),o=g(d,0,0);if(!n.width||!n.height)return void d.dndCss("font-size","");o.width=parseFloat(c.width),o.height=parseFloat(c.height);var p=o.height/n.height,q=o.width/n.width,r=a.$eval(e.dndFittextMax),s=a.$eval(e.dndFittextMin);s==b&&(s=0),r==b&&(r=Number.POSITIVE_INFINITY);var t=q>p?p:q;if(t*=.85,!(t>.95&&1>=t||t>=1&&1.05>t)){var u=t*parseFloat(h["font-size"]);u=k(s,u,r),d.dndCss("font-size",u+"px")}}a.$watch(e.dndFittext,n(function(a){h(a)}),!0),t(c).on("resize",function(){h()})}}}]),B.directive("dndKeyModel",["$parse","dndKey",function(a,c){return{restrict:"A",link:function(d,e,f){var g=a(f.dndKeyModel),h=g.assign;d.$watch(function(){return c.get()},function(a,c){a!==b&&h(d,a)})}}}]),B.directive("dndContainment",["$parse",function(a){function b(b,c,d){var e=a(c.dndContainment);this.get=function(){var a=e(d);return a?b.dndClosest().eq(0):b.parent()}}return b.$inject=["$element","$attrs","$scope"],{restrict:"EAC",controller:b}}]),B.factory("dndKey",["$rootScope",function(a){function b(){}function c(b){var c=b.keyCode;f(b),e.indexOf(c)>-1||(e.push(c),a.$digest())}function d(b){var c=b.keyCode,d=e.indexOf(c);-1!==d&&(e.splice(d,1),a.$digest())}var e=[];b.prototype={get:function(){return e},isset:function(a){var b=e.indexOf(a);return-1!==b}};var f=m(d,1e3);return u.on("keydown",c),u.on("keyup",d),new b}]),B.factory("DndLasso",[function(){function a(a){this.getRect=function(){return this.isActive?a.rect:b},this.getClientRect=function(){return this.isActive?f.dndClientRect():b},this.isActive=function(){return a.active}}function c(b){var c=b.isTarget(),d=new a(this);this.isTarget=function(){return c},this.handler=function(){return d},this.getEvent=function(){return b.getEvent()}}function e(a){function b(b){var d=b.local=new c(b);return d.isTarget()?(d.active=!0,i.trigger("start",d.handler()),b.setReferenceElement(a.$el),b.setBounderElement(a.$el),d.startAxis=b.getRelBorderedAxis(),f.removeAttr("class style").removeClass("ng-hide").addClass(a.className),void a.$el.append(f)):void i.trigger("start",d.handler())}function e(b){var c=b.local;if(!c.active)return void i.trigger("drag",c.handler());var d=b.getRelBorderedAxis().minus(c.startAxis),e={top:c.startAxis.y,left:c.startAxis.x,width:d.x,height:d.y};e.width<0&&(e.width=-e.width,e.left=e.left-e.width),e.height<0&&(e.height=-e.height,e.top=e.top-e.height),c.rect=e,e.top+=a.offsetY,e.left+=a.offsetX,f.dndCss(e),i.trigger("drag",c.handler())}function h(a){var b=a.local;return b.active?(f.addClass("ng-hide"),t(d.body).append(f),void i.trigger("end",b.handler())):void i.trigger("end",b.handler())}var i=this;a=x({},g,a);var j={"$$lasso.dragstart":b,"$$lasso.drag":e,"$$lasso.dragend":h};a.$el.dndBind(j),this.destroy=function(){a.$el.dndUnbind()};var k={};this.on=function(a,b){k[a]=k[a]||[],k[a].push(b)},this.trigger=function(a,b){k[a]=k[a]||[],b=b||"string"==typeof b?[b]:[],k[a].forEach(function(a){a.apply(this,b)})}}var f=t("
").dndCss({position:"absolute"}),g={className:"angular-dnd-lasso",offsetX:0,offsetY:0};return e}]),B.factory("EventEmitter",[function(){function a(){var a={};this.on=function(b,c){a[b]=a[b]||[],a[b].push(c)},this.off=function(b,c){if(a[b])for(var d=0,e=a[b].length;e>d;d++)a[b][d]===c&&a[b].splice(d,1)},this.trigger=function(b,c){a[b]=a[b]||[],c=c||"string"==typeof c?[c]:[],a[b].forEach(function(a){a.apply(this,c)})}}return a}])}(angular,void 0,window,document); \ No newline at end of file +h(b,f,e,g),a.clearCache(),u(c),c.$apply()}},s!==a.noop&&(c.$$onDrag=function(a){s(c),c.$apply()})}var j,k=/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/;return{scope:!0,transclude:!0,template:h,replace:!0,link:i}}]),B.directive("dndSelectable",["$parse",function(a){function c(c,d,f){var g=a(d.dndModelSelecting),h=g.assign||e,i=a(d.dndModelSelected),j=i.assign||e,k=a(d.dndSelectable),l=(k.assign||e,a(d.dndOnSelected)),m=a(d.dndOnUnselected),n=a(d.dndOnSelecting),o=a(d.dndOnUnselecting);j(c,!1),h(c,!1),this.getElement=function(){return f},this.isSelected=function(){return i(c)},this.isSelecting=function(){return g(c)},this.isSelectable=function(){var a=k(c);return a===b||a},this.toggleSelected=function(a){return a=a===b?!this.isSelected():a,a?this.selected():this.unselected()},this.selecting=function(){return this.isSelectable()&&n(c)!==!1&&h(c,!0),this},this.unselecting=function(){return o(c)!==!1&&h(c,!1),this},this.selected=function(){return this.isSelectable()&&l(c)!==!1&&j(c,!0),this},this.unselected=function(){return m(c)!==!1&&j(c,!1),this},this.hit=function(a){var c=this.rectCtrl.getClient();for(var d in c)c[d]=parseFloat(c[d]);return c.bottom=c.bottom==b?c.top+c.height:c.bottom,c.right=c.right==b?c.left+c.width:c.right,a.bottom=a.bottom==b?a.top+a.height:a.bottom,a.right=a.right==b?a.left+a.width:a.right,a.top<=c.top&&c.top<=a.bottom&&(a.left<=c.left&&c.left<=a.right||a.left<=c.right&&c.right<=a.right)||a.top<=c.bottom&&c.bottom<=a.bottom&&(a.left<=c.left&&c.left<=a.right||a.left<=c.right&&c.right<=a.right)||a.left>=c.left&&a.right<=c.right&&(c.top<=a.bottom&&a.bottom<=c.bottom||c.bottom>=a.top&&a.top>=c.top||a.top<=c.top&&a.bottom>=c.bottom)||a.top>=c.top&&a.bottom<=c.bottom&&(c.left<=a.right&&a.right<=c.right||c.right>=a.left&&a.left>=c.left||a.left<=c.left&&a.right>=c.right)||a.top>=c.top&&a.right<=c.right&&a.bottom<=c.bottom&&a.left>=c.left}}function d(a){this.$element=a}return c.$inject=["$scope","$attrs","$element"],d.prototype={getClient:function(){return this.$element.dndClientRect()}},{restrict:"A",require:["dndSelectable","^dndLassoArea","?dndRect"],controller:c,scope:!0,link:function(c,f,g,h){function i(){h[1].remove(h[0]),c.$$phase||c.$apply()}c.$dndSelectable=h[0];var j=h[2];h[0].rectCtrl=j?j:new d(f),h[1].add(h[0]),f.on("$destroy",i);var k=a(g.dndOnSelected),l=a(g.dndOnUnselected),m=a(g.dndOnSelecting),n=a(g.dndOnUnselecting);(k||l)&&(k=k||e,l=l||e,c.$watch(g.dndModelSelected,function(a,d){a!==b&&d!==b&&a!==d&&(a?k(c):l(c))})),(m||n)&&(m=m||e,n=n||e,c.$watch(g.dndModelSelecting,function(a,d){a!==b&&d!==b&&a!==d&&(a?m(c):n(c))}))}}}]),B.directive("dndRect",["$parse",function(a){function c(c,f,g){function h(a){var c;a="object"==typeof a?a:{};for(var f=0;f-1},c.$inject=["$scope","$attrs","$element"],{restrict:"A",controller:c}}]),B.directive("dndModel",["$parse",function(a){function b(b,c){var d=a(c.dndModel),e=d.assign;this.set=function(a){e(b,a)},this.get=function(){return d(b)}}return b.$inject=["$scope","$attrs"],{restrict:"A",controller:b}}]),B.directive("dndLassoArea",["DndLasso","$parse","$timeout","dndKey",function(a,c,d,e){function f(){var a=[],c={};this.data=function(){return c},this.add=function(b){a.push(b)},this.remove=function(b){for(var c=0;c").dndCss({position:"absolute",left:-99999,top:-99999,opacity:0,"z-index":-9999});return t(d.body).append(h),{restrict:"A",link:function(a,d,e){function h(c){c=c===b?{}:c;var h=d.dndCss(["font-size","font-family","font-weight","text-transform","border-top","border-right","border-bottom","border-left","padding-top","padding-right","padding-bottom","padding-left"]),i=c.text==b?d.text()||d.val():c.text,j=[];c.width===b&&j.push("width"),c.height===b&&j.push("height"),j.length&&(j=d.dndCss(j));for(var l in j){var m=j[l];if("%"==m[m.length-1])return;c[l]=j[l]}var n=f(i,h),o=g(d,0,0);if(!n.width||!n.height)return void d.dndCss("font-size","");o.width=parseFloat(c.width),o.height=parseFloat(c.height);var p=o.height/n.height,q=o.width/n.width,r=a.$eval(e.dndFittextMax),s=a.$eval(e.dndFittextMin);s==b&&(s=0),r==b&&(r=Number.POSITIVE_INFINITY);var t=q>p?p:q;if(t*=.85,!(t>.95&&1>=t||t>=1&&1.05>t)){var u=t*parseFloat(h["font-size"]);u=k(s,u,r),d.dndCss("font-size",u+"px")}}a.$watch(e.dndFittext,n(function(a){h(a)}),!0),t(c).on("resize",function(){h()})}}}]),B.directive("dndKeyModel",["$parse","dndKey",function(a,c){return{restrict:"A",link:function(d,e,f){var g=a(f.dndKeyModel),h=g.assign;d.$watch(function(){return c.get()},function(a,c){a!==b&&h(d,a)})}}}]),B.directive("dndContainment",["$parse",function(a){function b(b,c,d){var e=a(c.dndContainment);this.get=function(){var a=e(d);return a?b.dndClosest(a).eq(0):b.parent()}}return b.$inject=["$element","$attrs","$scope"],{restrict:"EAC",controller:b}}]),B.factory("dndKey",["$rootScope",function(a){function b(){}function c(b){var c=b.keyCode;f(b),e.indexOf(c)>-1||(e.push(c),a.$digest())}function d(b){var c=b.keyCode,d=e.indexOf(c);-1!==d&&(e.splice(d,1),a.$digest())}var e=[];b.prototype={get:function(){return e},isset:function(a){var b=e.indexOf(a);return-1!==b}};var f=m(d,1e3);return u.on("keydown",c),u.on("keyup",d),new b}]),B.factory("DndLasso",[function(){function a(a){this.getRect=function(){return this.isActive?a.rect:b},this.getClientRect=function(){return this.isActive?f.dndClientRect():b},this.isActive=function(){return a.active}}function c(b){var c=b.isTarget(),d=new a(this);this.isTarget=function(){return c},this.handler=function(){return d},this.getEvent=function(){return b.getEvent()}}function e(a){function b(b){var d=b.local=new c(b);return d.isTarget()?(d.active=!0,i.trigger("start",d.handler()),b.setReferenceElement(a.$el),b.setBounderElement(a.$el),d.startAxis=b.getRelBorderedAxis(),f.removeAttr("class style").removeClass("ng-hide").addClass(a.className),void a.$el.append(f)):void i.trigger("start",d.handler())}function e(b){var c=b.local;if(!c.active)return void i.trigger("drag",c.handler());var d=b.getRelBorderedAxis().minus(c.startAxis),e={top:c.startAxis.y,left:c.startAxis.x,width:d.x,height:d.y};e.width<0&&(e.width=-e.width,e.left=e.left-e.width),e.height<0&&(e.height=-e.height,e.top=e.top-e.height),c.rect=e,e.top+=a.offsetY,e.left+=a.offsetX,f.dndCss(e),i.trigger("drag",c.handler())}function h(a){var b=a.local;return b.active?(f.addClass("ng-hide"),t(d.body).append(f),void i.trigger("end",b.handler())):void i.trigger("end",b.handler())}var i=this;a=x({},g,a);var j={"$$lasso.dragstart":b,"$$lasso.drag":e,"$$lasso.dragend":h};a.$el.dndBind(j),this.destroy=function(){a.$el.dndUnbind()};var k={};this.on=function(a,b){k[a]=k[a]||[],k[a].push(b)},this.trigger=function(a,b){k[a]=k[a]||[],b=b||"string"==typeof b?[b]:[],k[a].forEach(function(a){a.apply(this,b)})}}var f=t("
").dndCss({position:"absolute"}),g={className:"angular-dnd-lasso",offsetX:0,offsetY:0};return e}]),B.factory("EventEmitter",[function(){function a(){var a={};this.on=function(b,c){a[b]=a[b]||[],a[b].push(c)},this.off=function(b,c){if(a[b])for(var d=0,e=a[b].length;e>d;d++)a[b][d]===c&&a[b].splice(d,1)},this.trigger=function(b,c){a[b]=a[b]||[],c=c||"string"==typeof c?[c]:[],a[b].forEach(function(a){a.apply(this,c)})}}return a}])}(angular,void 0,window,document); \ No newline at end of file diff --git a/src/directives/dndContainment.js b/src/directives/dndContainment.js index 749e2dd..b2fe953 100644 --- a/src/directives/dndContainment.js +++ b/src/directives/dndContainment.js @@ -7,7 +7,7 @@ module.directive('dndContainment', ['$parse', function($parse){ this.get = function () { var selector = getterSelector($scope); - return selector ? $element.dndClosest().eq(0) : $element.parent(); + return selector ? $element.dndClosest(selector).eq(0) : $element.parent(); } }