text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdragspeedplugin=e()}(this,function(){"use strict";function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function t(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function c(i){var s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=h(i);if(s){var n=h(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)}}function a(t,e,n){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(i){var s=Object.getOwnPropertyDescriptor(i,e);return s.get?s.get.call(n):s.value}})(t,e,n||t)}function l(t){return t instanceof f}var e={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},f=Phaser.Scene,p=Phaser.Utils.Objects.GetValue,v=function(){function i(t,e){var n;r(this,i),this.parent=t,this.scene=null==(n=t)||"object"!==s(n)?null:l(n)?n:n.scene&&l(n.scene)?n.scene:n.parent&&n.parent.scene&&l(n.parent.scene)?n.parent.scene:void 0,this.isShutdown=!1,this.setEventEmitter(p(e,"eventEmitter",!0)),this.parent&&this.parent===this.scene?this.scene.events.once("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this)}return t(i,[{key:"shutdown",value:function(){this.isShutdown||(this.parent&&this.parent===this.scene?this.scene.events.off("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.isShutdown=!0)}},{key:"destroy",value:function(t){this.shutdown(t)}},{key:"onSceneDestroy",value:function(){this.destroy(!0)}},{key:"onParentDestroy",value:function(t,e){this.destroy(e)}}]),i}();Object.assign(v.prototype,e);var d=Phaser.Utils.Objects.GetValue,y=Phaser.Math.Distance.Between,m=function(){o(s,v);var i=c(s);function s(t,e){var n;return r(this,s),(n=i.call(this,t,e))._enable=void 0,t.setInteractive(d(e,"inputConfig",void 0)),n.resetFromJSON(e),n.boot(),n}return t(s,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(d(t,"enable",!0)),this.holdThreshold=d(t,"holdThreshold",50),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.events.on("preupdate",this.preupdate,this)}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.events.off("preupdate",this.preupdate,this),this.pointer=void 0,a(h(s.prototype),"shutdown",this).call(this,t))}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return!this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return this.scene.sys.game.loop.delta}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:y(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,n){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=n)}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}},{key:"onPointerMove",value:function(t,e,n){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=n)}},{key:"preupdate",value:function(t){if(this.enable){var e=this.pointer;this.justMoved=!1,e&&!this.isInTouched?(this.x=e.x,this.y=e.y,this.preX=e.x,this.preY=e.y,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",e,this.localX,this.localY)):e&&this.isInTouched?this.x===e.x&&this.y===e.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=e.x,this.y=e.y,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",e,this.localX,this.localY)):!e&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",e))}}}]),s}();return function(){o(n,Phaser.Plugins.BasePlugin);var e=c(n);function n(t){return r(this,n),e.call(this,t)}return t(n,[{key:"start",value:function(){this.game.events.on("destroy",this.destroy,this)}},{key:"add",value:function(t,e){return new m(t,e)}}]),n}()});
  