mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
2 lines
34 KiB
JavaScript
2 lines
34 KiB
JavaScript
|
/*! PlainDraggable v2.5.14 (c) anseki https://anseki.github.io/plain-draggable/ */
|
||
|
var PlainDraggable=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var r,o=[],i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,1e3/60)},a=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return clearTimeout(t)},l=Date.now();function s(){var t,e;r&&(a.call(window,r),r=null),o.forEach((function(e){var n;(n=e.event)&&(e.event=null,e.listener(n),t=!0)})),t?(l=Date.now(),e=!0):Date.now()-l<500&&(e=!0),e&&(r=i.call(window,s))}function u(t){var e=-1;return o.some((function(n,r){return n.listener===t&&(e=r,!0)})),e}var c={add:function(t){var e;return-1===u(t)?(o.push(e={listener:t}),function(t){e.event=t,r||s()}):null},remove:function(t){var e;(e=u(t))>-1&&(o.splice(e,1),!o.length&&r&&(a.call(window,r),r=null))}};function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var f=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){f=!0}}))}catch(t){}function p(t,e,n,r){t.addEventListener(e,n,f?r:r.capture)}function h(t,e){if(null!=t&&null!=e)for(var n=0;n<t.length;n++)if(t[n].identifier===e)return t[n];return null}function m(t){return t&&"number"==typeof t.clientX&&"number"==typeof t.clientY}function g(t){t.preventDefault()}var y=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.startHandlers={},this.lastHandlerId=0,this.curPointerClass=null,this.curTouchId=null,this.lastPointerXY={clientX:0,clientY:0},this.lastTouchTime=0,this.options={preventDefault:!0,stopPropagation:!0},e&&["preventDefault","stopPropagation"].forEach((function(t){"boolean"==typeof e[t]&&(n.options[t]=e[t])}))}var e,n,r;return e=t,r=[{key:"addEventListenerWithOptions",get:function(){return p}}],(n=[{key:"regStartHandler",value:function(t){var e=this;return e.startHandlers[++e.lastHandlerId]=function(n){var r,o,i="mousedown"===n.type?"mouse":"touch",a=Date.now();if("touch"===i)e.lastTouchTime=a,r=n.changedTouches[0],o=n.changedTouches[0].identifier;else{if(a-e.lastTouchTime<400)return;r=n}if(!m(r))throw new Error("No clientX/clientY");e.curPointerClass&&e.cancel(),t.call(e,r)&&(e.curPointerClass=i,e.curTouchId="touch"===i?o:null,e.lastPointerXY.clientX=r.clientX,e.lastPointerXY.clientY=r.clientY,e.options.preventDefault&&n.preventDefault(),e.options.stopPropagation&&n.stopPropagation())},e.lastHandlerId}},{key:"unregStartHandler",value:function(t){delete this.startHandlers[t]}},{key:"addStartHandler",value:function(t,e){if(!this.startHandlers[e])throw new Error("Invalid handlerId: ".concat(e));return p(t,"mousedown",this.startHandlers[e],{capture:!1,passive:!1}),p(t,"touchstart",this.startHandlers[e],{capture:!1,passive:!1}),p(t,"dragstart",g,{capture:!1,passive:!1}),e}},{key:"removeStartHandler",value:function(t,e){if(!this.startHandlers[e])throw new Error("Invalid handlerId: ".concat(e));return t.removeEventListener("mousedown",this
|