diff --git a/thrimbletrimmer/edit.html b/thrimbletrimmer/edit.html index 1245d6b..03e82d9 100644 --- a/thrimbletrimmer/edit.html +++ b/thrimbletrimmer/edit.html @@ -5,6 +5,7 @@ VST Video Editor + @@ -12,14 +13,13 @@ + - -
diff --git a/thrimbletrimmer/scripts/edit.js b/thrimbletrimmer/scripts/edit.js index 2ee97a2..a63ba29 100644 --- a/thrimbletrimmer/scripts/edit.js +++ b/thrimbletrimmer/scripts/edit.js @@ -16,8 +16,8 @@ const PAGE_STATE = { }; // References to Jcrop "stages" for the advanced thumbnail editor crop tool -var videoFrameStage; -var templateStage; +let videoFrameStage; +let templateStage; window.addEventListener("DOMContentLoaded", async (event) => { commonPageSetup(); @@ -2262,4 +2262,4 @@ function updateTemplateCropWidgets() { templateStage.active.pos = templateRect; templateStage.active.render(); } -} \ No newline at end of file +} diff --git a/thrimbletrimmer/scripts/jcrop.js b/thrimbletrimmer/scripts/jcrop.js new file mode 100644 index 0000000..523a479 --- /dev/null +++ b/thrimbletrimmer/scripts/jcrop.js @@ -0,0 +1,2 @@ +var Jcrop=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e={};for(var t in arguments){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;ne&&(n.x=e-n.w),n.y2>t&&(n.y=t-n.h),n}},{key:"scale",value:function(t,n){return n=n||t,e.create(this.x,this.y,this.w*t,this.h*n)}},{key:"center",value:function(t,n){return e.create((t-this.w)/2,(n-this.h)/2,this.w,this.h)}},{key:"toArray",value:function(){return[this.x,this.y,this.w,this.h]}},{key:"x1",set:function(e){this.w=this.x2-e,this.x=e}},{key:"y1",set:function(e){this.h=this.y2-e,this.y=e}},{key:"x2",get:function(){return this.x+this.w},set:function(e){this.w=e-this.x}},{key:"y2",get:function(){return this.y+this.h},set:function(e){this.h=e-this.y}},{key:"aspect",get:function(){return this.w/this.h}}]),e}();i.fromPoints=function(e,t){var n=[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[0],t[0]),Math.max(e[1],t[1])],r=n[0],o=n[1],a=n[2],u=n[3];return i.create(r,o,a-r,u-o)},i.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=new i;return o.x=e,o.y=t,o.w=n,o.h=r,o},i.from=function(e){if(Array.isArray(e))return i.fromArray(e);var t=new i;return t.x=e.offsetLeft,t.y=e.offsetTop,t.w=e.offsetWidth,t.h=e.offsetHeight,t},i.fromArray=function(e){if(4===e.length)return i.create.apply(this,e);if(2===e.length)return i.fromPoints(e[0],e[1]);throw"fromArray method problem"},i.sizeOf=function(e,t){if(t)return i.create(0,0,e,t);var n=new i;return n.w=e.offsetWidth,n.h=e.offsetHeight,n},i.getMax=function(e,t,n){return e/t>n?[t*n,t]:[e,e/n]},i.fromPoint=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"br",o=new i;switch(o.x=e[0],o.y=e[1],r){case"br":o.x2=o.x+t,o.y2=o.y+n;break;case"bl":o.x2=o.x-t,o.y2=o.y+n;break;case"tl":o.x2=o.x-t,o.y2=o.y-n;break;case"tr":o.x2=o.x+t,o.y2=o.y-n}return o},t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={animateEasingFunction:"swing",animateFrames:30,multi:!1,multiMax:null,multiMin:1,cropperClass:"jcrop-widget",disabledClass:"jcrop-disable",canDrag:!0,canResize:!0,canSelect:!0,canRemove:!0,multiple:!1,autoFront:!0,active:!0,handles:["n","s","e","w","sw","nw","ne","se"],shade:!0,shadeClass:"jcrop-shade",shadeColor:"black",shadeOpacity:.5,widgetConstructor:null,x:0,y:0,w:100,h:100}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e,t,n,r){var i,o;function a(e){var n="touchstart"===e.type?e.touches[0]:e;i=n.pageX,o=n.pageY,e.preventDefault(),e.stopPropagation(),t(i,o,n)&&("mousedown"===e.type?(window.addEventListener("mousemove",u),document.addEventListener("mouseup",s)):"touchstart"===e.type&&(document.addEventListener("touchmove",u),document.addEventListener("touchend",s)))}function u(e){var t="touchmove"===e.type?e.changedTouches[0]:e;e.stopPropagation(),n(t.pageX-i,t.pageY-o)}function s(e){var t="touchend"===e.type?e.changedTouches[0]:e;t.pageX&&t.pageY&&n(t.pageX-i,t.pageY-o),document.removeEventListener("mouseup",s),window.removeEventListener("mousemove",u),document.removeEventListener("touchmove",u),document.removeEventListener("touchend",s),r()}return"string"==typeof e&&(e=document.getElementById(e)),e.addEventListener("mousedown",a),e.addEventListener("touchstart",a),{remove:function(){e.removeEventListener("mousedown",a),e.removeEventListener("touchstart",a)}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var n=0;n=0&&r>=0?"tl":n<0&&r>=0?"tr":"bl"}},{key:"getMaxRect",value:function(e,t,n){return o.default.getMax(Math.abs(this.locked[0]-e),Math.abs(this.locked[1]-t),n)}},{key:"translateStuckPoint",value:function(e,t){var n=r(this.stuck,3),i=n[0],a=n[1],u=n[2],s=null===i?u:i+e,c=null===a?u:a+t;if(s>this.sw&&(s=this.sw),c>this.sh&&(c=this.sh),s<0&&(s=0),c<0&&(c=0),this.aspect){var f=this.getMaxRect(s,c,this.aspect),l=r(f,2),h=l[0],d=l[1],p=this.getDragQuadrant(s,c),v=o.default.fromPoint(this.locked,h,d,p);return[v.x2,v.y2]}return[s,c]}},{key:"getCornerPoint",value:function(e){var t=this.rect;switch(e){case"n":return[null,t.y,t.x];case"s":return[null,t.y2,t.x2];case"e":return[t.x2,null,t.y2];case"w":return[t.x,null,t.y];case"se":return[t.x2,t.y2];case"sw":return[t.x,t.y2];case"ne":return[t.x2,t.y];case"nw":return[t.x,t.y]}}},{key:"getOppositeCorner",value:function(e){switch(e){case"n":return"se";case"s":case"e":return"nw";case"w":return"se";case"se":return"nw";case"sw":return"ne";case"ne":return"sw";case"nw":return"se"}}}]),e}();a.create=function(e,t,n,r){return new a(e,t,n,r)},t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0])||arguments[0],t=this.options.disabledClass||"jcrop-disable";return this[e?"removeClass":"addClass"](t),this.enabled=!!e,this}},{key:"focus",value:function(){return!!this.enabled&&(this.active?this.active.el.focus():this.el.focus(),this)}},{key:"limitWidgets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(!this.crops||e<1)return!1;for(var t=Array.from(this.crops);t.length>e;)this.removeWidget(t.shift());return this}},{key:"canCreate",value:function(){var e=this.crops.size,t=this.options;return!!this.enabled&&(!(null!==t.multiMax&&e>=t.multiMax)&&!(!t.multi&&e>=t.multiMin))}},{key:"canRemove",value:function(){var e=this.crops.size,t=this.options;return!!this.enabled&&(!(this.active&&!this.active.options.canRemove)&&!(!t.canRemove||e<=t.multiMin))}},{key:"initStageDrag",value:function(){var e,t,n,r,i,a=this;(0,u.default)(this.el,function(u,s,f){return!!a.canCreate()&&(e=(a.options.widgetConstructor||o.default).create(a.options),(t=e.pos).x=f.pageX-a.el.offsetParent.offsetLeft-a.el.offsetLeft,t.y=f.pageY-a.el.offsetParent.offsetTop-a.el.offsetTop,n=a.el.offsetWidth,r=a.el.offsetHeight,a.addWidget(e),i=c.default.create(t,n,r,"se"),a.options.aspectRatio&&(i.aspect=a.options.aspectRatio),e.render(t),a.focus(),!0)},function(t,n){e.render(i.move(t,n))},function(){e.emit("crop.change")})}},{key:"reorderWidgets",value:function(){var e=this,t=10;this.crops.forEach(function(n){n.el.style.zIndex=t++,e.active===n?n.addClass("active"):n.removeClass("active")}),this.refresh()}},{key:"activate",value:function(e){if(!this.enabled)return this;if(e=e||Array.from(this.crops).pop()){if(this.active===e)return;this.active=e,this.crops.delete(e),this.crops.add(e),this.reorderWidgets(),this.active.el.focus(),this.options.shade&&this.shades.enable(),e.emit("crop.activate")}else this.shades.disable();return this}},{key:"addWidget",value:function(e){return e.attachToStage(this),e.appendTo(this.el),this.activate(e),this}},{key:"newWidget",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=(0,i.default)({},this.options,t);var n=(this.options.widgetConstructor||o.default).create(t);return n.render(e),this.addWidget(n),n.el.focus(),n}},{key:"removeWidget",value:function(e){if(!this.canRemove())return!1;e.emit("crop.remove"),e.el.remove(),this.crops.delete(e),this.activate()}},{key:"refresh",value:function(){this.options.shade&&this.active&&this.shades.adjust(this.active.pos)}},{key:"updateShades",value:function(){if(this.shades)return this.options.shade?this.shades.enable():this.shades.disable(),this.options.shade&&this.active&&this.shades.adjust(this.active.pos),this}},{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setOptions",this).call(this,e),this.crops&&Array.from(this.crops).forEach(function(t){return t.setOptions(e)})}},{key:"destroy",value:function(){}}]),t}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.pos=c.default.from(r.el),r.init(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"init",value:function(){return this.createHandles(),this.createMover(),this.attachFocus(),h.default.attach(this),this}},{key:"initOptions",value:function(){var e=this;this._optconf.aspectRatio=function(t){var n=e.pos;if(e.aspect=t||null,e.aspect&&n){var i=c.default.getMax(n.w,n.h,t),o=r(i,2),a=o[0],u=o[1];e.render(c.default.fromPoint([n.x,n.y],a,u))}}}},{key:"attachToStage",value:function(e){this.stage=e,this.emit("crop.attach")}},{key:"attachFocus",value:function(){var e=this;this.el.addEventListener("focus",function(t){e.stage.activate(e),e.emit("crop.update")},!1)}},{key:"animate",value:function(e,t,n){var r=this,i=this;return n=n||i.options.animateEasingFunction||"swing",t=t||i.options.animateFrames||30,(0,d.default)(i.el,i.pos,e,function(e){return i.render(e.normalize())},t,n).then(function(){return r.emit("crop.change")})}},{key:"createMover",value:function(){var e,t,n,r=this;this.pos=c.default.from(this.el),(0,s.default)(this.el,function(){var i=r.el.parentElement;if(!r.stage.enabled)return!1;var o=[i.offsetWidth,i.offsetHeight];return e=o[0],t=o[1],n=c.default.from(r.el),r.el.focus(),r.stage.activate(r),!0},function(i,o){r.pos.x=n.x+i,r.pos.y=n.y+o,r.render(r.pos.rebound(e,t))},function(){r.emit("crop.change")})}},{key:"nudge",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.el.parentElement,r=[n.offsetWidth,n.offsetHeight],i=r[0],o=r[1];e&&(this.pos.x+=e),t&&(this.pos.y+=t),this.render(this.pos.rebound(i,o)),this.emit("crop.change")}},{key:"createHandles",value:function(){var e=this;return this.options.handles.forEach(function(t){var n,r=a.default.create("jcrop-handle "+t);r.appendTo(e.el),(0,s.default)(r.el,function(){if(!e.stage.enabled)return!1;var r=e.el.parentElement,i=r.offsetWidth,o=r.offsetHeight;return n=f.default.create(c.default.from(e.el),i,o,t),e.aspect&&(n.aspect=e.aspect),e.el.focus(),e.emit("crop.active"),!0},function(t,r){return e.render(n.move(t,r))},function(){e.emit("crop.change")})}),this}},{key:"isActive",value:function(){return this.stage&&this.stage.active===this}},{key:"render",value:function(e){return e=e||this.pos,this.el.style.top=Math.round(e.y)+"px",this.el.style.left=Math.round(e.x)+"px",this.el.style.width=Math.round(e.w)+"px",this.el.style.height=Math.round(e.h)+"px",this.pos=e,this.emit("crop.update"),this}},{key:"doneDragging",value:function(){this.pos=c.default.from(this.el)}}]),t}();v.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=document.createElement("div"),n=(0,o.default)({},u.default,e);return t.setAttribute("tabindex","0"),t.className=n.cropperClass||"jcrop-widget",new(e.widgetConstructor||v)(t,n)},t.default=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(1));var i=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.default),t}();i.create=function(e){var t=document.createElement("div");return t.className=e,new i(t)},t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.options={},Object.defineProperty(r,"_optconf",{configurable:!1,enumerable:!1,value:{},writable:!0}),r.initOptions(),r.setOptions((0,i.default)({},a.default,n)),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),r(t,[{key:"setOptions",value:function(e){var t=this;return this.options=(0,i.default)({},this.options,e),Object.keys(e).forEach(function(n){t._optconf[n]&&t._optconf[n](e[n])}),this}},{key:"initOptions",value:function(){}}]),t}();t.default=s},function(e,t,n){"use strict";var r=e.exports={def:"outQuad",swing:function(e,t,n,i){return r[r.def](e,t,n,i)},inQuad:function(e,t,n,r){return n*(e/=r)*e+t},outQuad:function(e,t,n,r){return-n*(e/=r)*(e-2)+t},inOutQuad:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},inCubic:function(e,t,n,r){return n*(e/=r)*e*e+t},outCubic:function(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t},inOutCubic:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t},inQuart:function(e,t,n,r){return n*(e/=r)*e*e*e+t},outQuart:function(e,t,n,r){return-n*((e=e/r-1)*e*e*e-1)+t},inOutQuart:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t},inQuint:function(e,t,n,r){return n*(e/=r)*e*e*e*e+t},outQuint:function(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},inOutQuint:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},inSine:function(e,t,n,r){return-n*Math.cos(e/r*(Math.PI/2))+n+t},outSine:function(e,t,n,r){return n*Math.sin(e/r*(Math.PI/2))+t},inOutSine:function(e,t,n,r){return-n/2*(Math.cos(Math.PI*e/r)-1)+t},inExpo:function(e,t,n,r){return 0==e?t:n*Math.pow(2,10*(e/r-1))+t},outExpo:function(e,t,n,r){return e==r?t+n:n*(1-Math.pow(2,-10*e/r))+t},inOutExpo:function(e,t,n,r){return 0==e?t:e==r?t+n:(e/=r/2)<1?n/2*Math.pow(2,10*(e-1))+t:n/2*(2-Math.pow(2,-10*--e))+t},inCirc:function(e,t,n,r){return-n*(Math.sqrt(1-(e/=r)*e)-1)+t},outCirc:function(e,t,n,r){return n*Math.sqrt(1-(e=e/r-1)*e)+t},inOutCirc:function(e,t,n,r){return(e/=r/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+t:n/2*(Math.sqrt(1-(e-=2)*e)+1)+t},inElastic:function(e,t,n,r){var i=1.70158,o=0,a=n;if(0==e)return t;if(1==(e/=r))return t+n;if(o||(o=.3*r),a0&&void 0!==arguments[0]?arguments[0]:{};this.active=void 0===t.shade||t.shade,this.keys().forEach(function(n){e.shades[n]=c.create(t,n)}),this.el.addEventListener("crop.update",function(t){t.cropTarget.isActive()&&t.cropTarget.options.shade&&e.adjust(t.cropTarget.pos)},!1),this.enable()}},{key:"adjust",value:function(e){var t=i.default.from(this.el),n=this.shades;n.t.h=e.y,n.b.h=t.h-e.y2,n.t.w=n.b.w=Math.floor(e.w),n.l.w=n.t.x=n.b.x=Math.ceil(e.x),n.r.w=t.w-(Math.ceil(e.x)+Math.floor(e.w))}},{key:"keys",value:function(){return["t","l","r","b"]}},{key:"enable",value:function(){var e=this,t=this.shades;this.keys().forEach(function(n){return t[n].insert(e.el)})}},{key:"disable",value:function(){var e=this.shades;this.keys().forEach(function(t){return e[t].remove()})}},{key:"setStyle",value:function(e,t){var n=this.shades;this.keys().forEach(function(r){return n[r].color(e).opacity(t)})}}]),e}();s.attach=function(e){var t=e.el,n=new s(t);return n.init(e.options),e.shades=n,e._optconf.shade=function(t){return e.updateShades()},e._optconf.shadeColor=function(e){return n.setStyle(e)},e._optconf.shadeOpacity=function(e){return n.setStyle(null,e)},n};var c=function(e){function t(){return u(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),r(t,[{key:"insert",value:function(e){e.appendChild(this.el)}},{key:"remove",value:function(){this.el.remove()}},{key:"color",value:function(e){return e&&(this.el.style.backgroundColor=e),this}},{key:"opacity",value:function(e){return e&&(this.el.style.opacity=e),this}},{key:"w",set:function(e){this.el.style.width=e+"px"}},{key:"h",set:function(e){this.el.style.height=e+"px"}},{key:"x",set:function(e){this.el.style.left=e+"px"}}]),t}();c.create=function(e,t){var n=document.createElement("div"),r=e.shadeClass||"jcrop-shade";return n.className=r+" "+t,new c(n).color(e.shadeColor).opacity(e.shadeOpacity)},c.Manager=s,t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DomObj=t.Shade=t.load=t.easing=t.Sticker=t.Handle=t.Rect=t.Widget=t.Dragger=t.defaults=t.Stage=void 0,t.attach=b;var r=y(n(0)),i=y(n(3)),o=y(n(6)),a=y(n(15)),u=y(n(7)),s=y(n(11)),c=y(n(8)),f=y(n(4)),l=y(n(2)),h=y(n(5)),d=y(n(1)),p=y(n(10)),v=y(n(16));function y(e){return e&&e.__esModule?e:{default:e}}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=(0,r.default)({},i.default,t),"string"==typeof e&&(e=document.getElementById(e)),"IMG"===e.tagName?new a.default(e,t):new o.default(e,t)}t.Stage=o.default,t.defaults=i.default,t.Dragger=f.default,t.Widget=u.default,t.Rect=l.default,t.Handle=c.default,t.Sticker=h.default,t.easing=p.default,t.load=v.default,t.Shade=s.default,t.DomObj=d.default,t.default={Stage:o.default,defaults:i.default,Dragger:f.default,Widget:u.default,Rect:l.default,Handle:c.default,Sticker:h.default,easing:p.default,load:v.default,attach:b,Shade:s.default,DomObj:d.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n4&&void 0!==arguments[4]?arguments[4]:30,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"swing",u=["x","y","w","h"],s=t.normalize();a="string"==typeof a?r.default[a]:a;var c=0;return new Promise(function(e,r){requestAnimationFrame(function r(){c1&&void 0!==arguments[1]?arguments[1]:document.createElement("div");return t.className=e,t}("jcrop-stage jcrop-image-stage");e.parentNode.insertBefore(r,e),r.appendChild(e);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,r,n));return i.srcEl=e,e.onload=i.resizeToImage.bind(i),i.resizeToImage(),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.default),r(t,[{key:"resizeToImage",value:function(){var e=this.srcEl.width,t=this.srcEl.height;this.el.style.width=e+"px",this.el.style.height=t+"px",this.refresh()}},{key:"destroy",value:function(){this.el.parentNode.insertBefore(this.srcEl,this.el),this.el.remove()}}]),t}();t.default=o},function(e,t,n){"use strict";function r(e){return"string"==typeof e&&(e=document.getElementById(e)),new Promise(function(t,n){if(r.check(e))return t(e);function i(r){e.removeEventListener("load",i),e.removeEventListener("error",i),"load"===r.type?t(e):n(e)}e.addEventListener("load",i),e.addEventListener("error",i)})}Object.defineProperty(t,"__esModule",{value:!0}),r.check=function(e){return!!e.complete&&0!==e.naturalWidth},t.default=r}]); +//# sourceMappingURL=jcrop.js.map \ No newline at end of file diff --git a/thrimbletrimmer/styles/jcrop.css b/thrimbletrimmer/styles/jcrop.css new file mode 100644 index 0000000..580aaea --- /dev/null +++ b/thrimbletrimmer/styles/jcrop.css @@ -0,0 +1,3 @@ +.jcrop-widget .jcrop-handle{display:none;position:absolute;border:1px rgba(127,127,127,0.8) solid;width:10px;height:10px;box-sizing:border-box;background:rgba(255,255,255,0.8)}.jcrop-widget .jcrop-handle.nw{top:-3px;left:-3px;cursor:nwse-resize}.jcrop-widget .jcrop-handle.w{top:50%;transform:translateY(-50%);left:-3px;cursor:ew-resize}.jcrop-widget .jcrop-handle.sw{bottom:-3px;left:-3px;cursor:nesw-resize}.jcrop-widget .jcrop-handle.ne{top:-3px;right:-3px;cursor:nesw-resize}.jcrop-widget .jcrop-handle.e{top:50%;transform:translateY(-50%);right:-3px;cursor:ew-resize}.jcrop-widget .jcrop-handle.se{bottom:-3px;right:-3px;cursor:nwse-resize}.jcrop-widget .jcrop-handle.n{left:50%;transform:translateX(-50%);top:-3px;cursor:ns-resize}.jcrop-widget .jcrop-handle.s{left:50%;transform:translateX(-50%);bottom:-3px;cursor:ns-resize}.jcrop-widget.active .jcrop-handle{display:block}.jcrop-widget{position:absolute;box-sizing:border-box;border:1px white dashed;opacity:0.7;background:transparent;transition:opacity 1s;padding:0;margin:0;cursor:move}.jcrop-widget:hover{transition:opacity 0.8s;opacity:0.8}.jcrop-widget:focus{transition:opacity 0.5s;opacity:1;outline-style:auto;outline-width:3px;outline-color:rgba(0,0,0,0.3)}.jcrop-shade{background:rgba(0,0,0,0.5);transition:opacity 0.4s, background-color 0.7s;position:absolute}.jcrop-shade.l{top:0px;left:0px;height:100%}.jcrop-shade.r{top:0px;right:0px;height:100%}.jcrop-shade.t{top:0px}.jcrop-shade.b{bottom:0px}.jcrop-stage{position:relative;width:100%}.jcrop-image-stage img{position:absolute;z-index:-1}.jcrop-ux-inactive-handles .jcrop-widget .jcrop-handle{display:block}.jcrop-widget img{width:100%;height:auto}.jcrop-ux-fade-more .jcrop-widget{opacity:0.25}.jcrop-ux-fade-more .jcrop-widget:hover{transition:opacity 0.4s;opacity:0.8}.jcrop-ux-fade-more .jcrop-widget:focus{transition:opacity 0.5s;opacity:1;outline-style:auto;outline-width:3px;outline-color:rgba(0,0,0,0.3)}.jcrop-ux-fade-more .jcrop-widget{opacity:0.25}.jcrop-ux-fade-more .jcrop-widget:hover{opacity:0.65}.jcrop-ux-keep-current .jcrop-widget.active{opacity:1;outline-style:auto;outline-width:3px;outline-color:rgba(0,0,0,0.3)}.jcrop-ux-no-outline .jcrop-widget{outline:none !important}.jcrop-disable.jcrop-stage{opacity:.8}.jcrop-disable.jcrop-stage .jcrop-widget{outline:none !important} + +/*# sourceMappingURL=jcrop.css.map */ \ No newline at end of file