diff --git a/examples/srcissors.js b/examples/srcissors.js index f98cf5d..2af93a6 100644 --- a/examples/srcissors.js +++ b/examples/srcissors.js @@ -1,2 +1,2 @@ -!function(i,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?exports.srcissors=t(require("jquery")):i.srcissors=t(i.jQuery)}(self,(i=>{return t={490:(i,t,e)=>{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){(null==t||t>i.length)&&(t=i.length);for(var e=0,n=new Array(t);eh&&delete this.minResolution,this.minResolution){var o=this.minResolution/(this.imageHeight*this.imageHeight);(!this.minViewRatio||this.minViewRatior)&&(this.maxViewRatio=r)}this.calcMaxMinDimensions(),this.fixedWidth&&(t="width"),this.fixedHeight&&(t="height"),this.setViewDimensions({width:this.imageWidth,height:this.imageHeight,keepDimension:t}),this.isReady=!0,this.view.removeClass(this.loadingCssClass),this.isInitialized||null==this.initialCrop?(this.zoomAllOut(),this.center()):this.setCrop(this.initialCrop),this.isInitialized=!0,this.readyEvent.fire(),this.loadEvent.fire()}},{key:"setCrop",value:function(i){var t=this,e=i.x,n=i.y,s=i.width,h=i.height;if(this.isReady){this.resize({width:s,height:h});var o=this.viewWidth/s,r=this.imageWidth*o;this.zoom({width:r}),this.pan({x:e*o,y:n*o})}else this.on("ready",(function(){return t.setCrop({x:e,y:n,width:s,height:h})}))}},{key:"getCrop",value:function(){var i=this.preview.width/this.imageWidth,t={x:this.preview.x/i,y:this.preview.y/i,width:this.viewWidth/i,height:this.viewHeight/i};return this.roundCrop(t),this.validateCrop(t),t}},{key:"roundCrop",value:function(i){for(var t in i){var e=i[t];i[t]=Math.round(e)}}},{key:"validateCrop",value:function(i){var t=i.x,e=i.y,n=i.width,s=i.height;return t<0&&(i.x=0),e<0&&(i.y=0),t+n>this.imageWidth&&(i.width=this.imageWidth-t),e+s>this.imageHeight&&(i.height=this.imageHeight-e),i}},{key:"setRatio",value:function(i,t){var e,n,s=this;if(this.isReady)return i=this.enforceValidRatio(i),"height"===t?n=(e=this.viewHeight)*i:e=(n=this.viewWidth)/i,this.resizeFocusPoint=this.getFocusPoint(),this.resize({width:n,height:e});this.on("ready",(function(){return s.setRatio(i,t)}))}},{key:"onPan",value:function(i){this.isPanning||(this.isPanning=!0,this.arena.addClass(this.panningCssClass),this.outline.addClass(this.outlineCssClass));var t=i.startX-i.dx,e=i.startY-i.dy;this.pan({x:t,y:e})}},{key:"onPanEnd",value:function(){return this.isPanning=!1,this.arena.removeClass(this.panningCssClass),this.outline.removeClass(this.outlineCssClass)}},{key:"onDoubleClick",value:function(i){var t=i.pageX,e=i.pageY,n=this.view[0].getBoundingClientRect(),s=t-n.left,h=e-n.top;this.zoomIn({viewX:s,viewY:h})}},{key:"onResize",value:function(i){var t=i.position,e=i.dx,n=i.dy;this.isResizing||(this.isResizing=!0,this.resizeFocusPoint=this.getFocusPoint()),["top","bottom"].includes(t)?(n*=2,this.resize({width:this.viewWidth,height:this.viewHeight+n,keepDimension:"height"})):["left","right"].includes(t)&&(e*=2,this.resize({width:this.viewWidth+e,height:this.viewHeight,keepDimension:"width"}))}},{key:"onResizeEnd",value:function(){this.isResizing=!1,this.resizeFocusPoint=void 0}},{key:"resize",value:function(i){var t=i.width,e=i.height,n=i.keepDimension;this.setViewDimensions({width:t,height:e,keepDimension:n}),this.resizeFocusPoint&&(this.resizeFocusPoint.viewX=this.viewWidth/2,this.resizeFocusPoint.viewY=this.viewHeight/2),this.zoom({width:this.preview.width,height:this.preview.height,focusPoint:this.resizeFocusPoint})}},{key:"setViewDimensions",value:function(i){var t=i.width,e=i.height,n=i.keepDimension;if(this.maxArea){var s=this.enforceMaxArea({width:t,height:e,keepDimension:n});t=s.width,e=s.height}var h=this.enforceViewDimensions({width:t,height:e,keepDimension:n});if(t=h.width,e=h.height,this.view.css({width:t,height:e}),this.viewWidth=t,this.viewHeight=e,this.viewRatio=t/e,this.minResolution){var o=Math.sqrt(this.minResolution*this.viewRatio),r=Math.sqrt(this.minResolution/this.viewRatio);this.maxImageWidth=this.viewWidth/o*this.imageWidth,this.maxImageHeight=this.viewHeight/r*this.imageHeight}this.fireChange()}},{key:"zoomAllOut",value:function(){this.isWidthRestricting()?this.zoom({width:this.viewWidth}):this.zoom({height:this.viewHeight})}},{key:"zoomIn",value:function(i){null==i&&(i={}),this.isWidthRestricting()?i.width=this.preview.width*this.zoomInStep:i.height=this.preview.height*this.zoomInStep,this.zoom(i)}},{key:"zoomOut",value:function(i){null==i&&(i={}),this.isWidthRestricting()?i.width=this.preview.width*this.zoomOutStep:i.height=this.preview.height*this.zoomOutStep,this.zoom(i)}},{key:"zoom",value:function(i){var t=i.width,e=i.height,n=i.viewX,s=i.viewY,h=i.focusPoint;null==h&&(h=this.getFocusPoint({viewX:n,viewY:s}));var o=this.enforceZoom({width:t,height:e});t=o.width,e=o.height,null!=t?(this.preview.setWidth(t),this.fireChange()):null!=e&&(this.preview.setHeight(e),this.fireChange()),this.focus(h)}},{key:"getFocusPoint",value:function(i){null==i&&(i={});var t=i,e=t.viewX,n=t.viewY;null==e&&(e=this.viewWidth/2),null==n&&(n=this.viewHeight/2);var s=this.preview.x+e,h=this.preview.y+n;return{percentX:s/this.preview.width,percentY:h/this.preview.height,viewX:e,viewY:n}}},{key:"focus",value:function(i){var t=i.percentX,e=i.percentY,n=i.viewX,s=i.viewY,h=this.preview.width*t,o=this.preview.height*e;h-=n,o-=s,this.pan({x:h,y:o})}},{key:"center",value:function(){var i=(this.preview.width-this.viewWidth)/2,t=(this.preview.height-this.viewHeight)/2;this.pan({x:i,y:t})}},{key:"pan",value:function(i){i=this.enforceXy(i),this.preview.pan(i.x,i.y),this.fireChange()}},{key:"enforceXy",value:function(i){var t=i.x,e=i.y;return t>this.preview.width-this.viewWidth&&(t=this.preview.width-this.viewWidth),t<0&&(t=0),e>this.preview.height-this.viewHeight&&(e=this.preview.height-this.viewHeight),e<0&&(e=0),{x:t,y:e}}},{key:"enforceZoom",value:function(i){var t=i.width,e=i.height;return null!=t&&this.maxImageWidth&&t>this.maxImageWidth?{width:this.maxImageWidth}:null!=t&&tthis.maxImageHeight?{height:this.maxImageHeight}:null!=e&&ethis.maxWidth||ethis.maxHeight||nthis.maxViewRatio)}},{key:"isValidRatio",value:function(i){return!(ithis.maxViewRatio)}},{key:"enforceValidRatio",value:function(i){return ithis.maxViewRatio?this.maxViewRatio:i}},{key:"enforceViewDimensions",value:function(i){var t,e,n,s=i.width,h=i.height,o=i.keepDimension;if(sthis.maxWidth&&(e=this.maxWidth),hthis.maxHeight&&(t=this.maxHeight),o){if(e&&(s=e),t&&(h=t),n=s/h,!this.isValidRatio(n)){n=this.enforceValidRatio(n);var r=this.getRatioBox({ratio:n,width:s,height:h,keepDimension:o});if(s=r.width,h=r.height,s>this.arenaWidth||h>this.arenaHeight){var a=this.centerAlign(this.maxWidth,this.maxHeight,n);s=a.width,h=a.height}}}else if(e||t){n=this.enforceValidRatio(s/h);var u=this.centerAlign(this.maxWidth,this.maxHeight,n);s=u.width,h=u.height}return{width:s,height:h}}},{key:"enforceMaxArea",value:function(i){var t=i.width,e=i.height,n=i.keepDimension,s=t/e;return"width"===n?s=t/(e=this.maxArea/t):"height"===n?s=(t=this.maxArea/e)/e:e=(t=Math.sqrt(this.maxArea*s))/s,this.isValidRatio(s)||(s=this.enforceValidRatio(s),e=(t=Math.sqrt(this.maxArea*s))/s),{width:t,height:e}}},{key:"checkRatio",value:function(i){if(this.originalSize){var t=this.originalSize.width/this.originalSize.height,e=i.width/i.height,n=(e-t)/t*100;if(Math.abs(n)>1)throw new Error("srcissors: Displayed image has a different image ratio than the "+"one configured in 'originalRatio': ".concat(t," vs ").concat(e))}}},{key:"isWidthRestricting",value:function(){return this.viewRatio>=this.imageRatio}},{key:"getRatioBox",value:function(i){var t=i.ratio,e=i.width,n=i.height,s=i.keepDimension;return"width"===s||null==n?n=e/t:"height"===s||null==e?e=n*t:n=e/t,{width:e,height:n}}},{key:"centerAlign",value:function(i,t,e){var n,s,h,o;return i/t>e?h=(i-(s=t*e))/2:o=(t-(n=i/e))/2,{x:h||0,y:o||0,width:s||i,height:n||t}}},{key:"min",value:function(i){var t,e=i[0],n=function(i,t){var e="undefined"!=typeof Symbol&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=function(i,t){if(i){if("string"==typeof i)return s(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);return"Object"===e&&i.constructor&&(e=i.constructor.name),"Map"===e||"Set"===e?Array.from(i):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(i,t):void 0}}(i))||t&&i&&"number"==typeof i.length){e&&(i=e);var n=0,h=function(){};return{s:h,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(i){throw i},f:h}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,r=!0,a=!1;return{s:function(){e=e.call(i)},n:function(){var i=e.next();return r=i.done,i},e:function(i){a=!0,o=i},f:function(){try{r||null==e.return||e.return()}finally{if(a)throw o}}}}(i);try{for(n.s();!(t=n.n()).done;){var h=t.value;h{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){for(var e=0;en-t.doubleClickThreshold&&t.parent.onDoubleClick(o(e)),i=n}))}},{key:"preventBrowserDragDrop",value:function(){this.view.on("dragstart.srcissors",(function(){return!1}))}},{key:"resizeView",value:function(i){var t=this,e=i.horizontal,n=i.vertical,s=h("
");s.addClass("resize-handler");var o=[];e&&(o=o.concat(["right","left"])),n&&(o=o.concat(["top","bottom"])),o.forEach((function(i){var e=s.clone();e.addClass("resize-handler-".concat(i)),e.on("mousedown.srcissors touchstart.srcissors",t.getResizeMouseDown(i)),t.view.append(e)}))}},{key:"getResizeMouseDown",value:function(i){var t=this,e=h(document);return function(n){var s=o(n),h=s.pageX,r=s.pageY;n.stopPropagation(),e.on("mousemove.srcissors-resize touchmove.srcissors-resize",(function(e){var n,s,a=o(e),u=a.pageX,c=a.pageY;switch(i){case"top":case"bottom":s=c-r,"top"===i&&(s=-s),r=c;break;case"left":case"right":n=u-h,"left"===i&&(n=-n),h=u}t.parent.onResize({position:i,dx:n,dy:s})})).on("mouseup.srcissors-resize touchend.srcissors-resize",(function(){e.off("mouseup.srcissors-resize touchmove.srcissors-resize"),e.off("mousemove.srcissors-resize touchend.srcissors-resize"),t.parent.onResizeEnd({position:i})}))}}},{key:"responsiveArena",value:function(){}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}()},289:(i,t,e)=>{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){for(var e=0;e0){var e=h("").css({opacity:this.opacity}).attr("src",t);this.outline.append(e)}}},{key:"reset",value:function(){this.url=void 0,this.x=this.y=0,this.width=this.height=0,this.img.attr("src",""),this.img.css({width:"",height:"",transform:""}),this.outline&&this.outline.css({transform:""}).html("")}},{key:"setWidth",value:function(i){this.img.css({width:"".concat(i,"px"),height:"auto"});var t=i/this.ratio;this.updateImageDimensions({width:i,height:t})}},{key:"setHeight",value:function(i){this.img.css({width:"auto",height:"".concat(i,"px")});var t=i*this.ratio;this.updateImageDimensions({width:t,height:i})}},{key:"updateImageDimensions",value:function(i){var t=i.width,e=i.height;this.width=t,this.height=e,this.outline&&this.outline.css({width:"".concat(this.width,"px"),height:"".concat(this.height,"px")})}},{key:"pan",value:function(i,t){this.x=i,this.y=t;var e=Math.round(this.x),n=Math.round(this.y);this.img.css({transform:"translate(-".concat(e,"px, -").concat(n,"px)")}),this.outline&&this.outline.css({transform:"translate(-".concat(e,"px, -").concat(n,"px)")})}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}()},505:(i,t,e)=>{var n=e(47),s=e(490);i.exports={new:function(i){var t=i.arena,e=i.url,h=i.fixedWidth,o=i.fixedHeight,r=i.minWidth,a=i.minHeight,u=i.minRatio,c=i.maxRatio,l=i.maxArea,g=i.originalSize,v=i.zoomStep,d=i.crop,m=i.actions,p=i.minResolution,f=i.surroundingImageOpacity,w=i.showSurroundingImage,y=(t=n(t)).find(".crop-view"),x=y.find(".crop-preview"),b=n("");x.append(b);var k=y.find(".crop-outline");k.length||(k=void 0);var R={pan:!0,zoomOnDoubleClick:!0,resize:!0,resizeHorizontal:!h,resizeVertical:!o};return n.extend(R,m),null==v&&(v=1.25),null==r&&(r=50),null==a&&(a=50),new s({url:e,crop:d,arena:t,view:y,img:b,outline:k,showSurroundingImage:w,surroundingImageOpacity:f,fixedWidth:h,fixedHeight:o,minViewWidth:r,minViewHeight:a,minViewRatio:u,maxViewRatio:c,maxArea:l,originalSize:g,zoomStep:v,actions:R,minResolution:p})}}},47:t=>{"use strict";t.exports=i}},e={},function i(n){var s=e[n];if(void 0!==s)return s.exports;var h=e[n]={exports:{}};return t[n](h,h.exports,i),h.exports}(505);var t,e})); +!function(i,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?exports.srcissors=t(require("jquery")):i.srcissors=t(i.jQuery)}(self,(i=>(()=>{"use strict";var t={490:(i,t,e)=>{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){(null==t||t>i.length)&&(t=i.length);for(var e=0,n=new Array(t);eh&&delete this.minResolution,this.minResolution){var o=this.minResolution/(this.imageHeight*this.imageHeight);(!this.minViewRatio||this.minViewRatior)&&(this.maxViewRatio=r)}this.calcMaxMinDimensions(),this.fixedWidth&&(t="width"),this.fixedHeight&&(t="height"),this.setViewDimensions({width:this.imageWidth,height:this.imageHeight,keepDimension:t}),this.isReady=!0,this.view.removeClass(this.loadingCssClass),this.isInitialized||null==this.initialCrop?(this.zoomAllOut(),this.center()):this.setCrop(this.initialCrop),this.isInitialized=!0,this.readyEvent.fire(),this.loadEvent.fire()}},{key:"setCrop",value:function(i){var t=this,e=i.x,n=i.y,s=i.width,h=i.height;if(this.isReady){this.resize({width:s,height:h});var o=this.viewWidth/s,r=this.imageWidth*o;this.zoom({width:r}),this.pan({x:e*o,y:n*o})}else this.on("ready",(function(){return t.setCrop({x:e,y:n,width:s,height:h})}))}},{key:"getCrop",value:function(){var i=this.preview.width/this.imageWidth,t={x:this.preview.x/i,y:this.preview.y/i,width:this.viewWidth/i,height:this.viewHeight/i};return this.roundCrop(t),this.validateCrop(t),t}},{key:"roundCrop",value:function(i){for(var t in i){var e=i[t];i[t]=Math.round(e)}}},{key:"validateCrop",value:function(i){var t=i.x,e=i.y,n=i.width,s=i.height;return t<0&&(i.x=0),e<0&&(i.y=0),t+n>this.imageWidth&&(i.width=this.imageWidth-t),e+s>this.imageHeight&&(i.height=this.imageHeight-e),i}},{key:"setRatio",value:function(i,t){var e,n,s=this;if(this.isReady)return i=this.enforceValidRatio(i),"height"===t?n=(e=this.viewHeight)*i:e=(n=this.viewWidth)/i,this.resizeFocusPoint=this.getFocusPoint(),this.resize({width:n,height:e});this.on("ready",(function(){return s.setRatio(i,t)}))}},{key:"onPan",value:function(i){this.isPanning||(this.isPanning=!0,this.arena.addClass(this.panningCssClass),this.outline.addClass(this.outlineCssClass));var t=i.startX-i.dx,e=i.startY-i.dy;this.pan({x:t,y:e})}},{key:"onPanEnd",value:function(){return this.isPanning=!1,this.arena.removeClass(this.panningCssClass),this.outline.removeClass(this.outlineCssClass)}},{key:"onDoubleClick",value:function(i){var t=i.pageX,e=i.pageY,n=this.view[0].getBoundingClientRect(),s=t-n.left,h=e-n.top;this.zoomIn({viewX:s,viewY:h})}},{key:"onResize",value:function(i){var t=i.position,e=i.dx,n=i.dy;this.isResizing||(this.isResizing=!0,this.resizeFocusPoint=this.getFocusPoint()),["top","bottom"].includes(t)?(n*=2,this.resize({width:this.viewWidth,height:this.viewHeight+n,keepDimension:"height"})):["left","right"].includes(t)&&(e*=2,this.resize({width:this.viewWidth+e,height:this.viewHeight,keepDimension:"width"}))}},{key:"onResizeEnd",value:function(){this.isResizing=!1,this.resizeFocusPoint=void 0}},{key:"resize",value:function(i){var t=i.width,e=i.height,n=i.keepDimension;this.setViewDimensions({width:t,height:e,keepDimension:n}),this.resizeFocusPoint&&(this.resizeFocusPoint.viewX=this.viewWidth/2,this.resizeFocusPoint.viewY=this.viewHeight/2),this.zoom({width:this.preview.width,height:this.preview.height,focusPoint:this.resizeFocusPoint})}},{key:"setViewDimensions",value:function(i){var t=i.width,e=i.height,n=i.keepDimension;if(this.maxArea){var s=this.enforceMaxArea({width:t,height:e,keepDimension:n});t=s.width,e=s.height}var h=this.enforceViewDimensions({width:t,height:e,keepDimension:n});if(t=h.width,e=h.height,this.view.css({width:t,height:e}),this.viewWidth=t,this.viewHeight=e,this.viewRatio=t/e,this.minResolution){var o=Math.sqrt(this.minResolution*this.viewRatio),r=Math.sqrt(this.minResolution/this.viewRatio);this.maxImageWidth=this.viewWidth/o*this.imageWidth,this.maxImageHeight=this.viewHeight/r*this.imageHeight}this.fireChange()}},{key:"zoomAllOut",value:function(){this.isWidthRestricting()?this.zoom({width:this.viewWidth}):this.zoom({height:this.viewHeight})}},{key:"zoomIn",value:function(i){null==i&&(i={}),this.isWidthRestricting()?i.width=this.preview.width*this.zoomInStep:i.height=this.preview.height*this.zoomInStep,this.zoom(i)}},{key:"zoomOut",value:function(i){null==i&&(i={}),this.isWidthRestricting()?i.width=this.preview.width*this.zoomOutStep:i.height=this.preview.height*this.zoomOutStep,this.zoom(i)}},{key:"zoom",value:function(i){var t=i.width,e=i.height,n=i.viewX,s=i.viewY,h=i.focusPoint;null==h&&(h=this.getFocusPoint({viewX:n,viewY:s}));var o=this.enforceZoom({width:t,height:e});t=o.width,e=o.height,null!=t?(this.preview.setWidth(t),this.fireChange()):null!=e&&(this.preview.setHeight(e),this.fireChange()),this.focus(h)}},{key:"getFocusPoint",value:function(i){null==i&&(i={});var t=i,e=t.viewX,n=t.viewY;null==e&&(e=this.viewWidth/2),null==n&&(n=this.viewHeight/2);var s=this.preview.x+e,h=this.preview.y+n;return{percentX:s/this.preview.width,percentY:h/this.preview.height,viewX:e,viewY:n}}},{key:"focus",value:function(i){var t=i.percentX,e=i.percentY,n=i.viewX,s=i.viewY,h=this.preview.width*t,o=this.preview.height*e;h-=n,o-=s,this.pan({x:h,y:o})}},{key:"center",value:function(){var i=(this.preview.width-this.viewWidth)/2,t=(this.preview.height-this.viewHeight)/2;this.pan({x:i,y:t})}},{key:"pan",value:function(i){i=this.enforceXy(i),this.preview.pan(i.x,i.y),this.fireChange()}},{key:"enforceXy",value:function(i){var t=i.x,e=i.y;return t>this.preview.width-this.viewWidth&&(t=this.preview.width-this.viewWidth),t<0&&(t=0),e>this.preview.height-this.viewHeight&&(e=this.preview.height-this.viewHeight),e<0&&(e=0),{x:t,y:e}}},{key:"enforceZoom",value:function(i){var t=i.width,e=i.height;return null!=t&&this.maxImageWidth&&t>this.maxImageWidth?{width:this.maxImageWidth}:null!=t&&tthis.maxImageHeight?{height:this.maxImageHeight}:null!=e&&ethis.maxWidth||ethis.maxHeight||nthis.maxViewRatio)}},{key:"isValidRatio",value:function(i){return!(ithis.maxViewRatio)}},{key:"enforceValidRatio",value:function(i){return ithis.maxViewRatio?this.maxViewRatio:i}},{key:"enforceViewDimensions",value:function(i){var t,e,n,s=i.width,h=i.height,o=i.keepDimension;if(sthis.maxWidth&&(e=this.maxWidth),hthis.maxHeight&&(t=this.maxHeight),o){if(e&&(s=e),t&&(h=t),n=s/h,!this.isValidRatio(n)){n=this.enforceValidRatio(n);var r=this.getRatioBox({ratio:n,width:s,height:h,keepDimension:o});if(s=r.width,h=r.height,s>this.arenaWidth||h>this.arenaHeight){var a=this.centerAlign(this.maxWidth,this.maxHeight,n);s=a.width,h=a.height}}}else if(e||t){n=this.enforceValidRatio(s/h);var u=this.centerAlign(this.maxWidth,this.maxHeight,n);s=u.width,h=u.height}return{width:s,height:h}}},{key:"enforceMaxArea",value:function(i){var t=i.width,e=i.height,n=i.keepDimension,s=t/e;return"width"===n?s=t/(e=this.maxArea/t):"height"===n?s=(t=this.maxArea/e)/e:e=(t=Math.sqrt(this.maxArea*s))/s,this.isValidRatio(s)||(s=this.enforceValidRatio(s),e=(t=Math.sqrt(this.maxArea*s))/s),{width:t,height:e}}},{key:"checkRatio",value:function(i){if(this.originalSize){var t=this.originalSize.width/this.originalSize.height,e=i.width/i.height,n=(e-t)/t*100;if(Math.abs(n)>1)throw new Error("srcissors: Displayed image has a different image ratio than the "+"one configured in 'originalRatio': ".concat(t," vs ").concat(e))}}},{key:"isWidthRestricting",value:function(){return this.viewRatio>=this.imageRatio}},{key:"getRatioBox",value:function(i){var t=i.ratio,e=i.width,n=i.height,s=i.keepDimension;return"width"===s||null==n?n=e/t:"height"===s||null==e?e=n*t:n=e/t,{width:e,height:n}}},{key:"centerAlign",value:function(i,t,e){var n,s,h,o;return i/t>e?h=(i-(s=t*e))/2:o=(t-(n=i/e))/2,{x:h||0,y:o||0,width:s||i,height:n||t}}},{key:"min",value:function(i){var t,e=i[0],n=function(i,t){var e="undefined"!=typeof Symbol&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=function(i,t){if(i){if("string"==typeof i)return s(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);return"Object"===e&&i.constructor&&(e=i.constructor.name),"Map"===e||"Set"===e?Array.from(i):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(i,t):void 0}}(i))||t&&i&&"number"==typeof i.length){e&&(i=e);var n=0,h=function(){};return{s:h,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(i){throw i},f:h}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,r=!0,a=!1;return{s:function(){e=e.call(i)},n:function(){var i=e.next();return r=i.done,i},e:function(i){a=!0,o=i},f:function(){try{r||null==e.return||e.return()}finally{if(a)throw o}}}}(i);try{for(n.s();!(t=n.n()).done;){var h=t.value;h{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){for(var e=0;en-t.doubleClickThreshold&&t.parent.onDoubleClick(o(e)),i=n}))}},{key:"preventBrowserDragDrop",value:function(){this.view.on("dragstart.srcissors",(function(){return!1}))}},{key:"resizeView",value:function(i){var t=this,e=i.horizontal,n=i.vertical,s=h("
");s.addClass("resize-handler");var o=[];e&&(o=o.concat(["right","left"])),n&&(o=o.concat(["top","bottom"])),o.forEach((function(i){var e=s.clone();e.addClass("resize-handler-".concat(i)),e.on("mousedown.srcissors touchstart.srcissors",t.getResizeMouseDown(i)),t.view.append(e)}))}},{key:"getResizeMouseDown",value:function(i){var t=this,e=h(document);return function(n){var s=o(n),h=s.pageX,r=s.pageY;n.stopPropagation(),e.on("mousemove.srcissors-resize touchmove.srcissors-resize",(function(e){var n,s,a=o(e),u=a.pageX,c=a.pageY;switch(i){case"top":case"bottom":s=c-r,"top"===i&&(s=-s),r=c;break;case"left":case"right":n=u-h,"left"===i&&(n=-n),h=u}t.parent.onResize({position:i,dx:n,dy:s})})).on("mouseup.srcissors-resize touchend.srcissors-resize",(function(){e.off("mouseup.srcissors-resize touchmove.srcissors-resize"),e.off("mousemove.srcissors-resize touchend.srcissors-resize"),t.parent.onResizeEnd({position:i})}))}}},{key:"responsiveArena",value:function(){}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}()},289:(i,t,e)=>{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){for(var e=0;e0){var e=h("").css({opacity:this.opacity}).attr("src",t);this.outline.append(e)}}},{key:"reset",value:function(){this.url=void 0,this.x=this.y=0,this.width=this.height=0,this.img.attr("src",""),this.img.css({width:"",height:"",transform:""}),this.outline&&this.outline.css({transform:""}).html("")}},{key:"setWidth",value:function(i){this.img.css({width:"".concat(i,"px"),height:"auto"});var t=i/this.ratio;this.updateImageDimensions({width:i,height:t})}},{key:"setHeight",value:function(i){this.img.css({width:"auto",height:"".concat(i,"px")});var t=i*this.ratio;this.updateImageDimensions({width:t,height:i})}},{key:"updateImageDimensions",value:function(i){var t=i.width,e=i.height;this.width=t,this.height=e,this.outline&&this.outline.css({width:"".concat(this.width,"px"),height:"".concat(this.height,"px")})}},{key:"pan",value:function(i,t){this.x=i,this.y=t;var e=Math.round(this.x),n=Math.round(this.y);this.img.css({transform:"translate(-".concat(e,"px, -").concat(n,"px)")}),this.outline&&this.outline.css({transform:"translate(-".concat(e,"px, -").concat(n,"px)")})}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}()},505:(i,t,e)=>{var n=e(47),s=e(490);i.exports={new:function(i){var t=i.arena,e=i.url,h=i.fixedWidth,o=i.fixedHeight,r=i.minWidth,a=i.minHeight,u=i.minRatio,c=i.maxRatio,l=i.maxArea,g=i.originalSize,v=i.zoomStep,d=i.crop,m=i.actions,p=i.minResolution,f=i.surroundingImageOpacity,w=i.showSurroundingImage,y=(t=n(t)).find(".crop-view"),x=y.find(".crop-preview"),b=n("");x.append(b);var k=y.find(".crop-outline");k.length||(k=void 0);var R={pan:!0,zoomOnDoubleClick:!0,resize:!0,resizeHorizontal:!h,resizeVertical:!o};return n.extend(R,m),null==v&&(v=1.25),null==r&&(r=50),null==a&&(a=50),new s({url:e,crop:d,arena:t,view:y,img:b,outline:k,showSurroundingImage:w,surroundingImageOpacity:f,fixedWidth:h,fixedHeight:o,minViewWidth:r,minViewHeight:a,minViewRatio:u,maxViewRatio:c,maxArea:l,originalSize:g,zoomStep:v,actions:R,minResolution:p})}}},47:t=>{t.exports=i}},e={};return function i(n){var s=e[n];if(void 0!==s)return s.exports;var h=e[n]={exports:{}};return t[n](h,h.exports,i),h.exports}(505)})())); //# sourceMappingURL=srcissors.js.map \ No newline at end of file diff --git a/examples/srcissors.js.map b/examples/srcissors.js.map index cb7b8cb..dec0bda 100644 --- a/examples/srcissors.js.map +++ b/examples/srcissors.js.map @@ -1 +1 @@ -{"version":3,"file":"./srcissors.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,WACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,UAAWJ,GACO,iBAAZC,QACdA,QAAmB,UAAID,EAAQG,QAAQ,WAEvCJ,EAAgB,UAAIC,EAAQD,EAAa,OAC1C,CATD,CASGO,MAAOC,IACV,O,8xBCVA,IAAMC,EAAIL,EAAQ,IACZM,EAAUN,EAAQ,KAClBO,EAASP,EAAQ,IAEvBD,EAAOD,QAAO,wBACZ,SAAAU,EAAAC,GAKG,IAJDC,EAAKD,EAALC,MAAOC,EAAIF,EAAJE,KAAMC,EAAGH,EAAHG,IAAKC,EAAOJ,EAAPI,QAASC,EAAGL,EAAHK,IAAKC,EAAUN,EAAVM,WAAYC,EAAWP,EAAXO,YAC5CC,EAAYR,EAAZQ,aAAcC,EAAaT,EAAbS,cAAeC,EAAYV,EAAZU,aAAcC,EAAYX,EAAZW,aAAcC,EAAYZ,EAAZY,aAAcC,EAAIb,EAAJa,KACvEC,EAAQd,EAARc,SAAUC,EAAOf,E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EACfhJ,aAAcuP,EACdtP,aAAcuP,EACdnP,QAAAA,EACAH,aAAAA,EAGAE,SAAAA,EACAE,QAASqP,EACTpP,cAAAA,GAEJ,E,sBCvDF3B,EAAOD,QAAUM,C,GCCb4Q,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBlJ,IAAjBmJ,EACH,OAAOA,EAAarR,QAGrB,IAAIC,EAASiR,EAAyBE,GAAY,CAGjDpR,QAAS,CAAC,GAOX,OAHAsR,EAAoBF,GAAUnR,EAAQA,EAAOD,QAASmR,GAG/ClR,EAAOD,OACf,CCnB0BmR,CAAoB,K,MDF1CD,C","sources":["webpack://srcissors/webpack/universalModuleDefinition","webpack://srcissors/./src/crop.js","webpack://srcissors/./src/events.js","webpack://srcissors/./src/preview.js","webpack://srcissors/./src/srcissors.js","webpack://srcissors/external umd {\"commonjs\":\"jquery\",\"commonjs2\":\"jquery\",\"amd\":\"jquery\",\"root\":\"jQuery\"}","webpack://srcissors/webpack/bootstrap","webpack://srcissors/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"jquery\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"jquery\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"srcissors\"] = factory(require(\"jquery\"));\n\telse\n\t\troot[\"srcissors\"] = factory(root[\"jQuery\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__47__) => {\nreturn ","const $ = require('jquery')\nconst Preview = require('./preview')\nconst Events = require('./events')\n\nmodule.exports = class Crop {\n constructor ({\n arena, view, img, outline, url, fixedWidth, fixedHeight,\n minViewWidth, minViewHeight, minViewRatio, maxViewRatio, originalSize, crop,\n zoomStep, maxArea, actions, minResolution, surroundingImageOpacity,\n showSurroundingImage\n }) {\n // CSS classes\n this.onPreviewReady = this.onPreviewReady.bind(this)\n this.arena = arena\n this.view = view\n this.img = img\n this.outline = outline\n this.fixedWidth = fixedWidth\n this.fixedHeight = fixedHeight\n this.minViewWidth = minViewWidth\n this.minViewHeight = minViewHeight\n this.minViewRatio = minViewRatio\n this.maxViewRatio = maxViewRatio\n this.originalSize = originalSize\n this.actions = actions\n this.minResolution = minResolution\n this.surroundingImageOpacity = surroundingImageOpacity\n this.loadingCssClass = 'crop-view--is-loading'\n this.panningCssClass = 'crop-view--is-panning'\n this.outlineCssClass = 'crop-outline--active'\n\n // State\n this.isPanning = false\n this.initialCrop = crop\n\n // Events\n this.loadEvent = $.Callbacks()\n this.changeEvent = $.Callbacks()\n\n // Sets up the ready event and state\n this.initializeReadyState()\n\n // Confguration\n this.zoomInStep = zoomStep\n this.zoomOutStep = 1 / this.zoomInStep\n\n this.arenaWidth = this.arena.width()\n this.arenaHeight = this.arena.height()\n\n // todo: consider to calculate maxArea with regards to the\n // maximum space an image can within the area. That should\n // be more reliable.\n if (maxArea) this.maxArea = (this.arenaWidth * this.arenaHeight) * maxArea\n\n if (this.outline) this.setSurroundingImageVisibility(showSurroundingImage)\n\n this.preview = new Preview({\n onReady: this.onPreviewReady,\n img: this.img,\n outline: this.outline,\n opacity: this.surroundingImageOpacity\n })\n\n this.setImage(url)\n }\n\n initializeReadyState () {\n this.isReady = false\n if (this.readyEvent != null) {\n this.readyEvent.empty()\n }\n this.readyEvent = $.Callbacks('memory once')\n }\n\n setImage (url) {\n if (url === this.preview.url) return\n\n if (this.isInitialized) this.preview.reset()\n this.initializeReadyState()\n this.view.addClass(this.loadingCssClass)\n this.preview.setImage({url})\n }\n\n setSurroundingImageVisibility (visibility) {\n // visibility: always|panning|never\n // override opacity in crop-outline--active css class\n this.surroundingImageOpacity = parseFloat(this.surroundingImageOpacity || 0.2)\n\n if (visibility === 'always') {\n this.outline.css('opacity', 1.0)\n } else if (visibility === 'panning') {\n this.outline.css('opacity', null)\n } else { // 'never' default\n this.outline.css('opacity', 0)\n this.surroundingImageOpacity = 0\n }\n }\n\n reset () {\n if (!this.isReady) return\n\n this.resize({width: this.imageWidth, height: this.imageHeight})\n this.zoomAllOut()\n }\n\n onPreviewReady (previewImageSize) {\n this.checkRatio(previewImageSize)\n const {width, height} = this.originalSize || previewImageSize\n\n // console.log(this.originalSize, previewImageSize, {width, height})\n this.preview.updateImageDimensions({width, height})\n\n let keepDimension\n if (!this.isInitialized) {\n this.events = new Events({\n parent: this,\n view: this.view,\n actions: this.actions\n })\n }\n\n this.imageWidth = width\n this.imageHeight = height\n this.imageRatio = this.imageWidth / this.imageHeight\n const imageResolution = this.imageWidth * this.imageHeight\n\n if (this.minResolution && (this.minResolution > imageResolution)) {\n // If the minimal required resolution is bigger than the actual image\n // resolution, we ignore the configuration\n delete this.minResolution\n }\n\n if (this.minResolution) {\n // For any given image resolution with a minimal required resolution\n // we can calculate both, a minimal resolution and a maximal resolution\n const minRatioForResolution = this.minResolution / (this.imageHeight * this.imageHeight)\n if (!this.minViewRatio || (this.minViewRatio < minRatioForResolution)) {\n this.minViewRatio = minRatioForResolution\n }\n const maxRatioForResolution = (this.imageWidth * this.imageWidth) / this.minResolution\n if (!this.maxViewRatio || (this.maxViewRatio > maxRatioForResolution)) {\n this.maxViewRatio = maxRatioForResolution\n }\n }\n\n this.calcMaxMinDimensions()\n\n if (this.fixedWidth) { keepDimension = 'width' }\n if (this.fixedHeight) { keepDimension = 'height' }\n this.setViewDimensions({\n width: this.imageWidth,\n height: this.imageHeight,\n keepDimension\n })\n\n // ready state\n this.isReady = true\n this.view.removeClass(this.loadingCssClass)\n\n if (!this.isInitialized && (this.initialCrop != null)) {\n this.setCrop(this.initialCrop)\n } else {\n this.zoomAllOut()\n this.center()\n }\n\n this.isInitialized = true\n this.readyEvent.fire()\n this.loadEvent.fire()\n }\n\n setCrop ({x, y, width, height}) {\n if (!this.isReady) {\n this.on('ready', () => this.setCrop({x, y, width, height}))\n return\n }\n\n this.resize({width, height})\n\n const factor = this.viewWidth / width\n const previewWidth = this.imageWidth * factor\n\n this.zoom({width: previewWidth})\n this.pan({x: x * factor, y: y * factor})\n }\n\n getCrop () {\n const factor = this.preview.width / this.imageWidth\n const crop = {\n x: this.preview.x / factor,\n y: this.preview.y / factor,\n width: this.viewWidth / factor,\n height: this.viewHeight / factor\n }\n\n this.roundCrop(crop)\n this.validateCrop(crop)\n return crop\n }\n\n roundCrop (crop) {\n for (const name in crop) {\n const value = crop[name]\n crop[name] = Math.round(value)\n }\n }\n\n validateCrop (crop) {\n const {x, y, width, height} = crop\n if (x < 0) crop.x = 0\n if (y < 0) crop.y = 0\n\n if ((x + width) > this.imageWidth) {\n crop.width = this.imageWidth - x\n }\n\n if ((y + height) > this.imageHeight) {\n crop.height = this.imageHeight - y\n }\n\n return crop\n }\n\n setRatio (ratio, keepDimension) {\n let height, width\n if (!this.isReady) {\n this.on('ready', () => this.setRatio(ratio, keepDimension))\n return\n }\n\n ratio = this.enforceValidRatio(ratio)\n\n if (keepDimension === 'height') {\n height = this.viewHeight\n width = height * ratio\n } else {\n width = this.viewWidth\n height = width / ratio\n }\n\n this.resizeFocusPoint = this.getFocusPoint()\n return this.resize({width, height})\n }\n\n // Event handling\n // --------------\n\n onPan (data) {\n if (!this.isPanning) {\n this.isPanning = true\n this.arena.addClass(this.panningCssClass)\n this.outline.addClass(this.outlineCssClass)\n }\n\n const newX = data.startX - data.dx\n const newY = data.startY - data.dy\n this.pan({x: newX, y: newY})\n }\n\n onPanEnd () {\n this.isPanning = false\n this.arena.removeClass(this.panningCssClass)\n return this.outline.removeClass(this.outlineCssClass)\n }\n\n onDoubleClick ({pageX, pageY}) {\n const {left, top} = this.view[0].getBoundingClientRect()\n const viewX = pageX - left\n const viewY = pageY - top\n this.zoomIn({viewX, viewY})\n }\n\n onResize ({position, dx, dy}) {\n if (!this.isResizing) {\n this.isResizing = true\n this.resizeFocusPoint = this.getFocusPoint()\n }\n\n if (['top', 'bottom'].includes(position)) {\n dy = 2 * dy // Because it's centered we need to change width by factor two\n this.resize({width: this.viewWidth, height: this.viewHeight + dy, keepDimension: 'height'})\n } else if (['left', 'right'].includes(position)) {\n dx = 2 * dx\n this.resize({width: this.viewWidth + dx, height: this.viewHeight, keepDimension: 'width'})\n }\n }\n\n onResizeEnd () {\n this.isResizing = false\n this.resizeFocusPoint = undefined\n }\n\n resize ({width, height, keepDimension}) {\n this.setViewDimensions({width, height, keepDimension})\n\n // Update view center of focus point\n if (this.resizeFocusPoint) {\n this.resizeFocusPoint.viewX = this.viewWidth / 2\n this.resizeFocusPoint.viewY = this.viewHeight / 2\n }\n\n // Ensure dimensions and focus\n this.zoom({\n width: this.preview.width,\n height: this.preview.height,\n focusPoint: this.resizeFocusPoint\n })\n }\n\n setViewDimensions ({width, height, keepDimension}) {\n if (this.maxArea) {\n ({width, height} = this.enforceMaxArea({width, height, keepDimension}))\n }\n\n ({width, height} = this.enforceViewDimensions({width, height, keepDimension}))\n\n this.view.css({width, height})\n this.viewWidth = width\n this.viewHeight = height\n this.viewRatio = width / height\n\n if (this.minResolution) {\n const minZoomPixelWidth = Math.sqrt(this.minResolution * this.viewRatio)\n const minZoomPixelHeight = Math.sqrt(this.minResolution / this.viewRatio)\n this.maxImageWidth = (this.viewWidth / minZoomPixelWidth) * this.imageWidth\n this.maxImageHeight = (this.viewHeight / minZoomPixelHeight) * this.imageHeight\n }\n\n this.fireChange()\n }\n\n // Update view\n // -----------\n\n zoomAllOut () {\n if (this.isWidthRestricting()) {\n this.zoom({width: this.viewWidth})\n } else {\n this.zoom({height: this.viewHeight})\n }\n }\n\n zoomIn (params) {\n if (params == null) { params = {} }\n if (this.isWidthRestricting()) {\n params.width = this.preview.width * this.zoomInStep\n } else {\n params.height = this.preview.height * this.zoomInStep\n }\n\n this.zoom(params)\n }\n\n zoomOut (params) {\n if (params == null) { params = {} }\n if (this.isWidthRestricting()) {\n params.width = this.preview.width * this.zoomOutStep\n } else {\n params.height = this.preview.height * this.zoomOutStep\n }\n\n this.zoom(params)\n }\n\n zoom ({width, height, viewX, viewY, focusPoint}) {\n if (focusPoint == null) { focusPoint = this.getFocusPoint({viewX, viewY}) }\n\n ({width, height} = this.enforceZoom({width, height}))\n if (width != null) {\n this.preview.setWidth(width)\n this.fireChange()\n } else if (height != null) {\n this.preview.setHeight(height)\n this.fireChange()\n }\n\n this.focus(focusPoint)\n }\n\n // returns {Object} e.g. percentX: 0.2, percentY: 0.5\n getFocusPoint (param) {\n if (param == null) { param = {} }\n let {viewX, viewY} = param\n if (viewX == null) { viewX = this.viewWidth / 2 }\n if (viewY == null) { viewY = this.viewHeight / 2 }\n const x = this.preview.x + viewX\n const y = this.preview.y + viewY\n const percentX = x / this.preview.width\n const percentY = y / this.preview.height\n return {percentX, percentY, viewX, viewY}\n }\n\n focus ({percentX, percentY, viewX, viewY}) {\n let x = this.preview.width * percentX\n let y = this.preview.height * percentY\n x = x - viewX\n y = y - viewY\n\n this.pan({x, y})\n }\n\n center () {\n const newX = (this.preview.width - this.viewWidth) / 2\n const newY = (this.preview.height - this.viewHeight) / 2\n this.pan({x: newX, y: newY})\n }\n\n // @param { Object }\n // - x {Number} pixel to pan to the left\n // - y {Number} pixels to pan to the top\n pan (data) {\n data = this.enforceXy(data)\n this.preview.pan(data.x, data.y)\n this.fireChange()\n }\n\n // Validations\n // -----------\n\n enforceXy ({x, y}) {\n if (x > (this.preview.width - this.viewWidth)) {\n x = this.preview.width - this.viewWidth\n }\n\n if (x < 0) x = 0\n\n\n if (y > (this.preview.height - this.viewHeight)) {\n y = this.preview.height - this.viewHeight\n }\n\n if (y < 0) y = 0\n\n return {x, y}\n }\n\n enforceZoom ({width, height}) {\n\n if ((width != null) && this.maxImageWidth && (width > this.maxImageWidth)) {\n // prevent zooming in past the required resolution defined by minResolution\n return {width: this.maxImageWidth}\n }\n\n if ((width != null) && (width < this.viewWidth)) {\n // prevent zooming out past covering the view completely\n return {width: this.viewWidth}\n }\n\n if ((height != null) && this.maxImageHeight && (height > this.maxImageHeight)) {\n // prevent zooming in past the required resolution defined by minResolution\n return {height: this.maxImageHeight}\n }\n\n if ((height != null) && (height < this.viewHeight)) {\n // prevent zooming out past covering the view completely\n return {height: this.viewHeight}\n }\n\n return {width, height}\n }\n\n calcMaxMinDimensions () {\n this.maxWidth = this.min([this.arenaWidth, this.imageWidth])\n this.maxHeight = this.min([this.arenaHeight, this.imageHeight])\n this.minWidth = this.minViewWidth || 0\n this.minHeight = this.minViewHeight || 0\n\n if (this.fixedWidth) this.maxWidth = (this.minWidth = this.fixedWidth)\n if (this.fixedHeight) this.maxHeight = (this.minHeight = this.fixedHeight)\n }\n\n areDimensionsValid ({width, height, keepDimension}) {\n const ratio = width / height\n\n const invalid =\n (width < this.minWidth) ||\n (width > this.maxWidth) ||\n (height < this.minHeight) ||\n (height > this.maxHeight) ||\n (ratio < this.minViewRatio) ||\n (ratio > this.maxViewRatio)\n\n return !invalid\n }\n\n isValidRatio (ratio) {\n return !((ratio < this.minViewRatio) || (ratio > this.maxViewRatio))\n }\n\n enforceValidRatio (ratio) {\n if (ratio < this.minViewRatio) return this.minViewRatio\n if (ratio > this.maxViewRatio) return this.maxViewRatio\n return ratio\n }\n\n enforceViewDimensions ({width, height, keepDimension}) {\n let newHeight, newWidth, ratio\n if (width < this.minWidth) newWidth = this.minWidth\n if (width > this.maxWidth) newWidth = this.maxWidth\n if (height < this.minHeight) newHeight = this.minHeight\n if (height > this.maxHeight) newHeight = this.maxHeight\n\n if (keepDimension) {\n if (newWidth) width = newWidth\n if (newHeight) height = newHeight\n\n // check max/min ratios\n ratio = width / height\n if (!this.isValidRatio(ratio)) {\n ratio = this.enforceValidRatio(ratio);\n ({width, height} = this.getRatioBox({ratio, width, height, keepDimension}))\n if ((width > this.arenaWidth) || (height > this.arenaHeight)) {\n ({width, height} = this.centerAlign(this.maxWidth, this.maxHeight, ratio))\n }\n }\n\n } else if (newWidth || newHeight) {\n ratio = this.enforceValidRatio(width / height);\n ({width, height} = this.centerAlign(this.maxWidth, this.maxHeight, ratio))\n }\n\n return {width, height}\n }\n\n enforceMaxArea ({width, height, keepDimension}) {\n let ratio = width / height\n\n if (keepDimension === 'width') {\n height = this.maxArea / width\n ratio = width / height\n } else if (keepDimension === 'height') {\n width = this.maxArea / height\n ratio = width / height\n } else { // keep ratio\n width = Math.sqrt(this.maxArea * ratio)\n height = width / ratio\n }\n\n if (!this.isValidRatio(ratio)) {\n ratio = this.enforceValidRatio(ratio)\n width = Math.sqrt(this.maxArea * ratio)\n height = width / ratio\n }\n\n return {width, height}\n }\n\n checkRatio (previewImageSize) {\n if (this.originalSize) {\n const expectedRatio = this.originalSize.width / this.originalSize.height\n const actualRatio = previewImageSize.width / previewImageSize.height\n const percentageChange = ((actualRatio - expectedRatio) / expectedRatio) * 100\n if (Math.abs(percentageChange) > 1) {\n throw new Error(`srcissors: Displayed image has a different image ratio than the ` +\n `one configured in 'originalRatio': ${expectedRatio} vs ${actualRatio}`)\n }\n }\n }\n\n // Calculations\n // ------------\n //\n // Ratio: width / height\n // Tall < 1 (Square) < Wide\n // (A ratio less than one is a tall image format and\n // a ratio greater than one is a wide image format)\n\n // Check if the width or height is restricting\n isWidthRestricting () {\n return this.viewRatio >= this.imageRatio\n }\n\n getRatioBox ({ratio, width, height, keepDimension}) {\n if ((keepDimension === 'width') || (height == null)) {\n height = width / ratio\n } else if ((keepDimension === 'height') || (width == null)) {\n width = height * ratio\n } else {\n height = width / ratio\n }\n\n return {width, height}\n }\n\n centerAlign (areaWidth, areaHeight, ratio) {\n let height, width, x, y\n if ((areaWidth / areaHeight) > ratio) {\n width = areaHeight * ratio\n x = (areaWidth - width) / 2\n } else {\n height = areaWidth / ratio\n y = (areaHeight - height) / 2\n }\n\n // return\n return {\n x: x || 0,\n y: y || 0,\n width: width || areaWidth,\n height: height || areaHeight\n }\n }\n\n min (array) {\n let min = array[0]\n for (const number of array) {\n if (number < min) min = number\n }\n\n return min\n }\n\n // Events\n // ------\n\n on (name, callback) {\n return this[`${name}Event`].add(callback)\n }\n\n off (name, callback) {\n return this[`${name}Event`].remove(callback)\n }\n\n // Debounce change events so they are not fired more\n // than once per tick.\n fireChange () {\n if (this.changeDispatch != null) return\n\n this.changeDispatch = setTimeout(() => {\n this.changeDispatch = undefined\n this.changeEvent.fire(this.getCrop())\n }, 0)\n }\n\n // Development helpers\n // -------------------\n\n debug () {\n const r = num => Math.round(num * 10) / 10\n\n const obj = {\n arena: `${r(this.arenaWidth)}x${r(this.arenaHeight)}`,\n view: `${r(this.viewWidth)}x${r(this.viewHeight)}`,\n image: `${r(this.imageWidth)}x${r(this.imageHeight)}`,\n preview: `${r(this.preview.width)}x${r(this.preview.height)}`,\n previewXy: `${r(this.preview.x)}x${r(this.preview.y)}`\n }\n\n console.log(obj) // eslint-disable-line no-console\n return obj\n }\n}\n","const $ = require('jquery')\n\nconst getPageCoordinates = function (event) {\n if (event.type.includes('touch')) {\n return {\n pageX: event.originalEvent.changedTouches[0].pageX,\n pageY: event.originalEvent.changedTouches[0].pageY\n }\n }\n return {pageX: event.pageX, pageY: event.pageY}\n}\n\nmodule.exports = class Events {\n constructor ({parent, view, horizontal, vertical, actions}) {\n this.parent = parent\n this.view = view\n this.doubleClickThreshold = 300\n\n // setup events\n if (actions.pan) { this.pan() }\n if (actions.zoomOnDoubleClick) { this.doubleClick() }\n if (actions.resize) {\n this.resizeView({\n horizontal: actions.resizeHorizontal,\n vertical: actions.resizeVertical\n })\n }\n\n this.preventBrowserDragDrop()\n this.responsiveArena()\n }\n\n pan () {\n const $doc = $(document)\n this.view.on('mousedown.srcissors touchstart.srcissors', (e1) => {\n const panData = {\n startX: this.parent.preview.x,\n startY: this.parent.preview.y\n }\n\n e1.preventDefault()\n $doc.on('mousemove.srcissors-pan touchmove.srcissors-pan', (e2) => {\n const {pageX, pageY} = getPageCoordinates(e2)\n const {pageX: prevPageX, pageY: prevPageY} = getPageCoordinates(e1)\n panData.dx = pageX - prevPageX\n panData.dy = pageY - prevPageY\n this.parent.onPan(panData)\n }).on('mouseup.srcissors-pan touchend.srcissors-pan', () => {\n $doc.off('mouseup.srcissors-pan touchend.srcissors-pan')\n $doc.off('mousemove.srcissors-pan touchmove.srcissors-pan')\n\n // only trigger panEnd if pan has been called\n if (panData.dx != null) this.parent.onPanEnd()\n })\n })\n }\n\n doubleClick () {\n let lastClick\n\n this.view.on('mousedown.srcissors touchstart.srcissors', event => {\n const now = new Date().getTime()\n if (lastClick && (lastClick > (now - this.doubleClickThreshold))) {\n this.parent.onDoubleClick(getPageCoordinates(event))\n }\n lastClick = now\n })\n }\n\n preventBrowserDragDrop () {\n this.view.on('dragstart.srcissors', () => false)\n }\n\n // Resize View\n // -----------\n\n resizeView ({horizontal, vertical}) {\n const $template = $('
')\n $template.addClass('resize-handler')\n\n let positions = []\n if (horizontal) positions = positions.concat(['right', 'left'])\n if (vertical) positions = positions.concat(['top', 'bottom'])\n\n positions.forEach(position => {\n const $handler = $template.clone()\n $handler.addClass(`resize-handler-${position}`)\n $handler.on('mousedown.srcissors touchstart.srcissors', this.getResizeMouseDown(position))\n\n this.view.append($handler)\n })\n }\n\n getResizeMouseDown (position) {\n const $doc = $(document)\n\n return (event) => {\n let {pageX: lastX, pageY: lastY} = getPageCoordinates(event)\n event.stopPropagation()\n\n $doc.on('mousemove.srcissors-resize touchmove.srcissors-resize', e2 => {\n let dx, dy\n const {pageX, pageY} = getPageCoordinates(e2)\n switch (position) {\n case 'top': case 'bottom':\n dy = pageY - lastY\n if (position === 'top') { dy = -dy }\n lastY = pageY\n break\n case 'left': case 'right':\n dx = pageX - lastX\n if (position === 'left') { dx = -dx }\n lastX = pageX\n break\n }\n\n this.parent.onResize({position, dx, dy})\n }).on('mouseup.srcissors-resize touchend.srcissors-resize', () => {\n $doc.off('mouseup.srcissors-resize touchmove.srcissors-resize')\n $doc.off('mousemove.srcissors-resize touchend.srcissors-resize')\n\n // only trigger panEnd if pan has been called\n this.parent.onResizeEnd({position})\n })\n }\n }\n\n responsiveArena () {}\n}\n\n// $(window).on('resize', (event) => console.log 'on window resize')\n","const $ = require('jquery')\n\nmodule.exports = class Preview {\n\n constructor ({onReady, img, opacity, outline}) {\n this.onReady = onReady\n this.img = img\n this.opacity = opacity\n this.outline = outline\n this.x = (this.y = 0)\n this.width = (this.height = 0)\n\n this.img.on('load', () => {\n const width = this.img.width()\n const height = this.img.height()\n this.ratio = width / height\n\n this.onReady({width, height})\n this.img.show()\n })\n }\n\n setImage ({url}) {\n this.url = url\n this.img.attr('src', this.url)\n if (this.outline) this.setBackgroundImage({url: this.url})\n }\n\n setBackgroundImage ({url}) {\n if (this.opacity > 0) {\n const bgImg = $('').css({opacity: this.opacity}).attr('src', url)\n this.outline.append(bgImg)\n }\n }\n\n reset () {\n this.url = undefined\n this.x = (this.y = 0)\n this.width = (this.height = 0)\n this.img.attr('src', '')\n this.img.css({width: '', height: '', transform: ''})\n if (this.outline) this.outline.css({transform: ''}).html('')\n }\n\n setWidth (width) {\n this.img.css({width: `${width}px`, height: 'auto'})\n const height = width / this.ratio\n this.updateImageDimensions({width, height})\n }\n\n setHeight (height) {\n this.img.css({width: 'auto', height: `${height}px`})\n const width = height * this.ratio\n this.updateImageDimensions({width, height})\n }\n\n updateImageDimensions ({width, height}) {\n this.width = width\n this.height = height\n if (this.outline) this.outline.css({width: `${this.width}px`, height: `${this.height}px`})\n }\n\n pan (x1, y1) {\n // Without rounding some numbers would not be set to css.\n // e.g: '-5.14957320384e-14'\n this.x = x1\n this.y = y1\n const x = Math.round(this.x)\n const y = Math.round(this.y)\n this.img.css({transform: `translate(-${x}px, -${y}px)`})\n if (this.outline) this.outline.css({transform: `translate(-${x}px, -${y}px)`})\n }\n}\n\n","const $ = require('jquery')\nconst Crop = require('./crop')\n\nmodule.exports = {\n new ({\n arena, url, fixedWidth, fixedHeight, minWidth, minHeight,\n minRatio, maxRatio, maxArea, originalSize, zoomStep, crop, actions, minResolution,\n surroundingImageOpacity, showSurroundingImage\n }) {\n arena = $(arena)\n const view = arena.find('.crop-view')\n const preview = view.find('.crop-preview')\n const img = $('')\n preview.append(img)\n let outline = view.find('.crop-outline')\n if (!outline.length) { outline = undefined }\n\n const allowedActions = {\n pan: true,\n zoomOnDoubleClick: true,\n resize: true,\n resizeHorizontal: !fixedWidth,\n resizeVertical: !fixedHeight\n }\n\n $.extend(allowedActions, actions)\n\n if (zoomStep == null) { zoomStep = 1.25 }\n\n if (minWidth == null) { minWidth = 50 }\n if (minHeight == null) { minHeight = 50 }\n\n return new Crop({\n url, // {String}\n crop, // {Object} Set an inital crop. This is the same as calling setCrop()\n arena, // {jQuery Element}\n view, // {jQuery Element}\n img, // {jQuery Element}\n outline, // {jQuery Element or undefined}\n showSurroundingImage, // {String} always|panning|never\n surroundingImageOpacity, // {Number} e.g. in the 0.0 - 1.0 range\n fixedWidth, // {Number} e.g. 300\n fixedHeight, // {Number} e.g. 500\n minViewWidth: minWidth, // {Number} e.g. 100\n minViewHeight: minHeight, // {Number} e.g. 100\n minViewRatio: minRatio, // {Number} e.g. 1.5/2\n maxViewRatio: maxRatio, // {Number} e.g. 2/1\n maxArea, // {Number} 0.8 -> max 80% of arena area are covered by the preview\n originalSize, // {Object} Original image size, can be used to display a downscaled\n // version of the image in the cropping interface, but use the original\n // size for crop attributes; e.g. {width: 4000, height: 3000}\n zoomStep, // {Number} e.g. 1.25 -> 125%\n actions: allowedActions,\n minResolution\n })\n }\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__47__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(505);\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__47__","$","Preview","Events","Crop","_ref","arena","view","img","outline","url","fixedWidth","fixedHeight","minViewWidth","minViewHeight","minViewRatio","maxViewRatio","originalSize","crop","zoomStep","maxArea","actions","minResolution","surroundingImageOpacity","showSurroundingImage","_classCallCheck","this","onPreviewReady","bind","loadingCssClass","panningCssClass","outlineCssClass","isPanning","initialCrop","loadEvent","Callbacks","changeEvent","initializeReadyState","zoomInStep","zoomOutStep","arenaWidth","width","arenaHeight","height","setSurroundingImageVisibility","preview","onReady","opacity","setImage","key","value","isReady","readyEvent","empty","isInitialized","reset","addClass","visibility","parseFloat","css","resize","imageWidth","imageHeight","zoomAllOut","previewImageSize","checkRatio","keepDimension","_ref2","updateImageDimensions","events","parent","imageRatio","imageResolution","minRatioForResolution","maxRatioForResolution","calcMaxMinDimensions","setViewDimensions","removeClass","center","setCrop","fire","_ref3","_this","x","y","factor","viewWidth","previewWidth","zoom","pan","on","viewHeight","roundCrop","validateCrop","name","Math","round","ratio","_this2","enforceValidRatio","resizeFocusPoint","getFocusPoint","setRatio","data","newX","startX","dx","newY","startY","dy","_ref4","pageX","pageY","_this$view$0$getBound","getBoundingClientRect","viewX","left","viewY","top","zoomIn","_ref5","position","isResizing","includes","undefined","_ref6","focusPoint","_ref7","_this$enforceMaxArea","enforceMaxArea","_this$enforceViewDime","enforceViewDimensions","viewRatio","minZoomPixelWidth","sqrt","minZoomPixelHeight","maxImageWidth","maxImageHeight","fireChange","isWidthRestricting","params","_ref8","_this$enforceZoom","enforceZoom","setWidth","setHeight","focus","param","_param","percentX","percentY","_ref9","enforceXy","_ref10","_ref11","maxWidth","min","maxHeight","minWidth","minHeight","_ref12","_ref13","newHeight","newWidth","isValidRatio","_this$getRatioBox","getRatioBox","_this$centerAlign","centerAlign","_this$centerAlign2","_ref14","expectedRatio","actualRatio","percentageChange","abs","Error","concat","_ref15","areaWidth","areaHeight","array","_step","_iterator","_createForOfIteratorHelper","s","n","done","number","err","e","f","callback","add","remove","_this3","changeDispatch","setTimeout","getCrop","r","num","obj","image","previewXy","console","log","getPageCoordinates","event","type","originalEvent","changedTouches","horizontal","vertical","doubleClickThreshold","zoomOnDoubleClick","doubleClick","resizeView","resizeHorizontal","resizeVertical","preventBrowserDragDrop","responsiveArena","$doc","document","e1","panData","preventDefault","e2","_getPageCoordinates","_getPageCoordinates2","prevPageX","prevPageY","onPan","off","onPanEnd","lastClick","now","Date","getTime","onDoubleClick","$template","positions","forEach","$handler","clone","getResizeMouseDown","append","_this4","_getPageCoordinates3","lastX","lastY","stopPropagation","_getPageCoordinates4","onResize","onResizeEnd","show","attr","setBackgroundImage","bgImg","transform","html","x1","y1","new","minRatio","maxRatio","find","length","allowedActions","extend","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"./srcissors.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,WACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,UAAWJ,GACO,iBAAZC,QACdA,QAAmB,UAAID,EAAQG,QAAQ,WAEvCJ,EAAgB,UAAIC,EAAQD,EAAa,OAC1C,CATD,CASGO,MAAOC,G,wCCTE,SAAAC,EAAAC,GAAA,OAAAD,EAAA,mBAAAE,QAAA,iBAAAA,OAAAC,SAAA,SAAAF,GAAA,cAAAA,CAAA,WAAAA,GAAA,OAAAA,GAAA,mBAAAC,QAAAD,EAAAG,cAAAF,QAAAD,IAAAC,OAAAG,UAAA,gBAAAJ,CAAA,EAAAD,EAAAC,EAAA,UAAAK,EAAAC,EAAAC,IAAA,MAAAA,GAAAA,EAAAD,EAAAE,UAAAD,EAAAD,EAAAE,QAAA,QAAAC,EAAA,EAAAC,EAAA,IAAAC,MAAAJ,GA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AGnBjB,GADND,EAAQL,EAAEK,IACSoR,KAAK,cAClB3O,EAAUxC,EAAKmR,KAAK,iBACpBlR,EAAMP,EAAE,SACd8C,EAAQuN,OAAO9P,GACf,IAAIC,EAAUF,EAAKmR,KAAK,iBACnBjR,EAAQhC,SAAUgC,OAAUd,GAEjC,IAAMgS,EAAiB,CACrBhM,KAAK,EACL4I,mBAAmB,EACnBzK,QAAQ,EACR4K,kBAAmB/N,EACnBgO,gBAAiB/N,GAUnB,OAPAX,EAAE2R,OAAOD,EAAgBtQ,GAET,MAAZF,IAAoBA,EAAW,MAEnB,MAAZ4I,IAAoBA,EAAW,IAClB,MAAbC,IAAqBA,EAAY,IAE9B,IAAI5J,EAAK,CACdM,IAAAA,EACAQ,KAAAA,EACAZ,MAAAA,EACAC,KAAAA,EACAC,IAAAA,EACAC,QAAAA,EACAe,qBAAAA,EACAD,wBAAAA,EACAZ,WAAAA,EACAC,YAAAA,EACAC,aAAckJ,EACdjJ,cAAekJ,EACfjJ,aAAcyQ,EACdxQ,aAAcyQ,EACdrQ,QAAAA,EACAH,aAAAA,EAGAE,SAAAA,EACAE,QAASsQ,EACTrQ,cAAAA,GAEJ,E,SCxDF5D,EAAOD,QAAUM,C,GCCb8T,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBpS,IAAjBqS,EACH,OAAOA,EAAavU,QAGrB,IAAIC,EAASmU,EAAyBE,GAAY,CAGjDtU,QAAS,CAAC,GAOX,OAHAwU,EAAoBF,GAAUrU,EAAQA,EAAOD,QAASqU,GAG/CpU,EAAOD,OACf,CCnB0BqU,CAAoB,I","sources":["webpack://srcissors/webpack/universalModuleDefinition","webpack://srcissors/./src/crop.js","webpack://srcissors/./src/events.js","webpack://srcissors/./src/preview.js","webpack://srcissors/./src/srcissors.js","webpack://srcissors/external umd {\"commonjs\":\"jquery\",\"commonjs2\":\"jquery\",\"amd\":\"jquery\",\"root\":\"jQuery\"}","webpack://srcissors/webpack/bootstrap","webpack://srcissors/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"jquery\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"jquery\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"srcissors\"] = factory(require(\"jquery\"));\n\telse\n\t\troot[\"srcissors\"] = factory(root[\"jQuery\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__47__) => {\nreturn ","'use strict'\nconst $ = require('jquery')\nconst Preview = require('./preview')\nconst Events = require('./events')\n\nmodule.exports = class Crop {\n constructor ({\n arena, view, img, outline, url, fixedWidth, fixedHeight,\n minViewWidth, minViewHeight, minViewRatio, maxViewRatio, originalSize, crop,\n zoomStep, maxArea, actions, minResolution, surroundingImageOpacity,\n showSurroundingImage\n }) {\n // CSS classes\n this.onPreviewReady = this.onPreviewReady.bind(this)\n this.arena = arena\n this.view = view\n this.img = img\n this.outline = outline\n this.fixedWidth = fixedWidth\n this.fixedHeight = fixedHeight\n this.minViewWidth = minViewWidth\n this.minViewHeight = minViewHeight\n this.minViewRatio = minViewRatio\n this.maxViewRatio = maxViewRatio\n this.originalSize = originalSize\n this.actions = actions\n this.minResolution = minResolution\n this.surroundingImageOpacity = surroundingImageOpacity\n this.loadingCssClass = 'crop-view--is-loading'\n this.panningCssClass = 'crop-view--is-panning'\n this.outlineCssClass = 'crop-outline--active'\n\n // State\n this.isPanning = false\n this.initialCrop = crop\n\n // Events\n this.loadEvent = $.Callbacks()\n this.changeEvent = $.Callbacks()\n\n // Sets up the ready event and state\n this.initializeReadyState()\n\n // Confguration\n this.zoomInStep = zoomStep\n this.zoomOutStep = 1 / this.zoomInStep\n\n this.arenaWidth = this.arena.width()\n this.arenaHeight = this.arena.height()\n\n // todo: consider to calculate maxArea with regards to the\n // maximum space an image can within the area. That should\n // be more reliable.\n if (maxArea) this.maxArea = (this.arenaWidth * this.arenaHeight) * maxArea\n\n if (this.outline) this.setSurroundingImageVisibility(showSurroundingImage)\n\n this.preview = new Preview({\n onReady: this.onPreviewReady,\n img: this.img,\n outline: this.outline,\n opacity: this.surroundingImageOpacity\n })\n\n this.setImage(url)\n }\n\n initializeReadyState () {\n this.isReady = false\n if (this.readyEvent != null) {\n this.readyEvent.empty()\n }\n this.readyEvent = $.Callbacks('memory once')\n }\n\n setImage (url) {\n if (url === this.preview.url) return\n\n if (this.isInitialized) this.preview.reset()\n this.initializeReadyState()\n this.view.addClass(this.loadingCssClass)\n this.preview.setImage({url})\n }\n\n setSurroundingImageVisibility (visibility) {\n // visibility: always|panning|never\n // override opacity in crop-outline--active css class\n this.surroundingImageOpacity = parseFloat(this.surroundingImageOpacity || 0.2)\n\n if (visibility === 'always') {\n this.outline.css('opacity', 1.0)\n } else if (visibility === 'panning') {\n this.outline.css('opacity', null)\n } else { // 'never' default\n this.outline.css('opacity', 0)\n this.surroundingImageOpacity = 0\n }\n }\n\n reset () {\n if (!this.isReady) return\n\n this.resize({width: this.imageWidth, height: this.imageHeight})\n this.zoomAllOut()\n }\n\n onPreviewReady (previewImageSize) {\n this.checkRatio(previewImageSize)\n const {width, height} = this.originalSize || previewImageSize\n\n // console.log(this.originalSize, previewImageSize, {width, height})\n this.preview.updateImageDimensions({width, height})\n\n let keepDimension\n if (!this.isInitialized) {\n this.events = new Events({\n parent: this,\n view: this.view,\n actions: this.actions\n })\n }\n\n this.imageWidth = width\n this.imageHeight = height\n this.imageRatio = this.imageWidth / this.imageHeight\n const imageResolution = this.imageWidth * this.imageHeight\n\n if (this.minResolution && (this.minResolution > imageResolution)) {\n // If the minimal required resolution is bigger than the actual image\n // resolution, we ignore the configuration\n delete this.minResolution\n }\n\n if (this.minResolution) {\n // For any given image resolution with a minimal required resolution\n // we can calculate both, a minimal resolution and a maximal resolution\n const minRatioForResolution = this.minResolution / (this.imageHeight * this.imageHeight)\n if (!this.minViewRatio || (this.minViewRatio < minRatioForResolution)) {\n this.minViewRatio = minRatioForResolution\n }\n const maxRatioForResolution = (this.imageWidth * this.imageWidth) / this.minResolution\n if (!this.maxViewRatio || (this.maxViewRatio > maxRatioForResolution)) {\n this.maxViewRatio = maxRatioForResolution\n }\n }\n\n this.calcMaxMinDimensions()\n\n if (this.fixedWidth) { keepDimension = 'width' }\n if (this.fixedHeight) { keepDimension = 'height' }\n this.setViewDimensions({\n width: this.imageWidth,\n height: this.imageHeight,\n keepDimension\n })\n\n // ready state\n this.isReady = true\n this.view.removeClass(this.loadingCssClass)\n\n if (!this.isInitialized && (this.initialCrop != null)) {\n this.setCrop(this.initialCrop)\n } else {\n this.zoomAllOut()\n this.center()\n }\n\n this.isInitialized = true\n this.readyEvent.fire()\n this.loadEvent.fire()\n }\n\n setCrop ({x, y, width, height}) {\n if (!this.isReady) {\n this.on('ready', () => this.setCrop({x, y, width, height}))\n return\n }\n\n this.resize({width, height})\n\n const factor = this.viewWidth / width\n const previewWidth = this.imageWidth * factor\n\n this.zoom({width: previewWidth})\n this.pan({x: x * factor, y: y * factor})\n }\n\n getCrop () {\n const factor = this.preview.width / this.imageWidth\n const crop = {\n x: this.preview.x / factor,\n y: this.preview.y / factor,\n width: this.viewWidth / factor,\n height: this.viewHeight / factor\n }\n\n this.roundCrop(crop)\n this.validateCrop(crop)\n return crop\n }\n\n roundCrop (crop) {\n for (const name in crop) {\n const value = crop[name]\n crop[name] = Math.round(value)\n }\n }\n\n validateCrop (crop) {\n const {x, y, width, height} = crop\n if (x < 0) crop.x = 0\n if (y < 0) crop.y = 0\n\n if ((x + width) > this.imageWidth) {\n crop.width = this.imageWidth - x\n }\n\n if ((y + height) > this.imageHeight) {\n crop.height = this.imageHeight - y\n }\n\n return crop\n }\n\n setRatio (ratio, keepDimension) {\n let height, width\n if (!this.isReady) {\n this.on('ready', () => this.setRatio(ratio, keepDimension))\n return\n }\n\n ratio = this.enforceValidRatio(ratio)\n\n if (keepDimension === 'height') {\n height = this.viewHeight\n width = height * ratio\n } else {\n width = this.viewWidth\n height = width / ratio\n }\n\n this.resizeFocusPoint = this.getFocusPoint()\n return this.resize({width, height})\n }\n\n // Event handling\n // --------------\n\n onPan (data) {\n if (!this.isPanning) {\n this.isPanning = true\n this.arena.addClass(this.panningCssClass)\n this.outline.addClass(this.outlineCssClass)\n }\n\n const newX = data.startX - data.dx\n const newY = data.startY - data.dy\n this.pan({x: newX, y: newY})\n }\n\n onPanEnd () {\n this.isPanning = false\n this.arena.removeClass(this.panningCssClass)\n return this.outline.removeClass(this.outlineCssClass)\n }\n\n onDoubleClick ({pageX, pageY}) {\n const {left, top} = this.view[0].getBoundingClientRect()\n const viewX = pageX - left\n const viewY = pageY - top\n this.zoomIn({viewX, viewY})\n }\n\n onResize ({position, dx, dy}) {\n if (!this.isResizing) {\n this.isResizing = true\n this.resizeFocusPoint = this.getFocusPoint()\n }\n\n if (['top', 'bottom'].includes(position)) {\n dy = 2 * dy // Because it's centered we need to change width by factor two\n this.resize({width: this.viewWidth, height: this.viewHeight + dy, keepDimension: 'height'})\n } else if (['left', 'right'].includes(position)) {\n dx = 2 * dx\n this.resize({width: this.viewWidth + dx, height: this.viewHeight, keepDimension: 'width'})\n }\n }\n\n onResizeEnd () {\n this.isResizing = false\n this.resizeFocusPoint = undefined\n }\n\n resize ({width, height, keepDimension}) {\n this.setViewDimensions({width, height, keepDimension})\n\n // Update view center of focus point\n if (this.resizeFocusPoint) {\n this.resizeFocusPoint.viewX = this.viewWidth / 2\n this.resizeFocusPoint.viewY = this.viewHeight / 2\n }\n\n // Ensure dimensions and focus\n this.zoom({\n width: this.preview.width,\n height: this.preview.height,\n focusPoint: this.resizeFocusPoint\n })\n }\n\n setViewDimensions ({width, height, keepDimension}) {\n if (this.maxArea) {\n ({width, height} = this.enforceMaxArea({width, height, keepDimension}))\n }\n\n ({width, height} = this.enforceViewDimensions({width, height, keepDimension}))\n\n this.view.css({width, height})\n this.viewWidth = width\n this.viewHeight = height\n this.viewRatio = width / height\n\n if (this.minResolution) {\n const minZoomPixelWidth = Math.sqrt(this.minResolution * this.viewRatio)\n const minZoomPixelHeight = Math.sqrt(this.minResolution / this.viewRatio)\n this.maxImageWidth = (this.viewWidth / minZoomPixelWidth) * this.imageWidth\n this.maxImageHeight = (this.viewHeight / minZoomPixelHeight) * this.imageHeight\n }\n\n this.fireChange()\n }\n\n // Update view\n // -----------\n\n zoomAllOut () {\n if (this.isWidthRestricting()) {\n this.zoom({width: this.viewWidth})\n } else {\n this.zoom({height: this.viewHeight})\n }\n }\n\n zoomIn (params) {\n if (params == null) { params = {} }\n if (this.isWidthRestricting()) {\n params.width = this.preview.width * this.zoomInStep\n } else {\n params.height = this.preview.height * this.zoomInStep\n }\n\n this.zoom(params)\n }\n\n zoomOut (params) {\n if (params == null) { params = {} }\n if (this.isWidthRestricting()) {\n params.width = this.preview.width * this.zoomOutStep\n } else {\n params.height = this.preview.height * this.zoomOutStep\n }\n\n this.zoom(params)\n }\n\n zoom ({width, height, viewX, viewY, focusPoint}) {\n if (focusPoint == null) { focusPoint = this.getFocusPoint({viewX, viewY}) }\n\n ({width, height} = this.enforceZoom({width, height}))\n if (width != null) {\n this.preview.setWidth(width)\n this.fireChange()\n } else if (height != null) {\n this.preview.setHeight(height)\n this.fireChange()\n }\n\n this.focus(focusPoint)\n }\n\n // returns {Object} e.g. percentX: 0.2, percentY: 0.5\n getFocusPoint (param) {\n if (param == null) { param = {} }\n let {viewX, viewY} = param\n if (viewX == null) { viewX = this.viewWidth / 2 }\n if (viewY == null) { viewY = this.viewHeight / 2 }\n const x = this.preview.x + viewX\n const y = this.preview.y + viewY\n const percentX = x / this.preview.width\n const percentY = y / this.preview.height\n return {percentX, percentY, viewX, viewY}\n }\n\n focus ({percentX, percentY, viewX, viewY}) {\n let x = this.preview.width * percentX\n let y = this.preview.height * percentY\n x = x - viewX\n y = y - viewY\n\n this.pan({x, y})\n }\n\n center () {\n const newX = (this.preview.width - this.viewWidth) / 2\n const newY = (this.preview.height - this.viewHeight) / 2\n this.pan({x: newX, y: newY})\n }\n\n // @param { Object }\n // - x {Number} pixel to pan to the left\n // - y {Number} pixels to pan to the top\n pan (data) {\n data = this.enforceXy(data)\n this.preview.pan(data.x, data.y)\n this.fireChange()\n }\n\n // Validations\n // -----------\n\n enforceXy ({x, y}) {\n if (x > (this.preview.width - this.viewWidth)) {\n x = this.preview.width - this.viewWidth\n }\n\n if (x < 0) x = 0\n\n\n if (y > (this.preview.height - this.viewHeight)) {\n y = this.preview.height - this.viewHeight\n }\n\n if (y < 0) y = 0\n\n return {x, y}\n }\n\n enforceZoom ({width, height}) {\n\n if ((width != null) && this.maxImageWidth && (width > this.maxImageWidth)) {\n // prevent zooming in past the required resolution defined by minResolution\n return {width: this.maxImageWidth}\n }\n\n if ((width != null) && (width < this.viewWidth)) {\n // prevent zooming out past covering the view completely\n return {width: this.viewWidth}\n }\n\n if ((height != null) && this.maxImageHeight && (height > this.maxImageHeight)) {\n // prevent zooming in past the required resolution defined by minResolution\n return {height: this.maxImageHeight}\n }\n\n if ((height != null) && (height < this.viewHeight)) {\n // prevent zooming out past covering the view completely\n return {height: this.viewHeight}\n }\n\n return {width, height}\n }\n\n calcMaxMinDimensions () {\n this.maxWidth = this.min([this.arenaWidth, this.imageWidth])\n this.maxHeight = this.min([this.arenaHeight, this.imageHeight])\n this.minWidth = this.minViewWidth || 0\n this.minHeight = this.minViewHeight || 0\n\n if (this.fixedWidth) this.maxWidth = (this.minWidth = this.fixedWidth)\n if (this.fixedHeight) this.maxHeight = (this.minHeight = this.fixedHeight)\n }\n\n areDimensionsValid ({width, height, keepDimension}) {\n const ratio = width / height\n\n const invalid =\n (width < this.minWidth) ||\n (width > this.maxWidth) ||\n (height < this.minHeight) ||\n (height > this.maxHeight) ||\n (ratio < this.minViewRatio) ||\n (ratio > this.maxViewRatio)\n\n return !invalid\n }\n\n isValidRatio (ratio) {\n return !((ratio < this.minViewRatio) || (ratio > this.maxViewRatio))\n }\n\n enforceValidRatio (ratio) {\n if (ratio < this.minViewRatio) return this.minViewRatio\n if (ratio > this.maxViewRatio) return this.maxViewRatio\n return ratio\n }\n\n enforceViewDimensions ({width, height, keepDimension}) {\n let newHeight, newWidth, ratio\n if (width < this.minWidth) newWidth = this.minWidth\n if (width > this.maxWidth) newWidth = this.maxWidth\n if (height < this.minHeight) newHeight = this.minHeight\n if (height > this.maxHeight) newHeight = this.maxHeight\n\n if (keepDimension) {\n if (newWidth) width = newWidth\n if (newHeight) height = newHeight\n\n // check max/min ratios\n ratio = width / height\n if (!this.isValidRatio(ratio)) {\n ratio = this.enforceValidRatio(ratio);\n ({width, height} = this.getRatioBox({ratio, width, height, keepDimension}))\n if ((width > this.arenaWidth) || (height > this.arenaHeight)) {\n ({width, height} = this.centerAlign(this.maxWidth, this.maxHeight, ratio))\n }\n }\n\n } else if (newWidth || newHeight) {\n ratio = this.enforceValidRatio(width / height);\n ({width, height} = this.centerAlign(this.maxWidth, this.maxHeight, ratio))\n }\n\n return {width, height}\n }\n\n enforceMaxArea ({width, height, keepDimension}) {\n let ratio = width / height\n\n if (keepDimension === 'width') {\n height = this.maxArea / width\n ratio = width / height\n } else if (keepDimension === 'height') {\n width = this.maxArea / height\n ratio = width / height\n } else { // keep ratio\n width = Math.sqrt(this.maxArea * ratio)\n height = width / ratio\n }\n\n if (!this.isValidRatio(ratio)) {\n ratio = this.enforceValidRatio(ratio)\n width = Math.sqrt(this.maxArea * ratio)\n height = width / ratio\n }\n\n return {width, height}\n }\n\n checkRatio (previewImageSize) {\n if (this.originalSize) {\n const expectedRatio = this.originalSize.width / this.originalSize.height\n const actualRatio = previewImageSize.width / previewImageSize.height\n const percentageChange = ((actualRatio - expectedRatio) / expectedRatio) * 100\n if (Math.abs(percentageChange) > 1) {\n throw new Error(`srcissors: Displayed image has a different image ratio than the ` +\n `one configured in 'originalRatio': ${expectedRatio} vs ${actualRatio}`)\n }\n }\n }\n\n // Calculations\n // ------------\n //\n // Ratio: width / height\n // Tall < 1 (Square) < Wide\n // (A ratio less than one is a tall image format and\n // a ratio greater than one is a wide image format)\n\n // Check if the width or height is restricting\n isWidthRestricting () {\n return this.viewRatio >= this.imageRatio\n }\n\n getRatioBox ({ratio, width, height, keepDimension}) {\n if ((keepDimension === 'width') || (height == null)) {\n height = width / ratio\n } else if ((keepDimension === 'height') || (width == null)) {\n width = height * ratio\n } else {\n height = width / ratio\n }\n\n return {width, height}\n }\n\n centerAlign (areaWidth, areaHeight, ratio) {\n let height, width, x, y\n if ((areaWidth / areaHeight) > ratio) {\n width = areaHeight * ratio\n x = (areaWidth - width) / 2\n } else {\n height = areaWidth / ratio\n y = (areaHeight - height) / 2\n }\n\n // return\n return {\n x: x || 0,\n y: y || 0,\n width: width || areaWidth,\n height: height || areaHeight\n }\n }\n\n min (array) {\n let min = array[0]\n for (const number of array) {\n if (number < min) min = number\n }\n\n return min\n }\n\n // Events\n // ------\n\n on (name, callback) {\n return this[`${name}Event`].add(callback)\n }\n\n off (name, callback) {\n return this[`${name}Event`].remove(callback)\n }\n\n // Debounce change events so they are not fired more\n // than once per tick.\n fireChange () {\n if (this.changeDispatch != null) return\n\n this.changeDispatch = setTimeout(() => {\n this.changeDispatch = undefined\n this.changeEvent.fire(this.getCrop())\n }, 0)\n }\n\n // Development helpers\n // -------------------\n\n debug () {\n const r = num => Math.round(num * 10) / 10\n\n const obj = {\n arena: `${r(this.arenaWidth)}x${r(this.arenaHeight)}`,\n view: `${r(this.viewWidth)}x${r(this.viewHeight)}`,\n image: `${r(this.imageWidth)}x${r(this.imageHeight)}`,\n preview: `${r(this.preview.width)}x${r(this.preview.height)}`,\n previewXy: `${r(this.preview.x)}x${r(this.preview.y)}`\n }\n\n console.log(obj) // eslint-disable-line no-console\n return obj\n }\n}\n","'use strict'\nconst $ = require('jquery')\n\nconst getPageCoordinates = function (event) {\n if (event.type.includes('touch')) {\n return {\n pageX: event.originalEvent.changedTouches[0].pageX,\n pageY: event.originalEvent.changedTouches[0].pageY\n }\n }\n return {pageX: event.pageX, pageY: event.pageY}\n}\n\nmodule.exports = class Events {\n constructor ({parent, view, horizontal, vertical, actions}) {\n this.parent = parent\n this.view = view\n this.doubleClickThreshold = 300\n\n // setup events\n if (actions.pan) { this.pan() }\n if (actions.zoomOnDoubleClick) { this.doubleClick() }\n if (actions.resize) {\n this.resizeView({\n horizontal: actions.resizeHorizontal,\n vertical: actions.resizeVertical\n })\n }\n\n this.preventBrowserDragDrop()\n this.responsiveArena()\n }\n\n pan () {\n const $doc = $(document)\n this.view.on('mousedown.srcissors touchstart.srcissors', (e1) => {\n const panData = {\n startX: this.parent.preview.x,\n startY: this.parent.preview.y\n }\n\n e1.preventDefault()\n $doc.on('mousemove.srcissors-pan touchmove.srcissors-pan', (e2) => {\n const {pageX, pageY} = getPageCoordinates(e2)\n const {pageX: prevPageX, pageY: prevPageY} = getPageCoordinates(e1)\n panData.dx = pageX - prevPageX\n panData.dy = pageY - prevPageY\n this.parent.onPan(panData)\n }).on('mouseup.srcissors-pan touchend.srcissors-pan', () => {\n $doc.off('mouseup.srcissors-pan touchend.srcissors-pan')\n $doc.off('mousemove.srcissors-pan touchmove.srcissors-pan')\n\n // only trigger panEnd if pan has been called\n if (panData.dx != null) this.parent.onPanEnd()\n })\n })\n }\n\n doubleClick () {\n let lastClick\n\n this.view.on('mousedown.srcissors touchstart.srcissors', event => {\n const now = new Date().getTime()\n if (lastClick && (lastClick > (now - this.doubleClickThreshold))) {\n this.parent.onDoubleClick(getPageCoordinates(event))\n }\n lastClick = now\n })\n }\n\n preventBrowserDragDrop () {\n this.view.on('dragstart.srcissors', () => false)\n }\n\n // Resize View\n // -----------\n\n resizeView ({horizontal, vertical}) {\n const $template = $('
')\n $template.addClass('resize-handler')\n\n let positions = []\n if (horizontal) positions = positions.concat(['right', 'left'])\n if (vertical) positions = positions.concat(['top', 'bottom'])\n\n positions.forEach(position => {\n const $handler = $template.clone()\n $handler.addClass(`resize-handler-${position}`)\n $handler.on('mousedown.srcissors touchstart.srcissors', this.getResizeMouseDown(position))\n\n this.view.append($handler)\n })\n }\n\n getResizeMouseDown (position) {\n const $doc = $(document)\n\n return (event) => {\n let {pageX: lastX, pageY: lastY} = getPageCoordinates(event)\n event.stopPropagation()\n\n $doc.on('mousemove.srcissors-resize touchmove.srcissors-resize', e2 => {\n let dx, dy\n const {pageX, pageY} = getPageCoordinates(e2)\n switch (position) {\n case 'top': case 'bottom':\n dy = pageY - lastY\n if (position === 'top') { dy = -dy }\n lastY = pageY\n break\n case 'left': case 'right':\n dx = pageX - lastX\n if (position === 'left') { dx = -dx }\n lastX = pageX\n break\n }\n\n this.parent.onResize({position, dx, dy})\n }).on('mouseup.srcissors-resize touchend.srcissors-resize', () => {\n $doc.off('mouseup.srcissors-resize touchmove.srcissors-resize')\n $doc.off('mousemove.srcissors-resize touchend.srcissors-resize')\n\n // only trigger panEnd if pan has been called\n this.parent.onResizeEnd({position})\n })\n }\n }\n\n responsiveArena () {}\n}\n\n// $(window).on('resize', (event) => console.log 'on window resize')\n","'use strict'\nconst $ = require('jquery')\n\nmodule.exports = class Preview {\n\n constructor ({onReady, img, opacity, outline}) {\n this.onReady = onReady\n this.img = img\n this.opacity = opacity\n this.outline = outline\n this.x = (this.y = 0)\n this.width = (this.height = 0)\n\n this.img.on('load', () => {\n const width = this.img.width()\n const height = this.img.height()\n this.ratio = width / height\n\n this.onReady({width, height})\n this.img.show()\n })\n }\n\n setImage ({url}) {\n this.url = url\n this.img.attr('src', this.url)\n if (this.outline) this.setBackgroundImage({url: this.url})\n }\n\n setBackgroundImage ({url}) {\n if (this.opacity > 0) {\n const bgImg = $('').css({opacity: this.opacity}).attr('src', url)\n this.outline.append(bgImg)\n }\n }\n\n reset () {\n this.url = undefined\n this.x = (this.y = 0)\n this.width = (this.height = 0)\n this.img.attr('src', '')\n this.img.css({width: '', height: '', transform: ''})\n if (this.outline) this.outline.css({transform: ''}).html('')\n }\n\n setWidth (width) {\n this.img.css({width: `${width}px`, height: 'auto'})\n const height = width / this.ratio\n this.updateImageDimensions({width, height})\n }\n\n setHeight (height) {\n this.img.css({width: 'auto', height: `${height}px`})\n const width = height * this.ratio\n this.updateImageDimensions({width, height})\n }\n\n updateImageDimensions ({width, height}) {\n this.width = width\n this.height = height\n if (this.outline) this.outline.css({width: `${this.width}px`, height: `${this.height}px`})\n }\n\n pan (x1, y1) {\n // Without rounding some numbers would not be set to css.\n // e.g: '-5.14957320384e-14'\n this.x = x1\n this.y = y1\n const x = Math.round(this.x)\n const y = Math.round(this.y)\n this.img.css({transform: `translate(-${x}px, -${y}px)`})\n if (this.outline) this.outline.css({transform: `translate(-${x}px, -${y}px)`})\n }\n}\n\n","'use strict'\nconst $ = require('jquery')\nconst Crop = require('./crop')\n\nmodule.exports = {\n new ({\n arena, url, fixedWidth, fixedHeight, minWidth, minHeight,\n minRatio, maxRatio, maxArea, originalSize, zoomStep, crop, actions, minResolution,\n surroundingImageOpacity, showSurroundingImage\n }) {\n arena = $(arena)\n const view = arena.find('.crop-view')\n const preview = view.find('.crop-preview')\n const img = $('')\n preview.append(img)\n let outline = view.find('.crop-outline')\n if (!outline.length) { outline = undefined }\n\n const allowedActions = {\n pan: true,\n zoomOnDoubleClick: true,\n resize: true,\n resizeHorizontal: !fixedWidth,\n resizeVertical: !fixedHeight\n }\n\n $.extend(allowedActions, actions)\n\n if (zoomStep == null) { zoomStep = 1.25 }\n\n if (minWidth == null) { minWidth = 50 }\n if (minHeight == null) { minHeight = 50 }\n\n return new Crop({\n url, // {String}\n crop, // {Object} Set an inital crop. This is the same as calling setCrop()\n arena, // {jQuery Element}\n view, // {jQuery Element}\n img, // {jQuery Element}\n outline, // {jQuery Element or undefined}\n showSurroundingImage, // {String} always|panning|never\n surroundingImageOpacity, // {Number} e.g. in the 0.0 - 1.0 range\n fixedWidth, // {Number} e.g. 300\n fixedHeight, // {Number} e.g. 500\n minViewWidth: minWidth, // {Number} e.g. 100\n minViewHeight: minHeight, // {Number} e.g. 100\n minViewRatio: minRatio, // {Number} e.g. 1.5/2\n maxViewRatio: maxRatio, // {Number} e.g. 2/1\n maxArea, // {Number} 0.8 -> max 80% of arena area are covered by the preview\n originalSize, // {Object} Original image size, can be used to display a downscaled\n // version of the image in the cropping interface, but use the original\n // size for crop attributes; e.g. {width: 4000, height: 3000}\n zoomStep, // {Number} e.g. 1.25 -> 125%\n actions: allowedActions,\n minResolution\n })\n }\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__47__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(505);\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__47__","_typeof","obj","Symbol","iterator","constructor","prototype","_arrayLikeToArray","arr","len","length","i","arr2","Array","_defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","input","hint","prim","toPrimitive","undefined","res","call","TypeError","String","_toPrimitive","$","Preview","Events","Crop","_ref","arena","view","img","outline","url","fixedWidth","fixedHeight","minViewWidth","minViewHeight","minViewRatio","maxViewRatio","originalSize","crop","zoomStep","maxArea","actions","minResolution","surroundingImageOpacity","showSurroundingImage","instance","Constructor","_classCallCheck","this","onPreviewReady","bind","loadingCssClass","panningCssClass","outlineCssClass","isPanning","initialCrop","loadEvent","Callbacks","changeEvent","initializeReadyState","zoomInStep","zoomOutStep","arenaWidth","width","arenaHeight","height","setSurroundingImageVisibility","preview","onReady","opacity","setImage","protoProps","value","isReady","readyEvent","empty","isInitialized","reset","addClass","visibility","parseFloat","css","resize","imageWidth","imageHeight","zoomAllOut","previewImageSize","checkRatio","keepDimension","_ref2","updateImageDimensions","events","parent","imageRatio","imageResolution","minRatioForResolution","maxRatioForResolution","calcMaxMinDimensions","setViewDimensions","removeClass","center","setCrop","fire","_ref3","_this","x","y","factor","viewWidth","previewWidth","zoom","pan","on","viewHeight","roundCrop","validateCrop","name","Math","round","ratio","_this2","enforceValidRatio","resizeFocusPoint","getFocusPoint","setRatio","data","newX","startX","dx","newY","startY","dy","_ref4","pageX","pageY","_this$view$0$getBound","getBoundingClientRect","viewX","left","viewY","top","zoomIn","_ref5","position","isResizing","includes","_ref6","focusPoint","_ref7","_this$enforceMaxArea","enforceMaxArea","_this$enforceViewDime","enforceViewDimensions","viewRatio","minZoomPixelWidth","sqrt","minZoomPixelHeight","maxImageWidth","maxImageHeight","fireChange","isWidthRestricting","params","_ref8","_this$enforceZoom","enforceZoom","setWidth","setHeight","focus","param","_param","percentX","percentY","_ref9","enforceXy","_ref10","_ref11","maxWidth","min","maxHeight","minWidth","minHeight","_ref12","_ref13","newHeight","newWidth","isValidRatio","_this$getRatioBox","getRatioBox","_this$centerAlign","centerAlign","_this$centerAlign2","_ref14","expectedRatio","actualRatio","percentageChange","abs","Error","concat","_ref15","areaWidth","areaHeight","array","_step","_iterator","o","allowArrayLike","it","isArray","minLen","n","toString","slice","from","test","_unsupportedIterableToArray","F","s","done","e","_e","f","err","normalCompletion","didErr","step","next","_e2","return","_createForOfIteratorHelper","number","callback","add","remove","_this3","changeDispatch","setTimeout","getCrop","r","num","image","previewXy","console","log","getPageCoordinates","event","type","originalEvent","changedTouches","horizontal","vertical","doubleClickThreshold","zoomOnDoubleClick","doubleClick","resizeView","resizeHorizontal","resizeVertical","preventBrowserDragDrop","responsiveArena","$doc","document","e1","panData","preventDefault","e2","_getPageCoordinates","_getPageCoordinates2","prevPageX","prevPageY","onPan","off","onPanEnd","lastClick","now","Date","getTime","onDoubleClick","$template","positions","forEach","$handler","clone","getResizeMouseDown","append","_this4","_getPageCoordinates3","lastX","lastY","stopPropagation","_getPageCoordinates4","onResize","onResizeEnd","show","attr","setBackgroundImage","bgImg","transform","html","x1","y1","new","minRatio","maxRatio","find","allowedActions","extend","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index 0090f20..1668d2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "srcissors", - "version": "1.2.0", + "version": "2.1.4", "homepage": "https://github.com/livingdocsIO/srcissors", "description": "Image cropping for responsive images", "author": "Livingdocs ", diff --git a/srcissors.js b/srcissors.js index f98cf5d..2af93a6 100644 --- a/srcissors.js +++ b/srcissors.js @@ -1,2 +1,2 @@ -!function(i,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?exports.srcissors=t(require("jquery")):i.srcissors=t(i.jQuery)}(self,(i=>{return t={490:(i,t,e)=>{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){(null==t||t>i.length)&&(t=i.length);for(var e=0,n=new Array(t);eh&&delete this.minResolution,this.minResolution){var o=this.minResolution/(this.imageHeight*this.imageHeight);(!this.minViewRatio||this.minViewRatior)&&(this.maxViewRatio=r)}this.calcMaxMinDimensions(),this.fixedWidth&&(t="width"),this.fixedHeight&&(t="height"),this.setViewDimensions({width:this.imageWidth,height:this.imageHeight,keepDimension:t}),this.isReady=!0,this.view.removeClass(this.loadingCssClass),this.isInitialized||null==this.initialCrop?(this.zoomAllOut(),this.center()):this.setCrop(this.initialCrop),this.isInitialized=!0,this.readyEvent.fire(),this.loadEvent.fire()}},{key:"setCrop",value:function(i){var t=this,e=i.x,n=i.y,s=i.width,h=i.height;if(this.isReady){this.resize({width:s,height:h});var o=this.viewWidth/s,r=this.imageWidth*o;this.zoom({width:r}),this.pan({x:e*o,y:n*o})}else this.on("ready",(function(){return t.setCrop({x:e,y:n,width:s,height:h})}))}},{key:"getCrop",value:function(){var i=this.preview.width/this.imageWidth,t={x:this.preview.x/i,y:this.preview.y/i,width:this.viewWidth/i,height:this.viewHeight/i};return this.roundCrop(t),this.validateCrop(t),t}},{key:"roundCrop",value:function(i){for(var t in i){var e=i[t];i[t]=Math.round(e)}}},{key:"validateCrop",value:function(i){var t=i.x,e=i.y,n=i.width,s=i.height;return t<0&&(i.x=0),e<0&&(i.y=0),t+n>this.imageWidth&&(i.width=this.imageWidth-t),e+s>this.imageHeight&&(i.height=this.imageHeight-e),i}},{key:"setRatio",value:function(i,t){var e,n,s=this;if(this.isReady)return i=this.enforceValidRatio(i),"height"===t?n=(e=this.viewHeight)*i:e=(n=this.viewWidth)/i,this.resizeFocusPoint=this.getFocusPoint(),this.resize({width:n,height:e});this.on("ready",(function(){return s.setRatio(i,t)}))}},{key:"onPan",value:function(i){this.isPanning||(this.isPanning=!0,this.arena.addClass(this.panningCssClass),this.outline.addClass(this.outlineCssClass));var t=i.startX-i.dx,e=i.startY-i.dy;this.pan({x:t,y:e})}},{key:"onPanEnd",value:function(){return this.isPanning=!1,this.arena.removeClass(this.panningCssClass),this.outline.removeClass(this.outlineCssClass)}},{key:"onDoubleClick",value:function(i){var t=i.pageX,e=i.pageY,n=this.view[0].getBoundingClientRect(),s=t-n.left,h=e-n.top;this.zoomIn({viewX:s,viewY:h})}},{key:"onResize",value:function(i){var t=i.position,e=i.dx,n=i.dy;this.isResizing||(this.isResizing=!0,this.resizeFocusPoint=this.getFocusPoint()),["top","bottom"].includes(t)?(n*=2,this.resize({width:this.viewWidth,height:this.viewHeight+n,keepDimension:"height"})):["left","right"].includes(t)&&(e*=2,this.resize({width:this.viewWidth+e,height:this.viewHeight,keepDimension:"width"}))}},{key:"onResizeEnd",value:function(){this.isResizing=!1,this.resizeFocusPoint=void 0}},{key:"resize",value:function(i){var t=i.width,e=i.height,n=i.keepDimension;this.setViewDimensions({width:t,height:e,keepDimension:n}),this.resizeFocusPoint&&(this.resizeFocusPoint.viewX=this.viewWidth/2,this.resizeFocusPoint.viewY=this.viewHeight/2),this.zoom({width:this.preview.width,height:this.preview.height,focusPoint:this.resizeFocusPoint})}},{key:"setViewDimensions",value:function(i){var t=i.width,e=i.height,n=i.keepDimension;if(this.maxArea){var s=this.enforceMaxArea({width:t,height:e,keepDimension:n});t=s.width,e=s.height}var h=this.enforceViewDimensions({width:t,height:e,keepDimension:n});if(t=h.width,e=h.height,this.view.css({width:t,height:e}),this.viewWidth=t,this.viewHeight=e,this.viewRatio=t/e,this.minResolution){var o=Math.sqrt(this.minResolution*this.viewRatio),r=Math.sqrt(this.minResolution/this.viewRatio);this.maxImageWidth=this.viewWidth/o*this.imageWidth,this.maxImageHeight=this.viewHeight/r*this.imageHeight}this.fireChange()}},{key:"zoomAllOut",value:function(){this.isWidthRestricting()?this.zoom({width:this.viewWidth}):this.zoom({height:this.viewHeight})}},{key:"zoomIn",value:function(i){null==i&&(i={}),this.isWidthRestricting()?i.width=this.preview.width*this.zoomInStep:i.height=this.preview.height*this.zoomInStep,this.zoom(i)}},{key:"zoomOut",value:function(i){null==i&&(i={}),this.isWidthRestricting()?i.width=this.preview.width*this.zoomOutStep:i.height=this.preview.height*this.zoomOutStep,this.zoom(i)}},{key:"zoom",value:function(i){var t=i.width,e=i.height,n=i.viewX,s=i.viewY,h=i.focusPoint;null==h&&(h=this.getFocusPoint({viewX:n,viewY:s}));var o=this.enforceZoom({width:t,height:e});t=o.width,e=o.height,null!=t?(this.preview.setWidth(t),this.fireChange()):null!=e&&(this.preview.setHeight(e),this.fireChange()),this.focus(h)}},{key:"getFocusPoint",value:function(i){null==i&&(i={});var t=i,e=t.viewX,n=t.viewY;null==e&&(e=this.viewWidth/2),null==n&&(n=this.viewHeight/2);var s=this.preview.x+e,h=this.preview.y+n;return{percentX:s/this.preview.width,percentY:h/this.preview.height,viewX:e,viewY:n}}},{key:"focus",value:function(i){var t=i.percentX,e=i.percentY,n=i.viewX,s=i.viewY,h=this.preview.width*t,o=this.preview.height*e;h-=n,o-=s,this.pan({x:h,y:o})}},{key:"center",value:function(){var i=(this.preview.width-this.viewWidth)/2,t=(this.preview.height-this.viewHeight)/2;this.pan({x:i,y:t})}},{key:"pan",value:function(i){i=this.enforceXy(i),this.preview.pan(i.x,i.y),this.fireChange()}},{key:"enforceXy",value:function(i){var t=i.x,e=i.y;return t>this.preview.width-this.viewWidth&&(t=this.preview.width-this.viewWidth),t<0&&(t=0),e>this.preview.height-this.viewHeight&&(e=this.preview.height-this.viewHeight),e<0&&(e=0),{x:t,y:e}}},{key:"enforceZoom",value:function(i){var t=i.width,e=i.height;return null!=t&&this.maxImageWidth&&t>this.maxImageWidth?{width:this.maxImageWidth}:null!=t&&tthis.maxImageHeight?{height:this.maxImageHeight}:null!=e&&ethis.maxWidth||ethis.maxHeight||nthis.maxViewRatio)}},{key:"isValidRatio",value:function(i){return!(ithis.maxViewRatio)}},{key:"enforceValidRatio",value:function(i){return ithis.maxViewRatio?this.maxViewRatio:i}},{key:"enforceViewDimensions",value:function(i){var t,e,n,s=i.width,h=i.height,o=i.keepDimension;if(sthis.maxWidth&&(e=this.maxWidth),hthis.maxHeight&&(t=this.maxHeight),o){if(e&&(s=e),t&&(h=t),n=s/h,!this.isValidRatio(n)){n=this.enforceValidRatio(n);var r=this.getRatioBox({ratio:n,width:s,height:h,keepDimension:o});if(s=r.width,h=r.height,s>this.arenaWidth||h>this.arenaHeight){var a=this.centerAlign(this.maxWidth,this.maxHeight,n);s=a.width,h=a.height}}}else if(e||t){n=this.enforceValidRatio(s/h);var u=this.centerAlign(this.maxWidth,this.maxHeight,n);s=u.width,h=u.height}return{width:s,height:h}}},{key:"enforceMaxArea",value:function(i){var t=i.width,e=i.height,n=i.keepDimension,s=t/e;return"width"===n?s=t/(e=this.maxArea/t):"height"===n?s=(t=this.maxArea/e)/e:e=(t=Math.sqrt(this.maxArea*s))/s,this.isValidRatio(s)||(s=this.enforceValidRatio(s),e=(t=Math.sqrt(this.maxArea*s))/s),{width:t,height:e}}},{key:"checkRatio",value:function(i){if(this.originalSize){var t=this.originalSize.width/this.originalSize.height,e=i.width/i.height,n=(e-t)/t*100;if(Math.abs(n)>1)throw new Error("srcissors: Displayed image has a different image ratio than the "+"one configured in 'originalRatio': ".concat(t," vs ").concat(e))}}},{key:"isWidthRestricting",value:function(){return this.viewRatio>=this.imageRatio}},{key:"getRatioBox",value:function(i){var t=i.ratio,e=i.width,n=i.height,s=i.keepDimension;return"width"===s||null==n?n=e/t:"height"===s||null==e?e=n*t:n=e/t,{width:e,height:n}}},{key:"centerAlign",value:function(i,t,e){var n,s,h,o;return i/t>e?h=(i-(s=t*e))/2:o=(t-(n=i/e))/2,{x:h||0,y:o||0,width:s||i,height:n||t}}},{key:"min",value:function(i){var t,e=i[0],n=function(i,t){var e="undefined"!=typeof Symbol&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=function(i,t){if(i){if("string"==typeof i)return s(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);return"Object"===e&&i.constructor&&(e=i.constructor.name),"Map"===e||"Set"===e?Array.from(i):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(i,t):void 0}}(i))||t&&i&&"number"==typeof i.length){e&&(i=e);var n=0,h=function(){};return{s:h,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(i){throw i},f:h}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,r=!0,a=!1;return{s:function(){e=e.call(i)},n:function(){var i=e.next();return r=i.done,i},e:function(i){a=!0,o=i},f:function(){try{r||null==e.return||e.return()}finally{if(a)throw o}}}}(i);try{for(n.s();!(t=n.n()).done;){var h=t.value;h{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){for(var e=0;en-t.doubleClickThreshold&&t.parent.onDoubleClick(o(e)),i=n}))}},{key:"preventBrowserDragDrop",value:function(){this.view.on("dragstart.srcissors",(function(){return!1}))}},{key:"resizeView",value:function(i){var t=this,e=i.horizontal,n=i.vertical,s=h("
");s.addClass("resize-handler");var o=[];e&&(o=o.concat(["right","left"])),n&&(o=o.concat(["top","bottom"])),o.forEach((function(i){var e=s.clone();e.addClass("resize-handler-".concat(i)),e.on("mousedown.srcissors touchstart.srcissors",t.getResizeMouseDown(i)),t.view.append(e)}))}},{key:"getResizeMouseDown",value:function(i){var t=this,e=h(document);return function(n){var s=o(n),h=s.pageX,r=s.pageY;n.stopPropagation(),e.on("mousemove.srcissors-resize touchmove.srcissors-resize",(function(e){var n,s,a=o(e),u=a.pageX,c=a.pageY;switch(i){case"top":case"bottom":s=c-r,"top"===i&&(s=-s),r=c;break;case"left":case"right":n=u-h,"left"===i&&(n=-n),h=u}t.parent.onResize({position:i,dx:n,dy:s})})).on("mouseup.srcissors-resize touchend.srcissors-resize",(function(){e.off("mouseup.srcissors-resize touchmove.srcissors-resize"),e.off("mousemove.srcissors-resize touchend.srcissors-resize"),t.parent.onResizeEnd({position:i})}))}}},{key:"responsiveArena",value:function(){}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}()},289:(i,t,e)=>{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){for(var e=0;e0){var e=h("").css({opacity:this.opacity}).attr("src",t);this.outline.append(e)}}},{key:"reset",value:function(){this.url=void 0,this.x=this.y=0,this.width=this.height=0,this.img.attr("src",""),this.img.css({width:"",height:"",transform:""}),this.outline&&this.outline.css({transform:""}).html("")}},{key:"setWidth",value:function(i){this.img.css({width:"".concat(i,"px"),height:"auto"});var t=i/this.ratio;this.updateImageDimensions({width:i,height:t})}},{key:"setHeight",value:function(i){this.img.css({width:"auto",height:"".concat(i,"px")});var t=i*this.ratio;this.updateImageDimensions({width:t,height:i})}},{key:"updateImageDimensions",value:function(i){var t=i.width,e=i.height;this.width=t,this.height=e,this.outline&&this.outline.css({width:"".concat(this.width,"px"),height:"".concat(this.height,"px")})}},{key:"pan",value:function(i,t){this.x=i,this.y=t;var e=Math.round(this.x),n=Math.round(this.y);this.img.css({transform:"translate(-".concat(e,"px, -").concat(n,"px)")}),this.outline&&this.outline.css({transform:"translate(-".concat(e,"px, -").concat(n,"px)")})}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}()},505:(i,t,e)=>{var n=e(47),s=e(490);i.exports={new:function(i){var t=i.arena,e=i.url,h=i.fixedWidth,o=i.fixedHeight,r=i.minWidth,a=i.minHeight,u=i.minRatio,c=i.maxRatio,l=i.maxArea,g=i.originalSize,v=i.zoomStep,d=i.crop,m=i.actions,p=i.minResolution,f=i.surroundingImageOpacity,w=i.showSurroundingImage,y=(t=n(t)).find(".crop-view"),x=y.find(".crop-preview"),b=n("");x.append(b);var k=y.find(".crop-outline");k.length||(k=void 0);var R={pan:!0,zoomOnDoubleClick:!0,resize:!0,resizeHorizontal:!h,resizeVertical:!o};return n.extend(R,m),null==v&&(v=1.25),null==r&&(r=50),null==a&&(a=50),new s({url:e,crop:d,arena:t,view:y,img:b,outline:k,showSurroundingImage:w,surroundingImageOpacity:f,fixedWidth:h,fixedHeight:o,minViewWidth:r,minViewHeight:a,minViewRatio:u,maxViewRatio:c,maxArea:l,originalSize:g,zoomStep:v,actions:R,minResolution:p})}}},47:t=>{"use strict";t.exports=i}},e={},function i(n){var s=e[n];if(void 0!==s)return s.exports;var h=e[n]={exports:{}};return t[n](h,h.exports,i),h.exports}(505);var t,e})); +!function(i,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?exports.srcissors=t(require("jquery")):i.srcissors=t(i.jQuery)}(self,(i=>(()=>{"use strict";var t={490:(i,t,e)=>{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){(null==t||t>i.length)&&(t=i.length);for(var e=0,n=new Array(t);eh&&delete this.minResolution,this.minResolution){var o=this.minResolution/(this.imageHeight*this.imageHeight);(!this.minViewRatio||this.minViewRatior)&&(this.maxViewRatio=r)}this.calcMaxMinDimensions(),this.fixedWidth&&(t="width"),this.fixedHeight&&(t="height"),this.setViewDimensions({width:this.imageWidth,height:this.imageHeight,keepDimension:t}),this.isReady=!0,this.view.removeClass(this.loadingCssClass),this.isInitialized||null==this.initialCrop?(this.zoomAllOut(),this.center()):this.setCrop(this.initialCrop),this.isInitialized=!0,this.readyEvent.fire(),this.loadEvent.fire()}},{key:"setCrop",value:function(i){var t=this,e=i.x,n=i.y,s=i.width,h=i.height;if(this.isReady){this.resize({width:s,height:h});var o=this.viewWidth/s,r=this.imageWidth*o;this.zoom({width:r}),this.pan({x:e*o,y:n*o})}else this.on("ready",(function(){return t.setCrop({x:e,y:n,width:s,height:h})}))}},{key:"getCrop",value:function(){var i=this.preview.width/this.imageWidth,t={x:this.preview.x/i,y:this.preview.y/i,width:this.viewWidth/i,height:this.viewHeight/i};return this.roundCrop(t),this.validateCrop(t),t}},{key:"roundCrop",value:function(i){for(var t in i){var e=i[t];i[t]=Math.round(e)}}},{key:"validateCrop",value:function(i){var t=i.x,e=i.y,n=i.width,s=i.height;return t<0&&(i.x=0),e<0&&(i.y=0),t+n>this.imageWidth&&(i.width=this.imageWidth-t),e+s>this.imageHeight&&(i.height=this.imageHeight-e),i}},{key:"setRatio",value:function(i,t){var e,n,s=this;if(this.isReady)return i=this.enforceValidRatio(i),"height"===t?n=(e=this.viewHeight)*i:e=(n=this.viewWidth)/i,this.resizeFocusPoint=this.getFocusPoint(),this.resize({width:n,height:e});this.on("ready",(function(){return s.setRatio(i,t)}))}},{key:"onPan",value:function(i){this.isPanning||(this.isPanning=!0,this.arena.addClass(this.panningCssClass),this.outline.addClass(this.outlineCssClass));var t=i.startX-i.dx,e=i.startY-i.dy;this.pan({x:t,y:e})}},{key:"onPanEnd",value:function(){return this.isPanning=!1,this.arena.removeClass(this.panningCssClass),this.outline.removeClass(this.outlineCssClass)}},{key:"onDoubleClick",value:function(i){var t=i.pageX,e=i.pageY,n=this.view[0].getBoundingClientRect(),s=t-n.left,h=e-n.top;this.zoomIn({viewX:s,viewY:h})}},{key:"onResize",value:function(i){var t=i.position,e=i.dx,n=i.dy;this.isResizing||(this.isResizing=!0,this.resizeFocusPoint=this.getFocusPoint()),["top","bottom"].includes(t)?(n*=2,this.resize({width:this.viewWidth,height:this.viewHeight+n,keepDimension:"height"})):["left","right"].includes(t)&&(e*=2,this.resize({width:this.viewWidth+e,height:this.viewHeight,keepDimension:"width"}))}},{key:"onResizeEnd",value:function(){this.isResizing=!1,this.resizeFocusPoint=void 0}},{key:"resize",value:function(i){var t=i.width,e=i.height,n=i.keepDimension;this.setViewDimensions({width:t,height:e,keepDimension:n}),this.resizeFocusPoint&&(this.resizeFocusPoint.viewX=this.viewWidth/2,this.resizeFocusPoint.viewY=this.viewHeight/2),this.zoom({width:this.preview.width,height:this.preview.height,focusPoint:this.resizeFocusPoint})}},{key:"setViewDimensions",value:function(i){var t=i.width,e=i.height,n=i.keepDimension;if(this.maxArea){var s=this.enforceMaxArea({width:t,height:e,keepDimension:n});t=s.width,e=s.height}var h=this.enforceViewDimensions({width:t,height:e,keepDimension:n});if(t=h.width,e=h.height,this.view.css({width:t,height:e}),this.viewWidth=t,this.viewHeight=e,this.viewRatio=t/e,this.minResolution){var o=Math.sqrt(this.minResolution*this.viewRatio),r=Math.sqrt(this.minResolution/this.viewRatio);this.maxImageWidth=this.viewWidth/o*this.imageWidth,this.maxImageHeight=this.viewHeight/r*this.imageHeight}this.fireChange()}},{key:"zoomAllOut",value:function(){this.isWidthRestricting()?this.zoom({width:this.viewWidth}):this.zoom({height:this.viewHeight})}},{key:"zoomIn",value:function(i){null==i&&(i={}),this.isWidthRestricting()?i.width=this.preview.width*this.zoomInStep:i.height=this.preview.height*this.zoomInStep,this.zoom(i)}},{key:"zoomOut",value:function(i){null==i&&(i={}),this.isWidthRestricting()?i.width=this.preview.width*this.zoomOutStep:i.height=this.preview.height*this.zoomOutStep,this.zoom(i)}},{key:"zoom",value:function(i){var t=i.width,e=i.height,n=i.viewX,s=i.viewY,h=i.focusPoint;null==h&&(h=this.getFocusPoint({viewX:n,viewY:s}));var o=this.enforceZoom({width:t,height:e});t=o.width,e=o.height,null!=t?(this.preview.setWidth(t),this.fireChange()):null!=e&&(this.preview.setHeight(e),this.fireChange()),this.focus(h)}},{key:"getFocusPoint",value:function(i){null==i&&(i={});var t=i,e=t.viewX,n=t.viewY;null==e&&(e=this.viewWidth/2),null==n&&(n=this.viewHeight/2);var s=this.preview.x+e,h=this.preview.y+n;return{percentX:s/this.preview.width,percentY:h/this.preview.height,viewX:e,viewY:n}}},{key:"focus",value:function(i){var t=i.percentX,e=i.percentY,n=i.viewX,s=i.viewY,h=this.preview.width*t,o=this.preview.height*e;h-=n,o-=s,this.pan({x:h,y:o})}},{key:"center",value:function(){var i=(this.preview.width-this.viewWidth)/2,t=(this.preview.height-this.viewHeight)/2;this.pan({x:i,y:t})}},{key:"pan",value:function(i){i=this.enforceXy(i),this.preview.pan(i.x,i.y),this.fireChange()}},{key:"enforceXy",value:function(i){var t=i.x,e=i.y;return t>this.preview.width-this.viewWidth&&(t=this.preview.width-this.viewWidth),t<0&&(t=0),e>this.preview.height-this.viewHeight&&(e=this.preview.height-this.viewHeight),e<0&&(e=0),{x:t,y:e}}},{key:"enforceZoom",value:function(i){var t=i.width,e=i.height;return null!=t&&this.maxImageWidth&&t>this.maxImageWidth?{width:this.maxImageWidth}:null!=t&&tthis.maxImageHeight?{height:this.maxImageHeight}:null!=e&&ethis.maxWidth||ethis.maxHeight||nthis.maxViewRatio)}},{key:"isValidRatio",value:function(i){return!(ithis.maxViewRatio)}},{key:"enforceValidRatio",value:function(i){return ithis.maxViewRatio?this.maxViewRatio:i}},{key:"enforceViewDimensions",value:function(i){var t,e,n,s=i.width,h=i.height,o=i.keepDimension;if(sthis.maxWidth&&(e=this.maxWidth),hthis.maxHeight&&(t=this.maxHeight),o){if(e&&(s=e),t&&(h=t),n=s/h,!this.isValidRatio(n)){n=this.enforceValidRatio(n);var r=this.getRatioBox({ratio:n,width:s,height:h,keepDimension:o});if(s=r.width,h=r.height,s>this.arenaWidth||h>this.arenaHeight){var a=this.centerAlign(this.maxWidth,this.maxHeight,n);s=a.width,h=a.height}}}else if(e||t){n=this.enforceValidRatio(s/h);var u=this.centerAlign(this.maxWidth,this.maxHeight,n);s=u.width,h=u.height}return{width:s,height:h}}},{key:"enforceMaxArea",value:function(i){var t=i.width,e=i.height,n=i.keepDimension,s=t/e;return"width"===n?s=t/(e=this.maxArea/t):"height"===n?s=(t=this.maxArea/e)/e:e=(t=Math.sqrt(this.maxArea*s))/s,this.isValidRatio(s)||(s=this.enforceValidRatio(s),e=(t=Math.sqrt(this.maxArea*s))/s),{width:t,height:e}}},{key:"checkRatio",value:function(i){if(this.originalSize){var t=this.originalSize.width/this.originalSize.height,e=i.width/i.height,n=(e-t)/t*100;if(Math.abs(n)>1)throw new Error("srcissors: Displayed image has a different image ratio than the "+"one configured in 'originalRatio': ".concat(t," vs ").concat(e))}}},{key:"isWidthRestricting",value:function(){return this.viewRatio>=this.imageRatio}},{key:"getRatioBox",value:function(i){var t=i.ratio,e=i.width,n=i.height,s=i.keepDimension;return"width"===s||null==n?n=e/t:"height"===s||null==e?e=n*t:n=e/t,{width:e,height:n}}},{key:"centerAlign",value:function(i,t,e){var n,s,h,o;return i/t>e?h=(i-(s=t*e))/2:o=(t-(n=i/e))/2,{x:h||0,y:o||0,width:s||i,height:n||t}}},{key:"min",value:function(i){var t,e=i[0],n=function(i,t){var e="undefined"!=typeof Symbol&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=function(i,t){if(i){if("string"==typeof i)return s(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);return"Object"===e&&i.constructor&&(e=i.constructor.name),"Map"===e||"Set"===e?Array.from(i):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(i,t):void 0}}(i))||t&&i&&"number"==typeof i.length){e&&(i=e);var n=0,h=function(){};return{s:h,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(i){throw i},f:h}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,r=!0,a=!1;return{s:function(){e=e.call(i)},n:function(){var i=e.next();return r=i.done,i},e:function(i){a=!0,o=i},f:function(){try{r||null==e.return||e.return()}finally{if(a)throw o}}}}(i);try{for(n.s();!(t=n.n()).done;){var h=t.value;h{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){for(var e=0;en-t.doubleClickThreshold&&t.parent.onDoubleClick(o(e)),i=n}))}},{key:"preventBrowserDragDrop",value:function(){this.view.on("dragstart.srcissors",(function(){return!1}))}},{key:"resizeView",value:function(i){var t=this,e=i.horizontal,n=i.vertical,s=h("
");s.addClass("resize-handler");var o=[];e&&(o=o.concat(["right","left"])),n&&(o=o.concat(["top","bottom"])),o.forEach((function(i){var e=s.clone();e.addClass("resize-handler-".concat(i)),e.on("mousedown.srcissors touchstart.srcissors",t.getResizeMouseDown(i)),t.view.append(e)}))}},{key:"getResizeMouseDown",value:function(i){var t=this,e=h(document);return function(n){var s=o(n),h=s.pageX,r=s.pageY;n.stopPropagation(),e.on("mousemove.srcissors-resize touchmove.srcissors-resize",(function(e){var n,s,a=o(e),u=a.pageX,c=a.pageY;switch(i){case"top":case"bottom":s=c-r,"top"===i&&(s=-s),r=c;break;case"left":case"right":n=u-h,"left"===i&&(n=-n),h=u}t.parent.onResize({position:i,dx:n,dy:s})})).on("mouseup.srcissors-resize touchend.srcissors-resize",(function(){e.off("mouseup.srcissors-resize touchmove.srcissors-resize"),e.off("mousemove.srcissors-resize touchend.srcissors-resize"),t.parent.onResizeEnd({position:i})}))}}},{key:"responsiveArena",value:function(){}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}()},289:(i,t,e)=>{function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function s(i,t){for(var e=0;e0){var e=h("").css({opacity:this.opacity}).attr("src",t);this.outline.append(e)}}},{key:"reset",value:function(){this.url=void 0,this.x=this.y=0,this.width=this.height=0,this.img.attr("src",""),this.img.css({width:"",height:"",transform:""}),this.outline&&this.outline.css({transform:""}).html("")}},{key:"setWidth",value:function(i){this.img.css({width:"".concat(i,"px"),height:"auto"});var t=i/this.ratio;this.updateImageDimensions({width:i,height:t})}},{key:"setHeight",value:function(i){this.img.css({width:"auto",height:"".concat(i,"px")});var t=i*this.ratio;this.updateImageDimensions({width:t,height:i})}},{key:"updateImageDimensions",value:function(i){var t=i.width,e=i.height;this.width=t,this.height=e,this.outline&&this.outline.css({width:"".concat(this.width,"px"),height:"".concat(this.height,"px")})}},{key:"pan",value:function(i,t){this.x=i,this.y=t;var e=Math.round(this.x),n=Math.round(this.y);this.img.css({transform:"translate(-".concat(e,"px, -").concat(n,"px)")}),this.outline&&this.outline.css({transform:"translate(-".concat(e,"px, -").concat(n,"px)")})}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}()},505:(i,t,e)=>{var n=e(47),s=e(490);i.exports={new:function(i){var t=i.arena,e=i.url,h=i.fixedWidth,o=i.fixedHeight,r=i.minWidth,a=i.minHeight,u=i.minRatio,c=i.maxRatio,l=i.maxArea,g=i.originalSize,v=i.zoomStep,d=i.crop,m=i.actions,p=i.minResolution,f=i.surroundingImageOpacity,w=i.showSurroundingImage,y=(t=n(t)).find(".crop-view"),x=y.find(".crop-preview"),b=n("");x.append(b);var k=y.find(".crop-outline");k.length||(k=void 0);var R={pan:!0,zoomOnDoubleClick:!0,resize:!0,resizeHorizontal:!h,resizeVertical:!o};return n.extend(R,m),null==v&&(v=1.25),null==r&&(r=50),null==a&&(a=50),new s({url:e,crop:d,arena:t,view:y,img:b,outline:k,showSurroundingImage:w,surroundingImageOpacity:f,fixedWidth:h,fixedHeight:o,minViewWidth:r,minViewHeight:a,minViewRatio:u,maxViewRatio:c,maxArea:l,originalSize:g,zoomStep:v,actions:R,minResolution:p})}}},47:t=>{t.exports=i}},e={};return function i(n){var s=e[n];if(void 0!==s)return s.exports;var h=e[n]={exports:{}};return t[n](h,h.exports,i),h.exports}(505)})())); //# sourceMappingURL=srcissors.js.map \ No newline at end of file diff --git a/srcissors.js.map b/srcissors.js.map index cb7b8cb..dec0bda 100644 --- a/srcissors.js.map +++ b/srcissors.js.map @@ -1 +1 @@ -{"version":3,"file":"./srcissors.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,WACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,UAAWJ,GACO,iBAAZC,QACdA,QAAmB,UAAID,EAAQG,QAAQ,WAEvCJ,EAAgB,UAAIC,EAAQD,EAAa,OAC1C,CATD,CASGO,MAAOC,IACV,O,8xBCVA,IAAMC,EAAIL,EAAQ,IACZM,EAAUN,EAAQ,K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EACL4H,mBAAmB,EACnBzJ,QAAQ,EACR4J,kBAAmB7M,EACnB8M,gBAAiB7M,GAUnB,OAPAX,EAAE0Q,OAAOD,EAAgBrP,GAET,MAAZF,IAAoBA,EAAW,MAEnB,MAAZ2I,IAAoBA,EAAW,IAClB,MAAbC,IAAqBA,EAAY,IAE9B,IAAI3J,EAAK,CACdM,IAAAA,EACAQ,KAAAA,EACAZ,MAAAA,EACAC,KAAAA,EACAC,IAAAA,EACAC,QAAAA,EACAe,qBAAAA,EACAD,wBAAAA,EACAZ,WAAAA,EACAC,YAAAA,EACAC,aAAciJ,EACdhJ,cAAeiJ,EACfhJ,aAAcuP,EACdtP,aAAcuP,EACdnP,QAAAA,EACAH,aAAAA,EAGAE,SAAAA,EACAE,QAASqP,EACTpP,cAAAA,GAEJ,E,sBCvDF3B,EAAOD,QAAUM,C,GCCb4Q,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBlJ,IAAjBmJ,EACH,OAAOA,EAAarR,QAGrB,IAAIC,EAASiR,EAAyBE,GAAY,CAGjDpR,QAAS,CAAC,GAOX,OAHAsR,EAAoBF,GAAUnR,EAAQA,EAAOD,QAASmR,GAG/ClR,EAAOD,OACf,CCnB0BmR,CAAoB,K,MDF1CD,C","sources":["webpack://srcissors/webpack/universalModuleDefinition","webpack://srcissors/./src/crop.js","webpack://srcissors/./src/events.js","webpack://srcissors/./src/preview.js","webpack://srcissors/./src/srcissors.js","webpack://srcissors/external umd {\"commonjs\":\"jquery\",\"commonjs2\":\"jquery\",\"amd\":\"jquery\",\"root\":\"jQuery\"}","webpack://srcissors/webpack/bootstrap","webpack://srcissors/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"jquery\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"jquery\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"srcissors\"] = factory(require(\"jquery\"));\n\telse\n\t\troot[\"srcissors\"] = factory(root[\"jQuery\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__47__) => {\nreturn ","const $ = require('jquery')\nconst Preview = require('./preview')\nconst Events = require('./events')\n\nmodule.exports = class Crop {\n constructor ({\n arena, view, img, outline, url, fixedWidth, fixedHeight,\n minViewWidth, minViewHeight, minViewRatio, maxViewRatio, originalSize, crop,\n zoomStep, maxArea, actions, minResolution, surroundingImageOpacity,\n showSurroundingImage\n }) {\n // CSS classes\n this.onPreviewReady = this.onPreviewReady.bind(this)\n this.arena = arena\n this.view = view\n this.img = img\n this.outline = outline\n this.fixedWidth = fixedWidth\n this.fixedHeight = fixedHeight\n this.minViewWidth = minViewWidth\n this.minViewHeight = minViewHeight\n this.minViewRatio = minViewRatio\n this.maxViewRatio = maxViewRatio\n this.originalSize = originalSize\n this.actions = actions\n this.minResolution = minResolution\n this.surroundingImageOpacity = surroundingImageOpacity\n this.loadingCssClass = 'crop-view--is-loading'\n this.panningCssClass = 'crop-view--is-panning'\n this.outlineCssClass = 'crop-outline--active'\n\n // State\n this.isPanning = false\n this.initialCrop = crop\n\n // Events\n this.loadEvent = $.Callbacks()\n this.changeEvent = $.Callbacks()\n\n // Sets up the ready event and state\n this.initializeReadyState()\n\n // Confguration\n this.zoomInStep = zoomStep\n this.zoomOutStep = 1 / this.zoomInStep\n\n this.arenaWidth = this.arena.width()\n this.arenaHeight = this.arena.height()\n\n // todo: consider to calculate maxArea with regards to the\n // maximum space an image can within the area. That should\n // be more reliable.\n if (maxArea) this.maxArea = (this.arenaWidth * this.arenaHeight) * maxArea\n\n if (this.outline) this.setSurroundingImageVisibility(showSurroundingImage)\n\n this.preview = new Preview({\n onReady: this.onPreviewReady,\n img: this.img,\n outline: this.outline,\n opacity: this.surroundingImageOpacity\n })\n\n this.setImage(url)\n }\n\n initializeReadyState () {\n this.isReady = false\n if (this.readyEvent != null) {\n this.readyEvent.empty()\n }\n this.readyEvent = $.Callbacks('memory once')\n }\n\n setImage (url) {\n if (url === this.preview.url) return\n\n if (this.isInitialized) this.preview.reset()\n this.initializeReadyState()\n this.view.addClass(this.loadingCssClass)\n this.preview.setImage({url})\n }\n\n setSurroundingImageVisibility (visibility) {\n // visibility: always|panning|never\n // override opacity in crop-outline--active css class\n this.surroundingImageOpacity = parseFloat(this.surroundingImageOpacity || 0.2)\n\n if (visibility === 'always') {\n this.outline.css('opacity', 1.0)\n } else if (visibility === 'panning') {\n this.outline.css('opacity', null)\n } else { // 'never' default\n this.outline.css('opacity', 0)\n this.surroundingImageOpacity = 0\n }\n }\n\n reset () {\n if (!this.isReady) return\n\n this.resize({width: this.imageWidth, height: this.imageHeight})\n this.zoomAllOut()\n }\n\n onPreviewReady (previewImageSize) {\n this.checkRatio(previewImageSize)\n const {width, height} = this.originalSize || previewImageSize\n\n // console.log(this.originalSize, previewImageSize, {width, height})\n this.preview.updateImageDimensions({width, height})\n\n let keepDimension\n if (!this.isInitialized) {\n this.events = new Events({\n parent: this,\n view: this.view,\n actions: this.actions\n })\n }\n\n this.imageWidth = width\n this.imageHeight = height\n this.imageRatio = this.imageWidth / this.imageHeight\n const imageResolution = this.imageWidth * this.imageHeight\n\n if (this.minResolution && (this.minResolution > imageResolution)) {\n // If the minimal required resolution is bigger than the actual image\n // resolution, we ignore the configuration\n delete this.minResolution\n }\n\n if (this.minResolution) {\n // For any given image resolution with a minimal required resolution\n // we can calculate both, a minimal resolution and a maximal resolution\n const minRatioForResolution = this.minResolution / (this.imageHeight * this.imageHeight)\n if (!this.minViewRatio || (this.minViewRatio < minRatioForResolution)) {\n this.minViewRatio = minRatioForResolution\n }\n const maxRatioForResolution = (this.imageWidth * this.imageWidth) / this.minResolution\n if (!this.maxViewRatio || (this.maxViewRatio > maxRatioForResolution)) {\n this.maxViewRatio = maxRatioForResolution\n }\n }\n\n this.calcMaxMinDimensions()\n\n if (this.fixedWidth) { keepDimension = 'width' }\n if (this.fixedHeight) { keepDimension = 'height' }\n this.setViewDimensions({\n width: this.imageWidth,\n height: this.imageHeight,\n keepDimension\n })\n\n // ready state\n this.isReady = true\n this.view.removeClass(this.loadingCssClass)\n\n if (!this.isInitialized && (this.initialCrop != null)) {\n this.setCrop(this.initialCrop)\n } else {\n this.zoomAllOut()\n this.center()\n }\n\n this.isInitialized = true\n this.readyEvent.fire()\n this.loadEvent.fire()\n }\n\n setCrop ({x, y, width, height}) {\n if (!this.isReady) {\n this.on('ready', () => this.setCrop({x, y, width, height}))\n return\n }\n\n this.resize({width, height})\n\n const factor = this.viewWidth / width\n const previewWidth = this.imageWidth * factor\n\n this.zoom({width: previewWidth})\n this.pan({x: x * factor, y: y * factor})\n }\n\n getCrop () {\n const factor = this.preview.width / this.imageWidth\n const crop = {\n x: this.preview.x / factor,\n y: this.preview.y / factor,\n width: this.viewWidth / factor,\n height: this.viewHeight / factor\n }\n\n this.roundCrop(crop)\n this.validateCrop(crop)\n return crop\n }\n\n roundCrop (crop) {\n for (const name in crop) {\n const value = crop[name]\n crop[name] = Math.round(value)\n }\n }\n\n validateCrop (crop) {\n const {x, y, width, height} = crop\n if (x < 0) crop.x = 0\n if (y < 0) crop.y = 0\n\n if ((x + width) > this.imageWidth) {\n crop.width = this.imageWidth - x\n }\n\n if ((y + height) > this.imageHeight) {\n crop.height = this.imageHeight - y\n }\n\n return crop\n }\n\n setRatio (ratio, keepDimension) {\n let height, width\n if (!this.isReady) {\n this.on('ready', () => this.setRatio(ratio, keepDimension))\n return\n }\n\n ratio = this.enforceValidRatio(ratio)\n\n if (keepDimension === 'height') {\n height = this.viewHeight\n width = height * ratio\n } else {\n width = this.viewWidth\n height = width / ratio\n }\n\n this.resizeFocusPoint = this.getFocusPoint()\n return this.resize({width, height})\n }\n\n // Event handling\n // --------------\n\n onPan (data) {\n if (!this.isPanning) {\n this.isPanning = true\n this.arena.addClass(this.panningCssClass)\n this.outline.addClass(this.outlineCssClass)\n }\n\n const newX = data.startX - data.dx\n const newY = data.startY - data.dy\n this.pan({x: newX, y: newY})\n }\n\n onPanEnd () {\n this.isPanning = false\n this.arena.removeClass(this.panningCssClass)\n return this.outline.removeClass(this.outlineCssClass)\n }\n\n onDoubleClick ({pageX, pageY}) {\n const {left, top} = this.view[0].getBoundingClientRect()\n const viewX = pageX - left\n const viewY = pageY - top\n this.zoomIn({viewX, viewY})\n }\n\n onResize ({position, dx, dy}) {\n if (!this.isResizing) {\n this.isResizing = true\n this.resizeFocusPoint = this.getFocusPoint()\n }\n\n if (['top', 'bottom'].includes(position)) {\n dy = 2 * dy // Because it's centered we need to change width by factor two\n this.resize({width: this.viewWidth, height: this.viewHeight + dy, keepDimension: 'height'})\n } else if (['left', 'right'].includes(position)) {\n dx = 2 * dx\n this.resize({width: this.viewWidth + dx, height: this.viewHeight, keepDimension: 'width'})\n }\n }\n\n onResizeEnd () {\n this.isResizing = false\n this.resizeFocusPoint = undefined\n }\n\n resize ({width, height, keepDimension}) {\n this.setViewDimensions({width, height, keepDimension})\n\n // Update view center of focus point\n if (this.resizeFocusPoint) {\n this.resizeFocusPoint.viewX = this.viewWidth / 2\n this.resizeFocusPoint.viewY = this.viewHeight / 2\n }\n\n // Ensure dimensions and focus\n this.zoom({\n width: this.preview.width,\n height: this.preview.height,\n focusPoint: this.resizeFocusPoint\n })\n }\n\n setViewDimensions ({width, height, keepDimension}) {\n if (this.maxArea) {\n ({width, height} = this.enforceMaxArea({width, height, keepDimension}))\n }\n\n ({width, height} = this.enforceViewDimensions({width, height, keepDimension}))\n\n this.view.css({width, height})\n this.viewWidth = width\n this.viewHeight = height\n this.viewRatio = width / height\n\n if (this.minResolution) {\n const minZoomPixelWidth = Math.sqrt(this.minResolution * this.viewRatio)\n const minZoomPixelHeight = Math.sqrt(this.minResolution / this.viewRatio)\n this.maxImageWidth = (this.viewWidth / minZoomPixelWidth) * this.imageWidth\n this.maxImageHeight = (this.viewHeight / minZoomPixelHeight) * this.imageHeight\n }\n\n this.fireChange()\n }\n\n // Update view\n // -----------\n\n zoomAllOut () {\n if (this.isWidthRestricting()) {\n this.zoom({width: this.viewWidth})\n } else {\n this.zoom({height: this.viewHeight})\n }\n }\n\n zoomIn (params) {\n if (params == null) { params = {} }\n if (this.isWidthRestricting()) {\n params.width = this.preview.width * this.zoomInStep\n } else {\n params.height = this.preview.height * this.zoomInStep\n }\n\n this.zoom(params)\n }\n\n zoomOut (params) {\n if (params == null) { params = {} }\n if (this.isWidthRestricting()) {\n params.width = this.preview.width * this.zoomOutStep\n } else {\n params.height = this.preview.height * this.zoomOutStep\n }\n\n this.zoom(params)\n }\n\n zoom ({width, height, viewX, viewY, focusPoint}) {\n if (focusPoint == null) { focusPoint = this.getFocusPoint({viewX, viewY}) }\n\n ({width, height} = this.enforceZoom({width, height}))\n if (width != null) {\n this.preview.setWidth(width)\n this.fireChange()\n } else if (height != null) {\n this.preview.setHeight(height)\n this.fireChange()\n }\n\n this.focus(focusPoint)\n }\n\n // returns {Object} e.g. percentX: 0.2, percentY: 0.5\n getFocusPoint (param) {\n if (param == null) { param = {} }\n let {viewX, viewY} = param\n if (viewX == null) { viewX = this.viewWidth / 2 }\n if (viewY == null) { viewY = this.viewHeight / 2 }\n const x = this.preview.x + viewX\n const y = this.preview.y + viewY\n const percentX = x / this.preview.width\n const percentY = y / this.preview.height\n return {percentX, percentY, viewX, viewY}\n }\n\n focus ({percentX, percentY, viewX, viewY}) {\n let x = this.preview.width * percentX\n let y = this.preview.height * percentY\n x = x - viewX\n y = y - viewY\n\n this.pan({x, y})\n }\n\n center () {\n const newX = (this.preview.width - this.viewWidth) / 2\n const newY = (this.preview.height - this.viewHeight) / 2\n this.pan({x: newX, y: newY})\n }\n\n // @param { Object }\n // - x {Number} pixel to pan to the left\n // - y {Number} pixels to pan to the top\n pan (data) {\n data = this.enforceXy(data)\n this.preview.pan(data.x, data.y)\n this.fireChange()\n }\n\n // Validations\n // -----------\n\n enforceXy ({x, y}) {\n if (x > (this.preview.width - this.viewWidth)) {\n x = this.preview.width - this.viewWidth\n }\n\n if (x < 0) x = 0\n\n\n if (y > (this.preview.height - this.viewHeight)) {\n y = this.preview.height - this.viewHeight\n }\n\n if (y < 0) y = 0\n\n return {x, y}\n }\n\n enforceZoom ({width, height}) {\n\n if ((width != null) && this.maxImageWidth && (width > this.maxImageWidth)) {\n // prevent zooming in past the required resolution defined by minResolution\n return {width: this.maxImageWidth}\n }\n\n if ((width != null) && (width < this.viewWidth)) {\n // prevent zooming out past covering the view completely\n return {width: this.viewWidth}\n }\n\n if ((height != null) && this.maxImageHeight && (height > this.maxImageHeight)) {\n // prevent zooming in past the required resolution defined by minResolution\n return {height: this.maxImageHeight}\n }\n\n if ((height != null) && (height < this.viewHeight)) {\n // prevent zooming out past covering the view completely\n return {height: this.viewHeight}\n }\n\n return {width, height}\n }\n\n calcMaxMinDimensions () {\n this.maxWidth = this.min([this.arenaWidth, this.imageWidth])\n this.maxHeight = this.min([this.arenaHeight, this.imageHeight])\n this.minWidth = this.minViewWidth || 0\n this.minHeight = this.minViewHeight || 0\n\n if (this.fixedWidth) this.maxWidth = (this.minWidth = this.fixedWidth)\n if (this.fixedHeight) this.maxHeight = (this.minHeight = this.fixedHeight)\n }\n\n areDimensionsValid ({width, height, keepDimension}) {\n const ratio = width / height\n\n const invalid =\n (width < this.minWidth) ||\n (width > this.maxWidth) ||\n (height < this.minHeight) ||\n (height > this.maxHeight) ||\n (ratio < this.minViewRatio) ||\n (ratio > this.maxViewRatio)\n\n return !invalid\n }\n\n isValidRatio (ratio) {\n return !((ratio < this.minViewRatio) || (ratio > this.maxViewRatio))\n }\n\n enforceValidRatio (ratio) {\n if (ratio < this.minViewRatio) return this.minViewRatio\n if (ratio > this.maxViewRatio) return this.maxViewRatio\n return ratio\n }\n\n enforceViewDimensions ({width, height, keepDimension}) {\n let newHeight, newWidth, ratio\n if (width < this.minWidth) newWidth = this.minWidth\n if (width > this.maxWidth) newWidth = this.maxWidth\n if (height < this.minHeight) newHeight = this.minHeight\n if (height > this.maxHeight) newHeight = this.maxHeight\n\n if (keepDimension) {\n if (newWidth) width = newWidth\n if (newHeight) height = newHeight\n\n // check max/min ratios\n ratio = width / height\n if (!this.isValidRatio(ratio)) {\n ratio = this.enforceValidRatio(ratio);\n ({width, height} = this.getRatioBox({ratio, width, height, keepDimension}))\n if ((width > this.arenaWidth) || (height > this.arenaHeight)) {\n ({width, height} = this.centerAlign(this.maxWidth, this.maxHeight, ratio))\n }\n }\n\n } else if (newWidth || newHeight) {\n ratio = this.enforceValidRatio(width / height);\n ({width, height} = this.centerAlign(this.maxWidth, this.maxHeight, ratio))\n }\n\n return {width, height}\n }\n\n enforceMaxArea ({width, height, keepDimension}) {\n let ratio = width / height\n\n if (keepDimension === 'width') {\n height = this.maxArea / width\n ratio = width / height\n } else if (keepDimension === 'height') {\n width = this.maxArea / height\n ratio = width / height\n } else { // keep ratio\n width = Math.sqrt(this.maxArea * ratio)\n height = width / ratio\n }\n\n if (!this.isValidRatio(ratio)) {\n ratio = this.enforceValidRatio(ratio)\n width = Math.sqrt(this.maxArea * ratio)\n height = width / ratio\n }\n\n return {width, height}\n }\n\n checkRatio (previewImageSize) {\n if (this.originalSize) {\n const expectedRatio = this.originalSize.width / this.originalSize.height\n const actualRatio = previewImageSize.width / previewImageSize.height\n const percentageChange = ((actualRatio - expectedRatio) / expectedRatio) * 100\n if (Math.abs(percentageChange) > 1) {\n throw new Error(`srcissors: Displayed image has a different image ratio than the ` +\n `one configured in 'originalRatio': ${expectedRatio} vs ${actualRatio}`)\n }\n }\n }\n\n // Calculations\n // ------------\n //\n // Ratio: width / height\n // Tall < 1 (Square) < Wide\n // (A ratio less than one is a tall image format and\n // a ratio greater than one is a wide image format)\n\n // Check if the width or height is restricting\n isWidthRestricting () {\n return this.viewRatio >= this.imageRatio\n }\n\n getRatioBox ({ratio, width, height, keepDimension}) {\n if ((keepDimension === 'width') || (height == null)) {\n height = width / ratio\n } else if ((keepDimension === 'height') || (width == null)) {\n width = height * ratio\n } else {\n height = width / ratio\n }\n\n return {width, height}\n }\n\n centerAlign (areaWidth, areaHeight, ratio) {\n let height, width, x, y\n if ((areaWidth / areaHeight) > ratio) {\n width = areaHeight * ratio\n x = (areaWidth - width) / 2\n } else {\n height = areaWidth / ratio\n y = (areaHeight - height) / 2\n }\n\n // return\n return {\n x: x || 0,\n y: y || 0,\n width: width || areaWidth,\n height: height || areaHeight\n }\n }\n\n min (array) {\n let min = array[0]\n for (const number of array) {\n if (number < min) min = number\n }\n\n return min\n }\n\n // Events\n // ------\n\n on (name, callback) {\n return this[`${name}Event`].add(callback)\n }\n\n off (name, callback) {\n return this[`${name}Event`].remove(callback)\n }\n\n // Debounce change events so they are not fired more\n // than once per tick.\n fireChange () {\n if (this.changeDispatch != null) return\n\n this.changeDispatch = setTimeout(() => {\n this.changeDispatch = undefined\n this.changeEvent.fire(this.getCrop())\n }, 0)\n }\n\n // Development helpers\n // -------------------\n\n debug () {\n const r = num => Math.round(num * 10) / 10\n\n const obj = {\n arena: `${r(this.arenaWidth)}x${r(this.arenaHeight)}`,\n view: `${r(this.viewWidth)}x${r(this.viewHeight)}`,\n image: `${r(this.imageWidth)}x${r(this.imageHeight)}`,\n preview: `${r(this.preview.width)}x${r(this.preview.height)}`,\n previewXy: `${r(this.preview.x)}x${r(this.preview.y)}`\n }\n\n console.log(obj) // eslint-disable-line no-console\n return obj\n }\n}\n","const $ = require('jquery')\n\nconst getPageCoordinates = function (event) {\n if (event.type.includes('touch')) {\n return {\n pageX: event.originalEvent.changedTouches[0].pageX,\n pageY: event.originalEvent.changedTouches[0].pageY\n }\n }\n return {pageX: event.pageX, pageY: event.pageY}\n}\n\nmodule.exports = class Events {\n constructor ({parent, view, horizontal, vertical, actions}) {\n this.parent = parent\n this.view = view\n this.doubleClickThreshold = 300\n\n // setup events\n if (actions.pan) { this.pan() }\n if (actions.zoomOnDoubleClick) { this.doubleClick() }\n if (actions.resize) {\n this.resizeView({\n horizontal: actions.resizeHorizontal,\n vertical: actions.resizeVertical\n })\n }\n\n this.preventBrowserDragDrop()\n this.responsiveArena()\n }\n\n pan () {\n const $doc = $(document)\n this.view.on('mousedown.srcissors touchstart.srcissors', (e1) => {\n const panData = {\n startX: this.parent.preview.x,\n startY: this.parent.preview.y\n }\n\n e1.preventDefault()\n $doc.on('mousemove.srcissors-pan touchmove.srcissors-pan', (e2) => {\n const {pageX, pageY} = getPageCoordinates(e2)\n const {pageX: prevPageX, pageY: prevPageY} = getPageCoordinates(e1)\n panData.dx = pageX - prevPageX\n panData.dy = pageY - prevPageY\n this.parent.onPan(panData)\n }).on('mouseup.srcissors-pan touchend.srcissors-pan', () => {\n $doc.off('mouseup.srcissors-pan touchend.srcissors-pan')\n $doc.off('mousemove.srcissors-pan touchmove.srcissors-pan')\n\n // only trigger panEnd if pan has been called\n if (panData.dx != null) this.parent.onPanEnd()\n })\n })\n }\n\n doubleClick () {\n let lastClick\n\n this.view.on('mousedown.srcissors touchstart.srcissors', event => {\n const now = new Date().getTime()\n if (lastClick && (lastClick > (now - this.doubleClickThreshold))) {\n this.parent.onDoubleClick(getPageCoordinates(event))\n }\n lastClick = now\n })\n }\n\n preventBrowserDragDrop () {\n this.view.on('dragstart.srcissors', () => false)\n }\n\n // Resize View\n // -----------\n\n resizeView ({horizontal, vertical}) {\n const $template = $('
')\n $template.addClass('resize-handler')\n\n let positions = []\n if (horizontal) positions = positions.concat(['right', 'left'])\n if (vertical) positions = positions.concat(['top', 'bottom'])\n\n positions.forEach(position => {\n const $handler = $template.clone()\n $handler.addClass(`resize-handler-${position}`)\n $handler.on('mousedown.srcissors touchstart.srcissors', this.getResizeMouseDown(position))\n\n this.view.append($handler)\n })\n }\n\n getResizeMouseDown (position) {\n const $doc = $(document)\n\n return (event) => {\n let {pageX: lastX, pageY: lastY} = getPageCoordinates(event)\n event.stopPropagation()\n\n $doc.on('mousemove.srcissors-resize touchmove.srcissors-resize', e2 => {\n let dx, dy\n const {pageX, pageY} = getPageCoordinates(e2)\n switch (position) {\n case 'top': case 'bottom':\n dy = pageY - lastY\n if (position === 'top') { dy = -dy }\n lastY = pageY\n break\n case 'left': case 'right':\n dx = pageX - lastX\n if (position === 'left') { dx = -dx }\n lastX = pageX\n break\n }\n\n this.parent.onResize({position, dx, dy})\n }).on('mouseup.srcissors-resize touchend.srcissors-resize', () => {\n $doc.off('mouseup.srcissors-resize touchmove.srcissors-resize')\n $doc.off('mousemove.srcissors-resize touchend.srcissors-resize')\n\n // only trigger panEnd if pan has been called\n this.parent.onResizeEnd({position})\n })\n }\n }\n\n responsiveArena () {}\n}\n\n// $(window).on('resize', (event) => console.log 'on window resize')\n","const $ = require('jquery')\n\nmodule.exports = class Preview {\n\n constructor ({onReady, img, opacity, outline}) {\n this.onReady = onReady\n this.img = img\n this.opacity = opacity\n this.outline = outline\n this.x = (this.y = 0)\n this.width = (this.height = 0)\n\n this.img.on('load', () => {\n const width = this.img.width()\n const height = this.img.height()\n this.ratio = width / height\n\n this.onReady({width, height})\n this.img.show()\n })\n }\n\n setImage ({url}) {\n this.url = url\n this.img.attr('src', this.url)\n if (this.outline) this.setBackgroundImage({url: this.url})\n }\n\n setBackgroundImage ({url}) {\n if (this.opacity > 0) {\n const bgImg = $('').css({opacity: this.opacity}).attr('src', url)\n this.outline.append(bgImg)\n }\n }\n\n reset () {\n this.url = undefined\n this.x = (this.y = 0)\n this.width = (this.height = 0)\n this.img.attr('src', '')\n this.img.css({width: '', height: '', transform: ''})\n if (this.outline) this.outline.css({transform: ''}).html('')\n }\n\n setWidth (width) {\n this.img.css({width: `${width}px`, height: 'auto'})\n const height = width / this.ratio\n this.updateImageDimensions({width, height})\n }\n\n setHeight (height) {\n this.img.css({width: 'auto', height: `${height}px`})\n const width = height * this.ratio\n this.updateImageDimensions({width, height})\n }\n\n updateImageDimensions ({width, height}) {\n this.width = width\n this.height = height\n if (this.outline) this.outline.css({width: `${this.width}px`, height: `${this.height}px`})\n }\n\n pan (x1, y1) {\n // Without rounding some numbers would not be set to css.\n // e.g: '-5.14957320384e-14'\n this.x = x1\n this.y = y1\n const x = Math.round(this.x)\n const y = Math.round(this.y)\n this.img.css({transform: `translate(-${x}px, -${y}px)`})\n if (this.outline) this.outline.css({transform: `translate(-${x}px, -${y}px)`})\n }\n}\n\n","const $ = require('jquery')\nconst Crop = require('./crop')\n\nmodule.exports = {\n new ({\n arena, url, fixedWidth, fixedHeight, minWidth, minHeight,\n minRatio, maxRatio, maxArea, originalSize, zoomStep, crop, actions, minResolution,\n surroundingImageOpacity, showSurroundingImage\n }) {\n arena = $(arena)\n const view = arena.find('.crop-view')\n const preview = view.find('.crop-preview')\n const img = $('')\n preview.append(img)\n let outline = view.find('.crop-outline')\n if (!outline.length) { outline = undefined }\n\n const allowedActions = {\n pan: true,\n zoomOnDoubleClick: true,\n resize: true,\n resizeHorizontal: !fixedWidth,\n resizeVertical: !fixedHeight\n }\n\n $.extend(allowedActions, actions)\n\n if (zoomStep == null) { zoomStep = 1.25 }\n\n if (minWidth == null) { minWidth = 50 }\n if (minHeight == null) { minHeight = 50 }\n\n return new Crop({\n url, // {String}\n crop, // {Object} Set an inital crop. This is the same as calling setCrop()\n arena, // {jQuery Element}\n view, // {jQuery Element}\n img, // {jQuery Element}\n outline, // {jQuery Element or undefined}\n showSurroundingImage, // {String} always|panning|never\n surroundingImageOpacity, // {Number} e.g. in the 0.0 - 1.0 range\n fixedWidth, // {Number} e.g. 300\n fixedHeight, // {Number} e.g. 500\n minViewWidth: minWidth, // {Number} e.g. 100\n minViewHeight: minHeight, // {Number} e.g. 100\n minViewRatio: minRatio, // {Number} e.g. 1.5/2\n maxViewRatio: maxRatio, // {Number} e.g. 2/1\n maxArea, // {Number} 0.8 -> max 80% of arena area are covered by the preview\n originalSize, // {Object} Original image size, can be used to display a downscaled\n // version of the image in the cropping interface, but use the original\n // size for crop attributes; e.g. {width: 4000, height: 3000}\n zoomStep, // {Number} e.g. 1.25 -> 125%\n actions: allowedActions,\n minResolution\n })\n }\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__47__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(505);\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__47__","$","Preview","Events","Crop","_ref","arena","view","img","outline","url","fixedWidth","fixedHeight","minViewWidth","minViewHeight","minViewRatio","maxViewRatio","originalSize","crop","zoomStep","maxArea","actions","minResolution","surroundingImageOpacity","showSurroundingImage","_classCallCheck","this","onPreviewReady","bind","loadingCssClass","panningCssClass","outlineCssClass","isPanning","initialCrop","loadEvent","Callbacks","changeEvent","initializeReadyState","zoomInStep","zoomOutStep","arenaWidth","width","arenaHeight","height","setSurroundingImageVisibility","preview","onReady","opacity","setImage","key","value","isReady","readyEvent","empty","isInitialized","reset","addClass","visibility","parseFloat","css","resize","imageWidth","imageHeight","zoomAllOut","previewImageSize","checkRatio","keepDimension","_ref2","updateImageDimensions","events","parent","imageRatio","imageResolution","minRatioForResolution","maxRatioForResolution","calcMaxMinDimensions","setViewDimensions","removeClass","center","setCrop","fire","_ref3","_this","x","y","factor","viewWidth","previewWidth","zoom","pan","on","viewHeight","roundCrop","validateCrop","name","Math","round","ratio","_this2","enforceValidRatio","resizeFocusPoint","getFocusPoint","setRatio","data","newX","startX","dx","newY","startY","dy","_ref4","pageX","pageY","_this$view$0$getBound","getBoundingClientRect","viewX","left","viewY","top","zoomIn","_ref5","position","isResizing","includes","undefined","_ref6","focusPoint","_ref7","_this$enforceMaxArea","enforceMaxArea","_this$enforceViewDime","enforceViewDimensions","viewRatio","minZoomPixelWidth","sqrt","minZoomPixelHeight","maxImageWidth","maxImageHeight","fireChange","isWidthRestricting","params","_ref8","_this$enforceZoom","enforceZoom","setWidth","setHeight","focus","param","_param","percentX","percentY","_ref9","enforceXy","_ref10","_ref11","maxWidth","min","maxHeight","minWidth","minHeight","_ref12","_ref13","newHeight","newWidth","isValidRatio","_this$getRatioBox","getRatioBox","_this$centerAlign","centerAlign","_this$centerAlign2","_ref14","expectedRatio","actualRatio","percentageChange","abs","Error","concat","_ref15","areaWidth","areaHeight","array","_step","_iterator","_createForOfIteratorHelper","s","n","done","number","err","e","f","callback","add","remove","_this3","changeDispatch","setTimeout","getCrop","r","num","obj","image","previewXy","console","log","getPageCoordinates","event","type","originalEvent","changedTouches","horizontal","vertical","doubleClickThreshold","zoomOnDoubleClick","doubleClick","resizeView","resizeHorizontal","resizeVertical","preventBrowserDragDrop","responsiveArena","$doc","document","e1","panData","preventDefault","e2","_getPageCoordinates","_getPageCoordinates2","prevPageX","prevPageY","onPan","off","onPanEnd","lastClick","now","Date","getTime","onDoubleClick","$template","positions","forEach","$handler","clone","getResizeMouseDown","append","_this4","_getPageCoordinates3","lastX","lastY","stopPropagation","_getPageCoordinates4","onResize","onResizeEnd","show","attr","setBackgroundImage","bgImg","transform","html","x1","y1","new","minRatio","maxRatio","find","length","allowedActions","extend","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"./srcissors.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,WACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,UAAWJ,GACO,iBAAZC,QACdA,QAAmB,UAAID,EAAQG,QAAQ,WAEvCJ,EAAgB,UAAIC,EAAQ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BpS,IAAjBqS,EACH,OAAOA,EAAavU,QAGrB,IAAIC,EAASmU,EAAyBE,GAAY,CAGjDtU,QAAS,CAAC,GAOX,OAHAwU,EAAoBF,GAAUrU,EAAQA,EAAOD,QAASqU,GAG/CpU,EAAOD,OACf,CCnB0BqU,CAAoB,I","sources":["webpack://srcissors/webpack/universalModuleDefinition","webpack://srcissors/./src/crop.js","webpack://srcissors/./src/events.js","webpack://srcissors/./src/preview.js","webpack://srcissors/./src/srcissors.js","webpack://srcissors/external umd {\"commonjs\":\"jquery\",\"commonjs2\":\"jquery\",\"amd\":\"jquery\",\"root\":\"jQuery\"}","webpack://srcissors/webpack/bootstrap","webpack://srcissors/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"jquery\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"jquery\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"srcissors\"] = factory(require(\"jquery\"));\n\telse\n\t\troot[\"srcissors\"] = factory(root[\"jQuery\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__47__) => {\nreturn ","'use strict'\nconst $ = require('jquery')\nconst Preview = require('./preview')\nconst Events = require('./events')\n\nmodule.exports = class Crop {\n constructor ({\n arena, view, img, outline, url, fixedWidth, fixedHeight,\n minViewWidth, minViewHeight, minViewRatio, maxViewRatio, originalSize, crop,\n zoomStep, maxArea, actions, minResolution, surroundingImageOpacity,\n showSurroundingImage\n }) {\n // CSS classes\n this.onPreviewReady = this.onPreviewReady.bind(this)\n this.arena = arena\n this.view = view\n this.img = img\n this.outline = outline\n this.fixedWidth = fixedWidth\n this.fixedHeight = fixedHeight\n this.minViewWidth = minViewWidth\n this.minViewHeight = minViewHeight\n this.minViewRatio = minViewRatio\n this.maxViewRatio = maxViewRatio\n this.originalSize = originalSize\n this.actions = actions\n this.minResolution = minResolution\n this.surroundingImageOpacity = surroundingImageOpacity\n this.loadingCssClass = 'crop-view--is-loading'\n this.panningCssClass = 'crop-view--is-panning'\n this.outlineCssClass = 'crop-outline--active'\n\n // State\n this.isPanning = false\n this.initialCrop = crop\n\n // Events\n this.loadEvent = $.Callbacks()\n this.changeEvent = $.Callbacks()\n\n // Sets up the ready event and state\n this.initializeReadyState()\n\n // Confguration\n this.zoomInStep = zoomStep\n this.zoomOutStep = 1 / this.zoomInStep\n\n this.arenaWidth = this.arena.width()\n this.arenaHeight = this.arena.height()\n\n // todo: consider to calculate maxArea with regards to the\n // maximum space an image can within the area. That should\n // be more reliable.\n if (maxArea) this.maxArea = (this.arenaWidth * this.arenaHeight) * maxArea\n\n if (this.outline) this.setSurroundingImageVisibility(showSurroundingImage)\n\n this.preview = new Preview({\n onReady: this.onPreviewReady,\n img: this.img,\n outline: this.outline,\n opacity: this.surroundingImageOpacity\n })\n\n this.setImage(url)\n }\n\n initializeReadyState () {\n this.isReady = false\n if (this.readyEvent != null) {\n this.readyEvent.empty()\n }\n this.readyEvent = $.Callbacks('memory once')\n }\n\n setImage (url) {\n if (url === this.preview.url) return\n\n if (this.isInitialized) this.preview.reset()\n this.initializeReadyState()\n this.view.addClass(this.loadingCssClass)\n this.preview.setImage({url})\n }\n\n setSurroundingImageVisibility (visibility) {\n // visibility: always|panning|never\n // override opacity in crop-outline--active css class\n this.surroundingImageOpacity = parseFloat(this.surroundingImageOpacity || 0.2)\n\n if (visibility === 'always') {\n this.outline.css('opacity', 1.0)\n } else if (visibility === 'panning') {\n this.outline.css('opacity', null)\n } else { // 'never' default\n this.outline.css('opacity', 0)\n this.surroundingImageOpacity = 0\n }\n }\n\n reset () {\n if (!this.isReady) return\n\n this.resize({width: this.imageWidth, height: this.imageHeight})\n this.zoomAllOut()\n }\n\n onPreviewReady (previewImageSize) {\n this.checkRatio(previewImageSize)\n const {width, height} = this.originalSize || previewImageSize\n\n // console.log(this.originalSize, previewImageSize, {width, height})\n this.preview.updateImageDimensions({width, height})\n\n let keepDimension\n if (!this.isInitialized) {\n this.events = new Events({\n parent: this,\n view: this.view,\n actions: this.actions\n })\n }\n\n this.imageWidth = width\n this.imageHeight = height\n this.imageRatio = this.imageWidth / this.imageHeight\n const imageResolution = this.imageWidth * this.imageHeight\n\n if (this.minResolution && (this.minResolution > imageResolution)) {\n // If the minimal required resolution is bigger than the actual image\n // resolution, we ignore the configuration\n delete this.minResolution\n }\n\n if (this.minResolution) {\n // For any given image resolution with a minimal required resolution\n // we can calculate both, a minimal resolution and a maximal resolution\n const minRatioForResolution = this.minResolution / (this.imageHeight * this.imageHeight)\n if (!this.minViewRatio || (this.minViewRatio < minRatioForResolution)) {\n this.minViewRatio = minRatioForResolution\n }\n const maxRatioForResolution = (this.imageWidth * this.imageWidth) / this.minResolution\n if (!this.maxViewRatio || (this.maxViewRatio > maxRatioForResolution)) {\n this.maxViewRatio = maxRatioForResolution\n }\n }\n\n this.calcMaxMinDimensions()\n\n if (this.fixedWidth) { keepDimension = 'width' }\n if (this.fixedHeight) { keepDimension = 'height' }\n this.setViewDimensions({\n width: this.imageWidth,\n height: this.imageHeight,\n keepDimension\n })\n\n // ready state\n this.isReady = true\n this.view.removeClass(this.loadingCssClass)\n\n if (!this.isInitialized && (this.initialCrop != null)) {\n this.setCrop(this.initialCrop)\n } else {\n this.zoomAllOut()\n this.center()\n }\n\n this.isInitialized = true\n this.readyEvent.fire()\n this.loadEvent.fire()\n }\n\n setCrop ({x, y, width, height}) {\n if (!this.isReady) {\n this.on('ready', () => this.setCrop({x, y, width, height}))\n return\n }\n\n this.resize({width, height})\n\n const factor = this.viewWidth / width\n const previewWidth = this.imageWidth * factor\n\n this.zoom({width: previewWidth})\n this.pan({x: x * factor, y: y * factor})\n }\n\n getCrop () {\n const factor = this.preview.width / this.imageWidth\n const crop = {\n x: this.preview.x / factor,\n y: this.preview.y / factor,\n width: this.viewWidth / factor,\n height: this.viewHeight / factor\n }\n\n this.roundCrop(crop)\n this.validateCrop(crop)\n return crop\n }\n\n roundCrop (crop) {\n for (const name in crop) {\n const value = crop[name]\n crop[name] = Math.round(value)\n }\n }\n\n validateCrop (crop) {\n const {x, y, width, height} = crop\n if (x < 0) crop.x = 0\n if (y < 0) crop.y = 0\n\n if ((x + width) > this.imageWidth) {\n crop.width = this.imageWidth - x\n }\n\n if ((y + height) > this.imageHeight) {\n crop.height = this.imageHeight - y\n }\n\n return crop\n }\n\n setRatio (ratio, keepDimension) {\n let height, width\n if (!this.isReady) {\n this.on('ready', () => this.setRatio(ratio, keepDimension))\n return\n }\n\n ratio = this.enforceValidRatio(ratio)\n\n if (keepDimension === 'height') {\n height = this.viewHeight\n width = height * ratio\n } else {\n width = this.viewWidth\n height = width / ratio\n }\n\n this.resizeFocusPoint = this.getFocusPoint()\n return this.resize({width, height})\n }\n\n // Event handling\n // --------------\n\n onPan (data) {\n if (!this.isPanning) {\n this.isPanning = true\n this.arena.addClass(this.panningCssClass)\n this.outline.addClass(this.outlineCssClass)\n }\n\n const newX = data.startX - data.dx\n const newY = data.startY - data.dy\n this.pan({x: newX, y: newY})\n }\n\n onPanEnd () {\n this.isPanning = false\n this.arena.removeClass(this.panningCssClass)\n return this.outline.removeClass(this.outlineCssClass)\n }\n\n onDoubleClick ({pageX, pageY}) {\n const {left, top} = this.view[0].getBoundingClientRect()\n const viewX = pageX - left\n const viewY = pageY - top\n this.zoomIn({viewX, viewY})\n }\n\n onResize ({position, dx, dy}) {\n if (!this.isResizing) {\n this.isResizing = true\n this.resizeFocusPoint = this.getFocusPoint()\n }\n\n if (['top', 'bottom'].includes(position)) {\n dy = 2 * dy // Because it's centered we need to change width by factor two\n this.resize({width: this.viewWidth, height: this.viewHeight + dy, keepDimension: 'height'})\n } else if (['left', 'right'].includes(position)) {\n dx = 2 * dx\n this.resize({width: this.viewWidth + dx, height: this.viewHeight, keepDimension: 'width'})\n }\n }\n\n onResizeEnd () {\n this.isResizing = false\n this.resizeFocusPoint = undefined\n }\n\n resize ({width, height, keepDimension}) {\n this.setViewDimensions({width, height, keepDimension})\n\n // Update view center of focus point\n if (this.resizeFocusPoint) {\n this.resizeFocusPoint.viewX = this.viewWidth / 2\n this.resizeFocusPoint.viewY = this.viewHeight / 2\n }\n\n // Ensure dimensions and focus\n this.zoom({\n width: this.preview.width,\n height: this.preview.height,\n focusPoint: this.resizeFocusPoint\n })\n }\n\n setViewDimensions ({width, height, keepDimension}) {\n if (this.maxArea) {\n ({width, height} = this.enforceMaxArea({width, height, keepDimension}))\n }\n\n ({width, height} = this.enforceViewDimensions({width, height, keepDimension}))\n\n this.view.css({width, height})\n this.viewWidth = width\n this.viewHeight = height\n this.viewRatio = width / height\n\n if (this.minResolution) {\n const minZoomPixelWidth = Math.sqrt(this.minResolution * this.viewRatio)\n const minZoomPixelHeight = Math.sqrt(this.minResolution / this.viewRatio)\n this.maxImageWidth = (this.viewWidth / minZoomPixelWidth) * this.imageWidth\n this.maxImageHeight = (this.viewHeight / minZoomPixelHeight) * this.imageHeight\n }\n\n this.fireChange()\n }\n\n // Update view\n // -----------\n\n zoomAllOut () {\n if (this.isWidthRestricting()) {\n this.zoom({width: this.viewWidth})\n } else {\n this.zoom({height: this.viewHeight})\n }\n }\n\n zoomIn (params) {\n if (params == null) { params = {} }\n if (this.isWidthRestricting()) {\n params.width = this.preview.width * this.zoomInStep\n } else {\n params.height = this.preview.height * this.zoomInStep\n }\n\n this.zoom(params)\n }\n\n zoomOut (params) {\n if (params == null) { params = {} }\n if (this.isWidthRestricting()) {\n params.width = this.preview.width * this.zoomOutStep\n } else {\n params.height = this.preview.height * this.zoomOutStep\n }\n\n this.zoom(params)\n }\n\n zoom ({width, height, viewX, viewY, focusPoint}) {\n if (focusPoint == null) { focusPoint = this.getFocusPoint({viewX, viewY}) }\n\n ({width, height} = this.enforceZoom({width, height}))\n if (width != null) {\n this.preview.setWidth(width)\n this.fireChange()\n } else if (height != null) {\n this.preview.setHeight(height)\n this.fireChange()\n }\n\n this.focus(focusPoint)\n }\n\n // returns {Object} e.g. percentX: 0.2, percentY: 0.5\n getFocusPoint (param) {\n if (param == null) { param = {} }\n let {viewX, viewY} = param\n if (viewX == null) { viewX = this.viewWidth / 2 }\n if (viewY == null) { viewY = this.viewHeight / 2 }\n const x = this.preview.x + viewX\n const y = this.preview.y + viewY\n const percentX = x / this.preview.width\n const percentY = y / this.preview.height\n return {percentX, percentY, viewX, viewY}\n }\n\n focus ({percentX, percentY, viewX, viewY}) {\n let x = this.preview.width * percentX\n let y = this.preview.height * percentY\n x = x - viewX\n y = y - viewY\n\n this.pan({x, y})\n }\n\n center () {\n const newX = (this.preview.width - this.viewWidth) / 2\n const newY = (this.preview.height - this.viewHeight) / 2\n this.pan({x: newX, y: newY})\n }\n\n // @param { Object }\n // - x {Number} pixel to pan to the left\n // - y {Number} pixels to pan to the top\n pan (data) {\n data = this.enforceXy(data)\n this.preview.pan(data.x, data.y)\n this.fireChange()\n }\n\n // Validations\n // -----------\n\n enforceXy ({x, y}) {\n if (x > (this.preview.width - this.viewWidth)) {\n x = this.preview.width - this.viewWidth\n }\n\n if (x < 0) x = 0\n\n\n if (y > (this.preview.height - this.viewHeight)) {\n y = this.preview.height - this.viewHeight\n }\n\n if (y < 0) y = 0\n\n return {x, y}\n }\n\n enforceZoom ({width, height}) {\n\n if ((width != null) && this.maxImageWidth && (width > this.maxImageWidth)) {\n // prevent zooming in past the required resolution defined by minResolution\n return {width: this.maxImageWidth}\n }\n\n if ((width != null) && (width < this.viewWidth)) {\n // prevent zooming out past covering the view completely\n return {width: this.viewWidth}\n }\n\n if ((height != null) && this.maxImageHeight && (height > this.maxImageHeight)) {\n // prevent zooming in past the required resolution defined by minResolution\n return {height: this.maxImageHeight}\n }\n\n if ((height != null) && (height < this.viewHeight)) {\n // prevent zooming out past covering the view completely\n return {height: this.viewHeight}\n }\n\n return {width, height}\n }\n\n calcMaxMinDimensions () {\n this.maxWidth = this.min([this.arenaWidth, this.imageWidth])\n this.maxHeight = this.min([this.arenaHeight, this.imageHeight])\n this.minWidth = this.minViewWidth || 0\n this.minHeight = this.minViewHeight || 0\n\n if (this.fixedWidth) this.maxWidth = (this.minWidth = this.fixedWidth)\n if (this.fixedHeight) this.maxHeight = (this.minHeight = this.fixedHeight)\n }\n\n areDimensionsValid ({width, height, keepDimension}) {\n const ratio = width / height\n\n const invalid =\n (width < this.minWidth) ||\n (width > this.maxWidth) ||\n (height < this.minHeight) ||\n (height > this.maxHeight) ||\n (ratio < this.minViewRatio) ||\n (ratio > this.maxViewRatio)\n\n return !invalid\n }\n\n isValidRatio (ratio) {\n return !((ratio < this.minViewRatio) || (ratio > this.maxViewRatio))\n }\n\n enforceValidRatio (ratio) {\n if (ratio < this.minViewRatio) return this.minViewRatio\n if (ratio > this.maxViewRatio) return this.maxViewRatio\n return ratio\n }\n\n enforceViewDimensions ({width, height, keepDimension}) {\n let newHeight, newWidth, ratio\n if (width < this.minWidth) newWidth = this.minWidth\n if (width > this.maxWidth) newWidth = this.maxWidth\n if (height < this.minHeight) newHeight = this.minHeight\n if (height > this.maxHeight) newHeight = this.maxHeight\n\n if (keepDimension) {\n if (newWidth) width = newWidth\n if (newHeight) height = newHeight\n\n // check max/min ratios\n ratio = width / height\n if (!this.isValidRatio(ratio)) {\n ratio = this.enforceValidRatio(ratio);\n ({width, height} = this.getRatioBox({ratio, width, height, keepDimension}))\n if ((width > this.arenaWidth) || (height > this.arenaHeight)) {\n ({width, height} = this.centerAlign(this.maxWidth, this.maxHeight, ratio))\n }\n }\n\n } else if (newWidth || newHeight) {\n ratio = this.enforceValidRatio(width / height);\n ({width, height} = this.centerAlign(this.maxWidth, this.maxHeight, ratio))\n }\n\n return {width, height}\n }\n\n enforceMaxArea ({width, height, keepDimension}) {\n let ratio = width / height\n\n if (keepDimension === 'width') {\n height = this.maxArea / width\n ratio = width / height\n } else if (keepDimension === 'height') {\n width = this.maxArea / height\n ratio = width / height\n } else { // keep ratio\n width = Math.sqrt(this.maxArea * ratio)\n height = width / ratio\n }\n\n if (!this.isValidRatio(ratio)) {\n ratio = this.enforceValidRatio(ratio)\n width = Math.sqrt(this.maxArea * ratio)\n height = width / ratio\n }\n\n return {width, height}\n }\n\n checkRatio (previewImageSize) {\n if (this.originalSize) {\n const expectedRatio = this.originalSize.width / this.originalSize.height\n const actualRatio = previewImageSize.width / previewImageSize.height\n const percentageChange = ((actualRatio - expectedRatio) / expectedRatio) * 100\n if (Math.abs(percentageChange) > 1) {\n throw new Error(`srcissors: Displayed image has a different image ratio than the ` +\n `one configured in 'originalRatio': ${expectedRatio} vs ${actualRatio}`)\n }\n }\n }\n\n // Calculations\n // ------------\n //\n // Ratio: width / height\n // Tall < 1 (Square) < Wide\n // (A ratio less than one is a tall image format and\n // a ratio greater than one is a wide image format)\n\n // Check if the width or height is restricting\n isWidthRestricting () {\n return this.viewRatio >= this.imageRatio\n }\n\n getRatioBox ({ratio, width, height, keepDimension}) {\n if ((keepDimension === 'width') || (height == null)) {\n height = width / ratio\n } else if ((keepDimension === 'height') || (width == null)) {\n width = height * ratio\n } else {\n height = width / ratio\n }\n\n return {width, height}\n }\n\n centerAlign (areaWidth, areaHeight, ratio) {\n let height, width, x, y\n if ((areaWidth / areaHeight) > ratio) {\n width = areaHeight * ratio\n x = (areaWidth - width) / 2\n } else {\n height = areaWidth / ratio\n y = (areaHeight - height) / 2\n }\n\n // return\n return {\n x: x || 0,\n y: y || 0,\n width: width || areaWidth,\n height: height || areaHeight\n }\n }\n\n min (array) {\n let min = array[0]\n for (const number of array) {\n if (number < min) min = number\n }\n\n return min\n }\n\n // Events\n // ------\n\n on (name, callback) {\n return this[`${name}Event`].add(callback)\n }\n\n off (name, callback) {\n return this[`${name}Event`].remove(callback)\n }\n\n // Debounce change events so they are not fired more\n // than once per tick.\n fireChange () {\n if (this.changeDispatch != null) return\n\n this.changeDispatch = setTimeout(() => {\n this.changeDispatch = undefined\n this.changeEvent.fire(this.getCrop())\n }, 0)\n }\n\n // Development helpers\n // -------------------\n\n debug () {\n const r = num => Math.round(num * 10) / 10\n\n const obj = {\n arena: `${r(this.arenaWidth)}x${r(this.arenaHeight)}`,\n view: `${r(this.viewWidth)}x${r(this.viewHeight)}`,\n image: `${r(this.imageWidth)}x${r(this.imageHeight)}`,\n preview: `${r(this.preview.width)}x${r(this.preview.height)}`,\n previewXy: `${r(this.preview.x)}x${r(this.preview.y)}`\n }\n\n console.log(obj) // eslint-disable-line no-console\n return obj\n }\n}\n","'use strict'\nconst $ = require('jquery')\n\nconst getPageCoordinates = function (event) {\n if (event.type.includes('touch')) {\n return {\n pageX: event.originalEvent.changedTouches[0].pageX,\n pageY: event.originalEvent.changedTouches[0].pageY\n }\n }\n return {pageX: event.pageX, pageY: event.pageY}\n}\n\nmodule.exports = class Events {\n constructor ({parent, view, horizontal, vertical, actions}) {\n this.parent = parent\n this.view = view\n this.doubleClickThreshold = 300\n\n // setup events\n if (actions.pan) { this.pan() }\n if (actions.zoomOnDoubleClick) { this.doubleClick() }\n if (actions.resize) {\n this.resizeView({\n horizontal: actions.resizeHorizontal,\n vertical: actions.resizeVertical\n })\n }\n\n this.preventBrowserDragDrop()\n this.responsiveArena()\n }\n\n pan () {\n const $doc = $(document)\n this.view.on('mousedown.srcissors touchstart.srcissors', (e1) => {\n const panData = {\n startX: this.parent.preview.x,\n startY: this.parent.preview.y\n }\n\n e1.preventDefault()\n $doc.on('mousemove.srcissors-pan touchmove.srcissors-pan', (e2) => {\n const {pageX, pageY} = getPageCoordinates(e2)\n const {pageX: prevPageX, pageY: prevPageY} = getPageCoordinates(e1)\n panData.dx = pageX - prevPageX\n panData.dy = pageY - prevPageY\n this.parent.onPan(panData)\n }).on('mouseup.srcissors-pan touchend.srcissors-pan', () => {\n $doc.off('mouseup.srcissors-pan touchend.srcissors-pan')\n $doc.off('mousemove.srcissors-pan touchmove.srcissors-pan')\n\n // only trigger panEnd if pan has been called\n if (panData.dx != null) this.parent.onPanEnd()\n })\n })\n }\n\n doubleClick () {\n let lastClick\n\n this.view.on('mousedown.srcissors touchstart.srcissors', event => {\n const now = new Date().getTime()\n if (lastClick && (lastClick > (now - this.doubleClickThreshold))) {\n this.parent.onDoubleClick(getPageCoordinates(event))\n }\n lastClick = now\n })\n }\n\n preventBrowserDragDrop () {\n this.view.on('dragstart.srcissors', () => false)\n }\n\n // Resize View\n // -----------\n\n resizeView ({horizontal, vertical}) {\n const $template = $('
')\n $template.addClass('resize-handler')\n\n let positions = []\n if (horizontal) positions = positions.concat(['right', 'left'])\n if (vertical) positions = positions.concat(['top', 'bottom'])\n\n positions.forEach(position => {\n const $handler = $template.clone()\n $handler.addClass(`resize-handler-${position}`)\n $handler.on('mousedown.srcissors touchstart.srcissors', this.getResizeMouseDown(position))\n\n this.view.append($handler)\n })\n }\n\n getResizeMouseDown (position) {\n const $doc = $(document)\n\n return (event) => {\n let {pageX: lastX, pageY: lastY} = getPageCoordinates(event)\n event.stopPropagation()\n\n $doc.on('mousemove.srcissors-resize touchmove.srcissors-resize', e2 => {\n let dx, dy\n const {pageX, pageY} = getPageCoordinates(e2)\n switch (position) {\n case 'top': case 'bottom':\n dy = pageY - lastY\n if (position === 'top') { dy = -dy }\n lastY = pageY\n break\n case 'left': case 'right':\n dx = pageX - lastX\n if (position === 'left') { dx = -dx }\n lastX = pageX\n break\n }\n\n this.parent.onResize({position, dx, dy})\n }).on('mouseup.srcissors-resize touchend.srcissors-resize', () => {\n $doc.off('mouseup.srcissors-resize touchmove.srcissors-resize')\n $doc.off('mousemove.srcissors-resize touchend.srcissors-resize')\n\n // only trigger panEnd if pan has been called\n this.parent.onResizeEnd({position})\n })\n }\n }\n\n responsiveArena () {}\n}\n\n// $(window).on('resize', (event) => console.log 'on window resize')\n","'use strict'\nconst $ = require('jquery')\n\nmodule.exports = class Preview {\n\n constructor ({onReady, img, opacity, outline}) {\n this.onReady = onReady\n this.img = img\n this.opacity = opacity\n this.outline = outline\n this.x = (this.y = 0)\n this.width = (this.height = 0)\n\n this.img.on('load', () => {\n const width = this.img.width()\n const height = this.img.height()\n this.ratio = width / height\n\n this.onReady({width, height})\n this.img.show()\n })\n }\n\n setImage ({url}) {\n this.url = url\n this.img.attr('src', this.url)\n if (this.outline) this.setBackgroundImage({url: this.url})\n }\n\n setBackgroundImage ({url}) {\n if (this.opacity > 0) {\n const bgImg = $('').css({opacity: this.opacity}).attr('src', url)\n this.outline.append(bgImg)\n }\n }\n\n reset () {\n this.url = undefined\n this.x = (this.y = 0)\n this.width = (this.height = 0)\n this.img.attr('src', '')\n this.img.css({width: '', height: '', transform: ''})\n if (this.outline) this.outline.css({transform: ''}).html('')\n }\n\n setWidth (width) {\n this.img.css({width: `${width}px`, height: 'auto'})\n const height = width / this.ratio\n this.updateImageDimensions({width, height})\n }\n\n setHeight (height) {\n this.img.css({width: 'auto', height: `${height}px`})\n const width = height * this.ratio\n this.updateImageDimensions({width, height})\n }\n\n updateImageDimensions ({width, height}) {\n this.width = width\n this.height = height\n if (this.outline) this.outline.css({width: `${this.width}px`, height: `${this.height}px`})\n }\n\n pan (x1, y1) {\n // Without rounding some numbers would not be set to css.\n // e.g: '-5.14957320384e-14'\n this.x = x1\n this.y = y1\n const x = Math.round(this.x)\n const y = Math.round(this.y)\n this.img.css({transform: `translate(-${x}px, -${y}px)`})\n if (this.outline) this.outline.css({transform: `translate(-${x}px, -${y}px)`})\n }\n}\n\n","'use strict'\nconst $ = require('jquery')\nconst Crop = require('./crop')\n\nmodule.exports = {\n new ({\n arena, url, fixedWidth, fixedHeight, minWidth, minHeight,\n minRatio, maxRatio, maxArea, originalSize, zoomStep, crop, actions, minResolution,\n surroundingImageOpacity, showSurroundingImage\n }) {\n arena = $(arena)\n const view = arena.find('.crop-view')\n const preview = view.find('.crop-preview')\n const img = $('')\n preview.append(img)\n let outline = view.find('.crop-outline')\n if (!outline.length) { outline = undefined }\n\n const allowedActions = {\n pan: true,\n zoomOnDoubleClick: true,\n resize: true,\n resizeHorizontal: !fixedWidth,\n resizeVertical: !fixedHeight\n }\n\n $.extend(allowedActions, actions)\n\n if (zoomStep == null) { zoomStep = 1.25 }\n\n if (minWidth == null) { minWidth = 50 }\n if (minHeight == null) { minHeight = 50 }\n\n return new Crop({\n url, // {String}\n crop, // {Object} Set an inital crop. This is the same as calling setCrop()\n arena, // {jQuery Element}\n view, // {jQuery Element}\n img, // {jQuery Element}\n outline, // {jQuery Element or undefined}\n showSurroundingImage, // {String} always|panning|never\n surroundingImageOpacity, // {Number} e.g. in the 0.0 - 1.0 range\n fixedWidth, // {Number} e.g. 300\n fixedHeight, // {Number} e.g. 500\n minViewWidth: minWidth, // {Number} e.g. 100\n minViewHeight: minHeight, // {Number} e.g. 100\n minViewRatio: minRatio, // {Number} e.g. 1.5/2\n maxViewRatio: maxRatio, // {Number} e.g. 2/1\n maxArea, // {Number} 0.8 -> max 80% of arena area are covered by the preview\n originalSize, // {Object} Original image size, can be used to display a downscaled\n // version of the image in the cropping interface, but use the original\n // size for crop attributes; e.g. {width: 4000, height: 3000}\n zoomStep, // {Number} e.g. 1.25 -> 125%\n actions: allowedActions,\n minResolution\n })\n }\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__47__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(505);\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__47__","_typeof","obj","Symbol","iterator","constructor","prototype","_arrayLikeToArray","arr","len","length","i","arr2","Array","_defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","input","hint","prim","toPrimitive","undefined","res","call","TypeError","String","_toPrimitive","$","Preview","Events","Crop","_ref","arena","view","img","outline","url","fixedWidth","fixedHeight","minViewWidth","minViewHeight","minViewRatio","maxViewRatio","originalSize","crop","zoomStep","maxArea","actions","minResolution","surroundingImageOpacity","showSurroundingImage","instance","Constructor","_classCallCheck","this","onPreviewReady","bind","loadingCssClass","panningCssClass","outlineCssClass","isPanning","initialCrop","loadEvent","Callbacks","changeEvent","initializeReadyState","zoomInStep","zoomOutStep","arenaWidth","width","arenaHeight","height","setSurroundingImageVisibility","preview","onReady","opacity","setImage","protoProps","value","isReady","readyEvent","empty","isInitialized","reset","addClass","visibility","parseFloat","css","resize","imageWidth","imageHeight","zoomAllOut","previewImageSize","checkRatio","keepDimension","_ref2","updateImageDimensions","events","parent","imageRatio","imageResolution","minRatioForResolution","maxRatioForResolution","calcMaxMinDimensions","setViewDimensions","removeClass","center","setCrop","fire","_ref3","_this","x","y","factor","viewWidth","previewWidth","zoom","pan","on","viewHeight","roundCrop","validateCrop","name","Math","round","ratio","_this2","enforceValidRatio","resizeFocusPoint","getFocusPoint","setRatio","data","newX","startX","dx","newY","startY","dy","_ref4","pageX","pageY","_this$view$0$getBound","getBoundingClientRect","viewX","left","viewY","top","zoomIn","_ref5","position","isResizing","includes","_ref6","focusPoint","_ref7","_this$enforceMaxArea","enforceMaxArea","_this$enforceViewDime","enforceViewDimensions","viewRatio","minZoomPixelWidth","sqrt","minZoomPixelHeight","maxImageWidth","maxImageHeight","fireChange","isWidthRestricting","params","_ref8","_this$enforceZoom","enforceZoom","setWidth","setHeight","focus","param","_param","percentX","percentY","_ref9","enforceXy","_ref10","_ref11","maxWidth","min","maxHeight","minWidth","minHeight","_ref12","_ref13","newHeight","newWidth","isValidRatio","_this$getRatioBox","getRatioBox","_this$centerAlign","centerAlign","_this$centerAlign2","_ref14","expectedRatio","actualRatio","percentageChange","abs","Error","concat","_ref15","areaWidth","areaHeight","array","_step","_iterator","o","allowArrayLike","it","isArray","minLen","n","toString","slice","from","test","_unsupportedIterableToArray","F","s","done","e","_e","f","err","normalCompletion","didErr","step","next","_e2","return","_createForOfIteratorHelper","number","callback","add","remove","_this3","changeDispatch","setTimeout","getCrop","r","num","image","previewXy","console","log","getPageCoordinates","event","type","originalEvent","changedTouches","horizontal","vertical","doubleClickThreshold","zoomOnDoubleClick","doubleClick","resizeView","resizeHorizontal","resizeVertical","preventBrowserDragDrop","responsiveArena","$doc","document","e1","panData","preventDefault","e2","_getPageCoordinates","_getPageCoordinates2","prevPageX","prevPageY","onPan","off","onPanEnd","lastClick","now","Date","getTime","onDoubleClick","$template","positions","forEach","$handler","clone","getResizeMouseDown","append","_this4","_getPageCoordinates3","lastX","lastY","stopPropagation","_getPageCoordinates4","onResize","onResizeEnd","show","attr","setBackgroundImage","bgImg","transform","html","x1","y1","new","minRatio","maxRatio","find","allowedActions","extend","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""} \ No newline at end of file