| 12 |
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("rxjs"),require("@angular/core")):"function"==typeof define&&define.amd?define("angular2-draggable",["exports","rxjs","@angular/core"],e):e(t["angular2-draggable"]={},t.rxjs,t.ng.core)}(this,function(t,i,n){"use strict";var s=function(){function r(t,e){this.x=t,this.y=e}return r.fromEvent=function(t,e){if(void 0===e&&(e=null),this.isMouseEvent(t))return new r(t.clientX,t.clientY);if(null===e||1===t.changedTouches.length)return new r(t.changedTouches[0].clientX,t.changedTouches[0].clientY);for(var i=0;i<t.changedTouches.length;i++)if(t.changedTouches[i].target===e)return new r(t.changedTouches[i].clientX,t.changedTouches[i].clientY)},r.isMouseEvent=function(t){return 8===Object.prototype.toString.apply(t).indexOf("MouseEvent")},r.isIPosition=function(t){return!!t&&"x"in t&&"y"in t},r.getCurrent=function(t){var e=new r(0,0);if(window){var i=window.getComputedStyle(t);if(i){var n=parseInt(i.getPropertyValue("left"),10),s=parseInt(i.getPropertyValue("top"),10);e.x=isNaN(n)?0:n,e.y=isNaN(s)?0:s}return e}return console.error("Not Supported!"),null},r.copy=function(t){return new r(0,0).set(t)},Object.defineProperty(r.prototype,"value",{get:function(){return{x:this.x,y:this.y}},enumerable:!0,configurable:!0}),r.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},r.prototype.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},r.prototype.multiply=function(t){this.x*=t,this.y*=t},r.prototype.divide=function(t){this.x/=t,this.y/=t},r.prototype.reset=function(){return this.x=0,this.y=0,this},r.prototype.set=function(t){return this.x=t.x,this.y=t.y,this},r}(),r=function(){function t(t,e){this.parent=t,this.renderer=e,this._added=!1;var i=e.createElement("div");e.setStyle(i,"position","absolute"),e.setStyle(i,"width","100%"),e.setStyle(i,"height","100%"),e.setStyle(i,"background-color","transparent"),e.setStyle(i,"top","0"),e.setStyle(i,"left","0"),this._helper=i}return t.prototype.add=function(){this.parent&&!this._added&&(this.parent.appendChild(this._helper),this._added=!0)},t.prototype.remove=function(){this.parent&&this._added&&(this.parent.removeChild(this._helper),this._added=!1)},t.prototype.dispose=function(){this._helper=null,this._added=!1},Object.defineProperty(t.prototype,"el",{get:function(){return this._helper},enumerable:!0,configurable:!0}),t}(),e=function(){function t(t,e){this.el=t,this.renderer=e,this.allowDrag=!0,this.moving=!1,this.orignal=null,this.oldTrans=new s(0,0),this.tempTrans=new s(0,0),this.currTrans=new s(0,0),this.oldZIndex="",this._zIndex="",this.needTransform=!1,this.draggingSub=null,this._helperBlock=null,this.started=new n.EventEmitter,this.stopped=new n.EventEmitter,this.edge=new n.EventEmitter,this.outOfBounds={top:!1,right:!1,bottom:!1,left:!1},this.gridSize=1,this.inBounds=!1,this.trackPosition=!0,this.scale=1,this.preventDefaultEvent=!1,this.position={x:0,y:0},this.lockAxis=null,this.movingOffset=new n.EventEmitter,this.endOffset=new n.EventEmitter,this._helperBlock=new r(t.nativeElement,e)}return Object.defineProperty(t.prototype,"zIndex",{set:function(t){this.renderer.setStyle(this.el.nativeElement,"z-index",t),this._zIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ngDraggable",{set:function(t){if(t!==undefined&&null!==t&&""!==t){this.allowDrag=!!t;var e=this.getDragEl();this.allowDrag?this.renderer.addClass(e,"ng-draggable"):(this.putBack(),this.renderer.removeClass(e,"ng-draggable"))}},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){if(this.allowDrag){var t=this.getDragEl();this.renderer.addClass(t,"ng-draggable")}this.resetPosition()},t.prototype.ngOnDestroy=function(){this.bounds=null,this.handle=null,this.orignal=null,this.oldTrans=null,this.tempTrans=null,this.currTrans=null,this._helperBlock.dispose(),this._helperBlock=null,this.draggingSub&&this.draggingSub.unsubscribe()},t.prototype.ngOnChanges=function(t){if(t.position&&!t.position.isFirstChange()){var e=t.position.currentValue;this.moving?this.needTransform=!0:(s.isIPosition(e)?this.oldTrans.set(e):this.oldTrans.reset(),this.transform())}},t.prototype.ngAfterViewInit=function(){this.inBounds&&(this.boundsCheck(),this.oldTrans.add(this.tempTrans),this.tempTrans.reset())},t.prototype.getDragEl=function(){return this.handle?this.handle:this.el.nativeElement},t.prototype.resetPosition=function(){s.isIPosition(this.position)?this.oldTrans.set(this.position):this.oldTrans.reset(),this.tempTrans.reset(),this.transform()},t.prototype.moveTo=function(t){this.orignal&&(t.subtract(this.orignal),this.tempTrans.set(t),this.tempTrans.divide(this.scale),this.transform(),this.bounds&&this.edge.emit(this.boundsCheck()),this.movingOffset.emit(this.currTrans.value))},t.prototype.transform=function(){var t=this.tempTrans.x+this.oldTrans.x,e=this.tempTrans.y+this.oldTrans.y;"x"===this.lockAxis?(t=this.oldTrans.x,this.tempTrans.x=0):"y"===this.lockAxis&&(e=this.oldTrans.y,this.tempTrans.y=0),1<this.gridSize&&(t=Math.round(t/this.gridSize)*this.gridSize,e=Math.round(e/this.gridSize)*this.gridSize);var i="translate("+Math.round(t)+"px, "+Math.round(e)+"px)";this.renderer.setStyle(this.el.nativeElement,"transform",i),this.renderer.setStyle(this.el.nativeElement,"-webkit-transform",i),this.renderer.setStyle(this.el.nativeElement,"-ms-transform",i),this.renderer.setStyle(this.el.nativeElement,"-moz-transform",i),this.renderer.setStyle(this.el.nativeElement,"-o-transform",i),this.currTrans.x=t,this.currTrans.y=e},t.prototype.pickUp=function(){if(this.oldZIndex=this.el.nativeElement.style.zIndex?this.el.nativeElement.style.zIndex:"",window&&(this.oldZIndex=window.getComputedStyle(this.el.nativeElement,null).getPropertyValue("z-index")),this.zIndexMoving&&this.renderer.setStyle(this.el.nativeElement,"z-index",this.zIndexMoving),!this.moving){this.started.emit(this.el.nativeElement),this.moving=!0;var t=this.getDragEl();this.renderer.addClass(t,"ng-dragging"),this.subscribeEvents()}},t.prototype.subscribeEvents=function(){var e=this;this.draggingSub=i.fromEvent(document,"mousemove",{passive:!1}).subscribe(function(t){return e.onMouseMove(t)}),this.draggingSub.add(i.fromEvent(document,"touchmove",{passive:!1}).subscribe(function(t){return e.onMouseMove(t)})),this.draggingSub.add(i.fromEvent(document,"mouseup",{passive:!1}).subscribe(function(){return e.putBack()})),/msie\s|trident\//i.test(window.navigator.userAgent)||this.draggingSub.add(i.fromEvent(document,"mouseleave",{passive:!1}).subscribe(function(){return e.putBack()})),this.draggingSub.add(i.fromEvent(document,"touchend",{passive:!1}).subscribe(function(){return e.putBack()})),this.draggingSub.add(i.fromEvent(document,"touchcancel",{passive:!1}).subscribe(function(){return e.putBack()}))},t.prototype.unsubscribeEvents=function(){this.draggingSub.unsubscribe(),this.draggingSub=null},t.prototype.boundsCheck=function(){if(this.bounds){var t=this.bounds.getBoundingClientRect(),e=this.el.nativeElement.getBoundingClientRect(),i={top:!!this.outOfBounds.top||t.top<e.top,right:!!this.outOfBounds.right||t.right>e.right,bottom:!!this.outOfBounds.bottom||t.bottom>e.bottom,left:!!this.outOfBounds.left||t.left<e.left};return this.inBounds&&(i.top||(this.tempTrans.y-=(e.top-t.top)/this.scale),i.bottom||(this.tempTrans.y-=(e.bottom-t.bottom)/this.scale),i.right||(this.tempTrans.x-=(e.right-t.right)/this.scale),i.left||(this.tempTrans.x-=(e.left-t.left)/this.scale),this.transform()),i}},t.prototype.getCurrentOffset=function(){return this.currTrans.value},t.prototype.putBack=function(){if(this._zIndex?this.renderer.setStyle(this.el.nativeElement,"z-index",this._zIndex):this.zIndexMoving&&(this.oldZIndex?this.renderer.setStyle(this.el.nativeElement,"z-index",this.oldZIndex):this.el.nativeElement.style.removeProperty("z-index")),this.moving){this.stopped.emit(this.el.nativeElement),this._helperBlock.remove(),this.needTransform&&(s.isIPosition(this.position)?this.oldTrans.set(this.position):this.oldTrans.reset(),this.transform(),this.needTransform=!1),this.bounds&&this.edge.emit(this.boundsCheck()),this.moving=!1,this.endOffset.emit(this.currTrans.value),this.trackPosition&&this.oldTrans.add(this.tempTrans),this.tempTrans.reset(),this.trackPosition||this.transform();var t=this.getDragEl();this.renderer.removeClass(t,"ng-dragging"),this.unsubscribeEvents()}},t.prototype.checkHandleTarget=function(t,e){if("BUTTON"===e.tagName)return!1;if(e===t)return!0;for(var i in e.children)if(e.children.hasOwnProperty(i)&&this.checkHandleTarget(t,e.children[i]))return!0;return!1},t.prototype.onMouseDown=function(t){if(!(t instanceof MouseEvent&&2===t.button)){var e=t.target||t.srcElement;(this.handle===undefined||this.checkHandleTarget(e,this.handle))&&!1!==this.allowDrag&&(this.preventDefaultEvent&&(t.stopPropagation(),t.preventDefault()),this.orignal=s.fromEvent(t,this.getDragEl()),this.pickUp())}},t.prototype.onMouseMove=function(t){this.moving&&this.allowDrag&&(this.preventDefaultEvent&&(t.stopPropagation(),t.preventDefault()),this._helperBlock.add(),this.moveTo(s.fromEvent(t,this.getDragEl())))},t.decorators=[{type:n.Directive,args:[{selector:"[ngDraggable]",exportAs:"ngDraggable"}]}],t.ctorParameters=function(){return[{type:n.ElementRef},{type:n.Renderer2}]},t.propDecorators={started:[{type:n.Output}],stopped:[{type:n.Output}],edge:[{type:n.Output}],handle:[{type:n.Input}],bounds:[{type:n.Input}],outOfBounds:[{type:n.Input}],gridSize:[{type:n.Input}],zIndexMoving:[{type:n.Input}],zIndex:[{type:n.Input}],inBounds:[{type:n.Input}],trackPosition:[{type:n.Input}],scale:[{type:n.Input}],preventDefaultEvent:[{type:n.Input}],position:[{type:n.Input}],lockAxis:[{type:n.Input}],movingOffset:[{type:n.Output}],endOffset:[{type:n.Output}],ngDraggable:[{type:n.Input}],onMouseDown:[{type:n.HostListener,args:["mousedown",["$event"]]},{type:n.HostListener,args:["touchstart",["$event"]]}]},t}(),o=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t};function p(t){var e="function"==typeof Symbol&&t[Symbol.iterator],i=0;return e?e.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}var h=function(){function t(t,e,i,n,s){var r=this;this.parent=t,this.renderer=e,this.type=i,this.css=n,this.onMouseDown=s;var o=e.createElement("div");e.addClass(o,"ng-resizable-handle"),e.addClass(o,n),"se"===i&&e.addClass(o,"ng-resizable-diagonal"),this.parent&&t.appendChild(o),this._onResize=function(t){s(t,r)},o.addEventListener("mousedown",this._onResize,{passive:!1}),o.addEventListener("touchstart",this._onResize,{passive:!1}),this._handle=o}return t.prototype.dispose=function(){this._handle.removeEventListener("mousedown",this._onResize),this._handle.removeEventListener("touchstart",this._onResize),this.parent&&this.parent.removeChild(this._handle),this._handle=null,this._onResize=null},Object.defineProperty(t.prototype,"el",{get:function(){return this._handle},enumerable:!0,configurable:!0}),t}(),a=function(){function n(t,e){this.width=t,this.height=e}return n.getCurrent=function(t){var e=new n(0,0);if(window){var i=window.getComputedStyle(t);return i&&(e.width=parseInt(i.getPropertyValue("width"),10),e.height=parseInt(i.getPropertyValue("height"),10)),e}return console.error("Not Supported!"),null},n.copy=function(t){return new n(0,0).set(t)},n.prototype.set=function(t){return this.width=t.width,this.height=t.height,this},n}(),u=function(){function t(t,e){this.el=t,this.renderer=e,this._resizable=!0,this._handles={},this._handleType=[],this._handleResizing=null,this._direction=null,this._directionChanged=null,this._aspectRatio=0,this._containment=null,this._origMousePos=null,this._origSize=null,this._origPos=null,this._currSize=null,this._currPos=null,this._initSize=null,this._initPos=null,this._gridSize=null,this._bounding=null,this._helperBlock=null,this.draggingSub=null,this._adjusted=!1,this.rzHandles="e,s,se",this.rzAspectRatio=!1,this.rzContainment=null,this.rzGrid=null,this.rzMinWidth=null,this.rzMinHeight=null,this.rzMaxWidth=null,this.rzMaxHeight=null,this.preventDefaultEvent=!0,this.rzStart=new n.EventEmitter,this.rzResizing=new n.EventEmitter,this.rzStop=new n.EventEmitter,this._helperBlock=new r(t.nativeElement,e)}return Object.defineProperty(t.prototype,"ngResizable",{set:function(t){t!==undefined&&null!==t&&""!==t&&(this._resizable=!!t,this.updateResizable())},enumerable:!0,configurable:!0}),t.prototype.ngOnChanges=function(t){t.rzHandles&&!t.rzHandles.isFirstChange()&&this.updateResizable(),t.rzAspectRatio&&!t.rzAspectRatio.isFirstChange()&&this.updateAspectRatio(),t.rzContainment&&!t.rzContainment.isFirstChange()&&this.updateContainment()},t.prototype.ngOnInit=function(){this.updateResizable()},t.prototype.ngOnDestroy=function(){this.removeHandles(),this._containment=null,this._helperBlock.dispose(),this._helperBlock=null},t.prototype.ngAfterViewInit=function(){var t=this.el.nativeElement;this._initSize=a.getCurrent(t),this._initPos=s.getCurrent(t),this._currSize=a.copy(this._initSize),this._currPos=s.copy(this._initPos),this.updateAspectRatio(),this.updateContainment()},t.prototype.resetSize=function(){this._currSize=a.copy(this._initSize),this._currPos=s.copy(this._initPos),this.doResize()},t.prototype.getStatus=function(){return this._currPos&&this._currSize?{size:{width:this._currSize.width,height:this._currSize.height},position:{top:this._currPos.y,left:this._currPos.x}}:null},t.prototype.updateResizable=function(){var t=this.el.nativeElement;this.renderer.removeClass(t,"ng-resizable"),this.removeHandles(),this._resizable&&(this.renderer.addClass(t,"ng-resizable"),this.createHandles())},t.prototype.updateAspectRatio=function(){if("boolean"==typeof this.rzAspectRatio)this.rzAspectRatio&&this._currSize.height?this._aspectRatio=this._currSize.width/this._currSize.height:this._aspectRatio=0;else{var t=Number(this.rzAspectRatio);this._aspectRatio=isNaN(t)?0:t}},t.prototype.updateContainment=function(){this.rzContainment?"string"==typeof this.rzContainment?"parent"===this.rzContainment?this._containment=this.el.nativeElement.parentElement:this._containment=document.querySelector(this.rzContainment):this._containment=this.rzContainment:this._containment=null},t.prototype.createHandles=function(){var t,e,i,n,s;if(this.rzHandles)if("string"==typeof this.rzHandles){s="all"===this.rzHandles?["n","e","s","w","ne","se","nw","sw"]:this.rzHandles.replace(/ /g,"").toLowerCase().split(",");try{for(var r=p(s),o=r.next();!o.done;o=r.next()){var h=o.value;(d=this.createHandleByType(h,"ng-resizable-"+h))&&(this._handleType.push(h),this._handles[h]=d)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(e=r["return"])&&e.call(r)}finally{if(t)throw t.error}}}else{s=Object.keys(this.rzHandles);try{for(var a=p(s),u=a.next();!u.done;u=a.next()){var d;h=u.value;(d=this.createHandleByType(h,this.rzHandles[h]))&&(this._handleType.push(h),this._handles[h]=d)}}catch(c){i={error:c}}finally{try{u&&!u.done&&(n=a["return"])&&n.call(a)}finally{if(i)throw i.error}}}},t.prototype.createHandleByType=function(t,e){var i=this.el.nativeElement;return t.match(/^(se|sw|ne|nw|n|e|s|w)$/)?new h(i,this.renderer,t,e,this.onMouseDown.bind(this)):(console.error("Invalid handle type:",t),null)},t.prototype.removeHandles=function(){var t,e;try{for(var i=p(this._handleType),n=i.next();!n.done;n=i.next()){var s=n.value;this._handles[s].dispose()}}catch(r){t={error:r}}finally{try{n&&!n.done&&(e=i["return"])&&e.call(i)}finally{if(t)throw t.error}}this._handleType=[],this._handles={}},t.prototype.onMouseDown=function(t,e){t instanceof MouseEvent&&2===t.button||(this.preventDefaultEvent&&(t.stopPropagation(),t.preventDefault()),this._handleResizing||(this._origMousePos=s.fromEvent(t),this.startResize(e),this.subscribeEvents()))},t.prototype.subscribeEvents=function(){var e=this;this.draggingSub=i.fromEvent(document,"mousemove",{passive:!1}).subscribe(function(t){return e.onMouseMove(t)}),this.draggingSub.add(i.fromEvent(document,"touchmove",{passive:!1}).subscribe(function(t){return e.onMouseMove(t)})),this.draggingSub.add(i.fromEvent(document,"mouseup",{passive:!1}).subscribe(function(){return e.onMouseLeave()})),/msie\s|trident\//i.test(window.navigator.userAgent)||this.draggingSub.add(i.fromEvent(document,"mouseleave",{passive:!1}).subscribe(function(){return e.onMouseLeave()})),this.draggingSub.add(i.fromEvent(document,"touchend",{passive:!1}).subscribe(function(){return e.onMouseLeave()})),this.draggingSub.add(i.fromEvent(document,"touchcancel",{passive:!1}).subscribe(function(){return e.onMouseLeave()}))},t.prototype.unsubscribeEvents=function(){this.draggingSub.unsubscribe(),this.draggingSub=null},t.prototype.onMouseLeave=function(){this._handleResizing&&(this.stopResize(),this._origMousePos=null,this.unsubscribeEvents())},t.prototype.onMouseMove=function(t){this._handleResizing&&this._resizable&&this._origMousePos&&this._origPos&&this._origSize&&(this.resizeTo(s.fromEvent(t)),this.onResizing())},t.prototype.startResize=function(t){var e=this.el.nativeElement;this._origSize=a.getCurrent(e),this._origPos=s.getCurrent(e),this._currSize=a.copy(this._origSize),this._currPos=s.copy(this._origPos),this._containment&&this.getBounding(),this.getGridSize(),this._helperBlock.add(),this._handleResizing=t,this.updateDirection(),this.rzStart.emit(this.getResizingEvent())},t.prototype.stopResize=function(){this._helperBlock.remove(),this.rzStop.emit(this.getResizingEvent()),this._handleResizing=null,this._direction=null,this._origSize=null,this._origPos=null,this._containment&&this.resetBounding()},t.prototype.onResizing=function(){this.rzResizing.emit(this.getResizingEvent())},t.prototype.getResizingEvent=function(){return{host:this.el.nativeElement,handle:this._handleResizing?this._handleResizing.el:null,size:{width:this._currSize.width,height:this._currSize.height},position:{top:this._currPos.y,left:this._currPos.x},direction:o({},this._directionChanged)}},t.prototype.updateDirection=function(){this._direction={n:!!this._handleResizing.type.match(/n/),s:!!this._handleResizing.type.match(/s/),w:!!this._handleResizing.type.match(/w/),e:!!this._handleResizing.type.match(/e/)},this._directionChanged=o({},this._direction),this.rzAspectRatio&&(this._directionChanged.n&&!this._directionChanged.e&&(this._directionChanged.w=!0),this._directionChanged.s&&!this._directionChanged.w&&(this._directionChanged.e=!0),this._directionChanged.e&&!this._directionChanged.n&&(this._directionChanged.s=!0),this._directionChanged.w&&!this._directionChanged.n&&(this._directionChanged.s=!0))},t.prototype.resizeTo=function(t){t.subtract(this._origMousePos);var e=Math.round(t.x/this._gridSize.x)*this._gridSize.x,i=Math.round(t.y/this._gridSize.y)*this._gridSize.y;this._direction.n?(this._currPos.y=this._origPos.y+i,this._currSize.height=this._origSize.height-i):this._direction.s&&(this._currSize.height=this._origSize.height+i),this._direction.e?this._currSize.width=this._origSize.width+e:this._direction.w&&(this._currSize.width=this._origSize.width-e,this._currPos.x=this._origPos.x+e),this.checkBounds(),this.checkSize(),this.adjustByRatio(),this.doResize()},t.prototype.doResize=function(){var t=this.el.nativeElement;(!this._direction||this._direction.n||this._direction.s||this._aspectRatio)&&this.renderer.setStyle(t,"height",this._currSize.height+"px"),(!this._direction||this._direction.w||this._direction.e||this._aspectRatio)&&this.renderer.setStyle(t,"width",this._currSize.width+"px"),this.renderer.setStyle(t,"left",this._currPos.x+"px"),this.renderer.setStyle(t,"top",this._currPos.y+"px")},t.prototype.adjustByRatio=function(){if(this._aspectRatio&&!this._adjusted)if(this._direction.e||this._direction.w){var t=Math.floor(this._currSize.width/this._aspectRatio);this._direction.n&&(this._currPos.y+=this._currSize.height-t),this._currSize.height=t}else{var e=Math.floor(this._aspectRatio*this._currSize.height);this._direction.n&&(this._currPos.x+=this._currSize.width-e),this._currSize.width=e}},t.prototype.checkBounds=function(){if(this._containment){var t=this._bounding.width-this._bounding.pr-this._bounding.deltaL-this._bounding.translateX-this._currPos.x,e=this._bounding.height-this._bounding.pb-this._bounding.deltaT-this._bounding.translateY-this._currPos.y;if(this._direction.n&&this._currPos.y+this._bounding.translateY<0&&(this._currPos.y=-this._bounding.translateY,this._currSize.height=this._origSize.height+this._origPos.y+this._bounding.translateY),this._direction.w&&this._currPos.x+this._bounding.translateX<0&&(this._currPos.x=-this._bounding.translateX,this._currSize.width=this._origSize.width+this._origPos.x+this._bounding.translateX),this._currSize.width>t&&(this._currSize.width=t),this._currSize.height>e&&(this._currSize.height=e),this._aspectRatio){if(this._adjusted=!1,(this._direction.w||this._direction.e)&&this._currSize.width/this._aspectRatio>=e){var i=Math.floor(e*this._aspectRatio);this._direction.w&&(this._currPos.x+=this._currSize.width-i),this._currSize.width=i,this._currSize.height=e,this._adjusted=!0}if((this._direction.n||this._direction.s)&&this._currSize.height*this._aspectRatio>=t){var n=Math.floor(t/this._aspectRatio);this._direction.n&&(this._currPos.y+=this._currSize.height-n),this._currSize.width=t,this._currSize.height=n,this._adjusted=!0}}}},t.prototype.checkSize=function(){var t=this.rzMinHeight?this.rzMinHeight:1,e=this.rzMinWidth?this.rzMinWidth:1;this._currSize.height<t&&(this._currSize.height=t,this._direction.n&&(this._currPos.y=this._origPos.y+(this._origSize.height-t))),this._currSize.width<e&&(this._currSize.width=e,this._direction.w&&(this._currPos.x=this._origPos.x+(this._origSize.width-e))),this.rzMaxHeight&&this._currSize.height>this.rzMaxHeight&&(this._currSize.height=this.rzMaxHeight,this._direction.n&&(this._currPos.y=this._origPos.y+(this._origSize.height-this.rzMaxHeight))),this.rzMaxWidth&&this._currSize.width>this.rzMaxWidth&&(this._currSize.width=this.rzMaxWidth,this._direction.w&&(this._currPos.x=this._origPos.x+(this._origSize.width-this.rzMaxWidth)))},t.prototype.getBounding=function(){var t=this._containment,e=window.getComputedStyle(t);if(e){var i=e.getPropertyValue("position"),n=window.getComputedStyle(this.el.nativeElement).getPropertyValue("transform").replace(/[^-\d,]/g,"").split(",");this._bounding={},this._bounding.width=t.clientWidth,this._bounding.height=t.clientHeight,this._bounding.pr=parseInt(e.getPropertyValue("padding-right"),10),this._bounding.pb=parseInt(e.getPropertyValue("padding-bottom"),10),this._bounding.deltaL=this.el.nativeElement.offsetLeft-this._currPos.x,this._bounding.deltaT=this.el.nativeElement.offsetTop-this._currPos.y,6<=n.length?(this._bounding.translateX=parseInt(n[4],10),this._bounding.translateY=parseInt(n[5],10)):(this._bounding.translateX=0,this._bounding.translateY=0),this._bounding.position=e.getPropertyValue("position"),"static"===i&&this.renderer.setStyle(t,"position","relative")}},t.prototype.resetBounding=function(){this._bounding&&"static"===this._bounding.position&&this.renderer.setStyle(this._containment,"position","relative"),this._bounding=null},t.prototype.getGridSize=function(){this._gridSize={x:1,y:1},this.rzGrid&&("number"==typeof this.rzGrid?this._gridSize={x:this.rzGrid,y:this.rzGrid}:Array.isArray(this.rzGrid)&&(this._gridSize={x:this.rzGrid[0],y:this.rzGrid[1]}))},t.decorators=[{type:n.Directive,args:[{selector:"[ngResizable]",exportAs:"ngResizable"}]}],t.ctorParameters=function(){return[{type:n.ElementRef},{type:n.Renderer2}]},t.propDecorators={ngResizable:[{type:n.Input}],rzHandles:[{type:n.Input}],rzAspectRatio:[{type:n.Input}],rzContainment:[{type:n.Input}],rzGrid:[{type:n.Input}],rzMinWidth:[{type:n.Input}],rzMinHeight:[{type:n.Input}],rzMaxWidth:[{type:n.Input}],rzMaxHeight:[{type:n.Input}],preventDefaultEvent:[{type:n.Input}],rzStart:[{type:n.Output}],rzResizing:[{type:n.Output}],rzStop:[{type:n.Output}]},t}(),d=function(){function t(){}return t.decorators=[{type:n.NgModule,args:[{imports:[],declarations:[e,u],exports:[e,u]}]}],t}();t.AngularDraggableDirective=e,t.AngularResizableDirective=u,t.AngularDraggableModule=d,t.Position=s,Object.defineProperty(t,"__esModule",{value:!0})});
- //# sourceMappingURL=angular2-draggable.umd.min.js.map
|