UNPKG

phaser3-rex-plugins

Version:
2 lines (1 loc) 3.97 kB
!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).rexviewportcoordinateplugin=e();}(undefined,(function(){function t(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,(o=r.key,i=void 0,"symbol"==typeof(i=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(o,"string"))?i:String(i)),r);}var o,i;}function e(t){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},e(t)}function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}function r(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 o(t){var n=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 o,i=e(t);if(n){var u=e(this).constructor;o=Reflect.construct(i,arguments,u);}else o=i.apply(this,arguments);return r(this,o)}}var i=Phaser.Events.EventEmitter,u=function(t,e,n,r,o,i){return void 0===i?i={}:!0===i&&(i=f),"number"!=typeof n&&(n=0,r=0),i.x=o.x+o.width*t+n,i.y=o.y+o.height*e+r,i},f={},c=function(t,e,n,r,o,f,c){if(t.hasOwnProperty("vp"))return t;"function"==typeof n&&(c=n,n=void 0),"function"==typeof o&&(c=o,o=void 0),void 0===n&&(n=.5),void 0===r&&(r=.5),void 0===o&&(o=0),void 0===f&&(f=0),void 0===c&&(c=u),function(t){if(t.events)return t;var e=new i,n=t.x;Object.defineProperty(t,"x",{get:function(){return n},set:function(r){n!==r&&(n=r,e.emit("update",t));}});var r=t.y;Object.defineProperty(t,"y",{get:function(){return r},set:function(n){r!==n&&(r=n,e.emit("update",t));}});var o=t.width;Object.defineProperty(t,"width",{get:function(){return o},set:function(n){o!==n&&(o=n,e.emit("update",t));}});var u=t.height;Object.defineProperty(t,"height",{get:function(){return u},set:function(n){u!==n&&(u=n,e.emit("update",t));}}),t.events=e;}(e);var p=e.events;t.vp=e;var a=function(){c(n,r,o,f,e,t);};p.on("update",a),t.once("destroy",(function(){p.off("update",a),t.vp=void 0;})),Object.defineProperty(t,"vpx",{get:function(){return n},set:function(t){n!==t&&(n=t,a());}}),Object.defineProperty(t,"vpy",{get:function(){return r},set:function(t){r!==t&&(r=t,a());}}),Object.defineProperty(t,"vpxOffset",{get:function(){return o},set:function(t){o!==t&&(o=t,a());}}),Object.defineProperty(t,"vpyOffset",{get:function(){return f},set:function(t){f!==t&&(f=t,a());}}),a();};return function(e){!function(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e);}(a,Phaser.Plugins.BasePlugin);var r,i,p=o(a);function a(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),p.call(this,t)}return r=a,(i=[{key:"start",value:function(){this.game.events.on("destroy",this.destroy,this);}},{key:"add",value:function(t,e,n,r,o){return c(t,e,n,r,o)}},{key:"vpxyToxy",value:function(t,e,n,r){return u(t,e,n,r)}}])&&t(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),a}()}));