@eva/plugin-renderer-event 2.0.1 → 2.0.2-beta.0
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 +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 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",
|
|
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;
|
|
@@ -6,19 +6,19 @@ var pluginRenderer = require('@eva/plugin-renderer');
|
|
|
6
6
|
var eva_js = require('@eva/eva.js');
|
|
7
7
|
var pixi_js = require('pixi.js');
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
Copyright (c) Microsoft Corporation.
|
|
11
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
12
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
13
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
/******************************************************************************
|
|
10
|
+
Copyright (c) Microsoft Corporation.
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
18
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
13
|
+
purpose with or without fee is hereby granted.
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
18
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
22
22
|
***************************************************************************** */
|
|
23
23
|
|
|
24
24
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -26,7 +26,12 @@ function __decorate(decorators, target, key, desc) {
|
|
|
26
26
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
27
27
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
28
28
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
32
|
+
var e = new Error(message);
|
|
33
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
34
|
+
};
|
|
30
35
|
|
|
31
36
|
const hitAreaFunc = {
|
|
32
37
|
Circle: pixi_js.Circle,
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/plugin-renderer"),t=require("@eva/eva.js"),o=require("pixi.js");const a={Circle:o.Circle,Ellipse:o.Ellipse,Polygon:o.Polygon,Rect:o.Rectangle,RoundedRect:o.RoundedRectangle},n={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]};let r=class extends e.Renderer{constructor(){super(...arguments),this.name="Event"}init(){this.renderSystem=this.game.getSystem(e.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){switch(e.type){case t.OBSERVER_TYPE.ADD:this.add(e);break;case t.OBSERVER_TYPE.REMOVE:this.remove(e);break;case t.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",
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
6
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
|
|
8
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
9
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
10
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
11
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
-
|
|
13
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
|
-
and limitations under the License.
|
|
15
|
-
***************************************************************************** */
|
|
16
|
-
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 s=e.length-1;s>=0;s--)(n=e[s])&&(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}([t.decorators.componentObserver({Event:[{prop:["hitArea"],deep:!0}]})],r);var i,s=r;exports.HIT_AREA_TYPE=void 0,(i=exports.HIT_AREA_TYPE||(exports.HIT_AREA_TYPE={})).Circle="Circle",i.Ellipse="Ellipse",i.Polygon="Polygon",i.Rect="Rect",i.RoundedRect="RoundedRect";class p extends t.Component{constructor(){super(...arguments),this.hitArea=void 0}init(e){e&&Object.assign(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)}}p.componentName="Event",exports.Event=p,exports.EventSystem=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/plugin-renderer"),t=require("@eva/eva.js"),o=require("pixi.js");"function"==typeof SuppressedError&&SuppressedError;const a={Circle:o.Circle,Ellipse:o.Ellipse,Polygon:o.Polygon,Rect:o.Rectangle,RoundedRect:o.RoundedRectangle},n={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]};let r=class extends e.Renderer{constructor(){super(...arguments),this.name="Event"}init(){this.renderSystem=this.game.getSystem(e.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){switch(e.type){case t.OBSERVER_TYPE.ADD:this.add(e);break;case t.OBSERVER_TYPE.REMOVE:this.remove(e);break;case t.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:r,style:i}=o;if(!a[r])return void console.error(`${e.gameObject.name}'s hitArea type is not defined`);const s=[];for(const e of n[r])s.push(i[e]);const p=new a[r](...s);t.hitArea=p}};r.systemName="Event",r=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 s=e.length-1;s>=0;s--)(n=e[s])&&(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}([t.decorators.componentObserver({Event:[{prop:["hitArea"],deep:!0}]})],r);var i,s=r;exports.HIT_AREA_TYPE=void 0,(i=exports.HIT_AREA_TYPE||(exports.HIT_AREA_TYPE={})).Circle="Circle",i.Ellipse="Ellipse",i.Polygon="Polygon",i.Rect="Rect",i.RoundedRect="RoundedRect";class p extends t.Component{constructor(){super(...arguments),this.hitArea=void 0}init(e){e&&Object.assign(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)}}p.componentName="Event",exports.Event=p,exports.EventSystem=s;
|
|
@@ -2,19 +2,19 @@ import { Renderer, RendererSystem } from '@eva/plugin-renderer';
|
|
|
2
2
|
import { OBSERVER_TYPE, decorators, Component } from '@eva/eva.js';
|
|
3
3
|
import { Circle, Ellipse, Polygon, Rectangle, RoundedRectangle } from 'pixi.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
8
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
9
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
/******************************************************************************
|
|
6
|
+
Copyright (c) Microsoft Corporation.
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
14
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
8
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
+
purpose with or without fee is hereby granted.
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
18
18
|
***************************************************************************** */
|
|
19
19
|
|
|
20
20
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -22,7 +22,12 @@ function __decorate(decorators, target, key, desc) {
|
|
|
22
22
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23
23
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24
24
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
28
|
+
var e = new Error(message);
|
|
29
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
30
|
+
};
|
|
26
31
|
|
|
27
32
|
const hitAreaFunc = {
|
|
28
33
|
Circle,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-event",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2-beta.0",
|
|
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.
|
|
22
|
-
"@eva/eva.js": "2.0.
|
|
21
|
+
"@eva/plugin-renderer": "2.0.2-beta.0",
|
|
22
|
+
"@eva/eva.js": "2.0.2-beta.0",
|
|
23
23
|
"pixi.js": "^8.17.0"
|
|
24
24
|
}
|
|
25
25
|
}
|