@eva/plugin-renderer-event 2.0.0-beta.2 → 2.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
globalThis.EVA = globalThis.EVA || {};
|
|
3
|
+
globalThis.EVA.plugin = globalThis.EVA.plugin || {};
|
|
4
|
+
globalThis.EVA.plugin.renderer = globalThis.EVA.plugin.renderer || {};
|
|
5
5
|
var _EVA_IIFE_event = function (exports, pluginRenderer, eva_js, pixi_js) {
|
|
6
6
|
'use strict';
|
|
7
7
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -220,4 +220,4 @@ var _EVA_IIFE_event = function (exports, pluginRenderer, eva_js, pixi_js) {
|
|
|
220
220
|
});
|
|
221
221
|
return exports;
|
|
222
222
|
}({}, EVA.plugin.renderer, EVA, PIXI);
|
|
223
|
-
|
|
223
|
+
globalThis.EVA.plugin.renderer.event = globalThis.EVA.plugin.renderer.event || _EVA_IIFE_event;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var a in o)({}).hasOwnProperty.call(o,a)&&(e[a]=o[a])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_event=function(e,t,o,a){"use strict";const n={Circle:a.Circle,Ellipse:a.Ellipse,Polygon:a.Polygon,Rect:a.Rectangle,RoundedRect:a.RoundedRectangle},r={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]};let i=class extends t.Renderer{constructor(){super(...arguments),this.name="Event"}init(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){switch(e.type){case o.OBSERVER_TYPE.ADD:this.add(e);break;case o.OBSERVER_TYPE.REMOVE:this.remove(e);break;case o.OBSERVER_TYPE.CHANGE:this.change(e)}}add(e){const t=this.containerManager.getContainer(e.gameObject.id);t.interactive=!0,t.interactiveChildren=!0;const o=e.component;o.hitArea&&this.addHitArea(e,t,o.hitArea),t.on("pointertap",(e=>{o.emit("tap",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y},localPosition:t.worldTransform.applyInverse(e.data.global)},gameObject:o.gameObject})})),t.on("pointerdown",(e=>{o.emit("touchstart",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y},localPosition:t.worldTransform.applyInverse(e.data.global)},gameObject:o.gameObject})})),t.on("pointermove",(e=>{o.emit("touchmove",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y},localPosition:t.worldTransform.applyInverse(e.data.global)},gameObject:o.gameObject})})),t.on("pointerup",(e=>{o.emit("touchend",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y},localPosition:t.worldTransform.applyInverse(e.data.global)},gameObject:o.gameObject})})),t.on("pointerupoutside",(e=>{o.emit("touchendoutside",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y},localPosition:t.worldTransform.applyInverse(e.data.global)},gameObject:o.gameObject})})),t.on("pointercancel",(e=>{o.emit("touchcancel",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y},localPosition:t.worldTransform.applyInverse(e.data.global)},gameObject:o.gameObject})}))}remove(e){const t=this.containerManager.getContainer(e.gameObject.id);t.interactive=!1,t.off("tap"),t.off("pointerdown"),t.off("pointermove"),t.off("pointerup"),t.off("pointerupoutside"),t.off("pointercancel"),e.component.removeAllListeners()}change(e){const t=this.containerManager.getContainer(e.gameObject.id);t.interactive=!0;const o=e.component;o.hitArea?this.addHitArea(e,t,o.hitArea):o.hitArea=null}addHitArea(e,t,o){const{type:a,style:i}=o;if(!n[a])return void console.error(`${e.gameObject.name}'s hitArea type is not defined`);const l=[];for(const e of r[a])l.push(i[e]);const s=new n[a](...l);t.hitArea=s}};i.systemName="Event",i=function(e,t,o,a){var n,r=arguments.length,i=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,o):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,o,a);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(i=(r<3?n(i):r>3?n(t,o,i):n(t,o))||i);return r>3&&i&&Object.defineProperty(t,o,i),i}([o.decorators.componentObserver({Event:[{prop:["hitArea"],deep:!0}]})],i);var l,s=i;e.HIT_AREA_TYPE=void 0,(l=e.HIT_AREA_TYPE||(e.HIT_AREA_TYPE={})).Circle="Circle",l.Ellipse="Ellipse",l.Polygon="Polygon",l.Rect="Rect",l.RoundedRect="RoundedRect";class d extends o.Component{constructor(){super(...arguments),this.hitArea=void 0}init(e){e&&_extends(this,e)}emit(e,...t){return super.emit(e,...t)}once(e,t,o){return super.once(e,t,o)}on(e,t,o){return super.on(e,t,o)}}return d.componentName="Event",e.Event=d,e.EventSystem=s,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA.plugin.renderer,EVA,PIXI);globalThis.EVA.plugin.renderer.event=globalThis.EVA.plugin.renderer.event||_EVA_IIFE_event;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-event",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.20",
|
|
4
4
|
"description": "@eva/plugin-renderer-event",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-event.esm.js",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/plugin-renderer": "2.0.0-beta.
|
|
22
|
-
"@eva/eva.js": "2.0.0-beta.
|
|
23
|
-
"pixi.js": "^8.
|
|
21
|
+
"@eva/plugin-renderer": "2.0.0-beta.20",
|
|
22
|
+
"@eva/eva.js": "2.0.0-beta.20",
|
|
23
|
+
"pixi.js": "^8.8.1"
|
|
24
24
|
}
|
|
25
25
|
}
|