@eva/plugin-renderer-render 2.0.0-beta.5 → 2.0.0-beta.6

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.
@@ -66,29 +66,7 @@ var _EVA_IIFE_render = function (exports, eva_js, pluginRenderer) {
66
66
  const container = this.containerManager.getContainer(gameObject.id);
67
67
  container.alpha = component.alpha;
68
68
  container.visible = component.visible;
69
- if (component.sortDirty && component.sortableChildren) {
70
- const gameObjects = gameObject.transform.children.map(({
71
- gameObject
72
- }) => gameObject);
73
- const children = gameObjects.sort((a, b) => {
74
- const aRender = a.getComponent('Render');
75
- const bRender = b.getComponent('Render');
76
- if (!aRender) {
77
- return -1;
78
- }
79
- if (!bRender) {
80
- return 1;
81
- }
82
- return aRender.zIndex - bRender.zIndex;
83
- }).map(gameObject => {
84
- return this.containerManager.getContainer(gameObject.id);
85
- });
86
- const oldChildren = this.containerManager.getContainer(component.gameObject.id).children;
87
- const elements = oldChildren.filter(c => children.indexOf(c) === -1);
88
- oldChildren.length = 0;
89
- oldChildren.push(...elements, ...children);
90
- component.sortDirty = false;
91
- }
69
+ container.zIndex = component.zIndex;
92
70
  }
93
71
  componentChanged(changed) {
94
72
  if (changed.type === eva_js.OBSERVER_TYPE.ADD || changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
@@ -1 +1 @@
1
- function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_extends.apply(null,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_render=function(e,n,t){"use strict";function r(e,n,t,r){var o,i=arguments.length,s=i<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,n,t,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(n,t,s):o(n,t))||s);return i>3&&s&&Object.defineProperty(n,t,s),s}function o(e,n){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[n]||(e.constructor.IDEProps[n]={}),e.constructor.IDEProps[n]}function i(e){return function(n,t){var r=o(n,t);r.key=t,r.type=e}}function s(e){return function(n,t){o(n,t).step=e}}class a extends n.Component{constructor(){super(...arguments),this.sortDirty=!1,this.visible=!0,this.alpha=1,this.zIndex=0,this.sortableChildren=!1}init(e){e&&_extends(this,e)}}a.componentName="Render",r([i("boolean")],a.prototype,"visible",void 0),r([i("number"),s(.1)],a.prototype,"alpha",void 0),r([i("number"),s(1)],a.prototype,"zIndex",void 0),r([i("boolean")],a.prototype,"sortableChildren",void 0);let d=class extends t.Renderer{constructor(){super(...arguments),this.name="Render"}init(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const n=e.getComponent("Render"),t=this.containerManager.getContainer(e.id);if(t.alpha=n.alpha,t.visible=n.visible,n.sortDirty&&n.sortableChildren){const t=e.transform.children.map((({gameObject:e})=>e)).sort(((e,n)=>{const t=e.getComponent("Render"),r=n.getComponent("Render");return t?r?t.zIndex-r.zIndex:1:-1})).map((e=>this.containerManager.getContainer(e.id))),r=this.containerManager.getContainer(n.gameObject.id).children,o=r.filter((e=>-1===t.indexOf(e)));r.length=0,r.push(...o,...t),n.sortDirty=!1}}componentChanged(e){e.type!==n.OBSERVER_TYPE.ADD&&e.type!==n.OBSERVER_TYPE.REMOVE||this.add(e),e.type===n.OBSERVER_TYPE.CHANGE&&this.change(e),e.type===n.OBSERVER_TYPE.REMOVE&&this.remove(e)}add(e){"Render"===e.component.name&&this.setDirty(e)}change(e){"Render"===e.component.name&&"zIndex"===e.prop.prop[0]&&this.setDirty(e)}remove(e){if("Render"===e.component.name){this.containerManager.getContainer(e.gameObject.id).alpha=1}}setDirty(e){const n=e.gameObject.parent&&e.gameObject.parent.getComponent("Render");n&&(n.sortDirty=!0)}};d.systemName="Render",d=r([n.decorators.componentObserver({Render:["zIndex"]})],d);var c=d;return e.Render=a,e.RenderSystem=c,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer);window.EVA.plugin.renderer.render=window.EVA.plugin.renderer.render||_EVA_IIFE_render;
1
+ function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)({}).hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},_extends.apply(null,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_render=function(e,n,r){"use strict";function t(e,n,r,t){var o,i=arguments.length,s=i<3?n:null===t?t=Object.getOwnPropertyDescriptor(n,r):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,n,r,t);else for(var d=e.length-1;d>=0;d--)(o=e[d])&&(s=(i<3?o(s):i>3?o(n,r,s):o(n,r))||s);return i>3&&s&&Object.defineProperty(n,r,s),s}function o(e,n){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[n]||(e.constructor.IDEProps[n]={}),e.constructor.IDEProps[n]}function i(e){return function(n,r){var t=o(n,r);t.key=r,t.type=e}}function s(e){return function(n,r){o(n,r).step=e}}class d extends n.Component{constructor(){super(...arguments),this.sortDirty=!1,this.visible=!0,this.alpha=1,this.zIndex=0,this.sortableChildren=!1}init(e){e&&_extends(this,e)}}d.componentName="Render",t([i("boolean")],d.prototype,"visible",void 0),t([i("number"),s(.1)],d.prototype,"alpha",void 0),t([i("number"),s(1)],d.prototype,"zIndex",void 0),t([i("boolean")],d.prototype,"sortableChildren",void 0);let a=class extends r.Renderer{constructor(){super(...arguments),this.name="Render"}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const n=e.getComponent("Render"),r=this.containerManager.getContainer(e.id);r.alpha=n.alpha,r.visible=n.visible,r.zIndex=n.zIndex}componentChanged(e){e.type!==n.OBSERVER_TYPE.ADD&&e.type!==n.OBSERVER_TYPE.REMOVE||this.add(e),e.type===n.OBSERVER_TYPE.CHANGE&&this.change(e),e.type===n.OBSERVER_TYPE.REMOVE&&this.remove(e)}add(e){"Render"===e.component.name&&this.setDirty(e)}change(e){"Render"===e.component.name&&"zIndex"===e.prop.prop[0]&&this.setDirty(e)}remove(e){if("Render"===e.component.name){this.containerManager.getContainer(e.gameObject.id).alpha=1}}setDirty(e){const n=e.gameObject.parent&&e.gameObject.parent.getComponent("Render");n&&(n.sortDirty=!0)}};a.systemName="Render",a=t([n.decorators.componentObserver({Render:["zIndex"]})],a);var p=a;return e.Render=d,e.RenderSystem=p,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer);window.EVA.plugin.renderer.render=window.EVA.plugin.renderer.render||_EVA_IIFE_render;
@@ -71,29 +71,7 @@ let Render = class Render extends pluginRenderer.Renderer {
71
71
  const container = this.containerManager.getContainer(gameObject.id);
72
72
  container.alpha = component.alpha;
73
73
  container.visible = component.visible;
74
- if (component.sortDirty && component.sortableChildren) {
75
- const gameObjects = gameObject.transform.children.map(({ gameObject }) => gameObject);
76
- const children = gameObjects
77
- .sort((a, b) => {
78
- const aRender = a.getComponent('Render');
79
- const bRender = b.getComponent('Render');
80
- if (!aRender) {
81
- return -1;
82
- }
83
- if (!bRender) {
84
- return 1;
85
- }
86
- return aRender.zIndex - bRender.zIndex;
87
- })
88
- .map(gameObject => {
89
- return this.containerManager.getContainer(gameObject.id);
90
- });
91
- const oldChildren = this.containerManager.getContainer(component.gameObject.id).children;
92
- const elements = oldChildren.filter(c => children.indexOf(c) === -1);
93
- oldChildren.length = 0;
94
- oldChildren.push(...elements, ...children);
95
- component.sortDirty = false;
96
- }
74
+ container.zIndex = component.zIndex;
97
75
  }
98
76
  componentChanged(changed) {
99
77
  if (changed.type === eva_js.OBSERVER_TYPE.ADD || changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
@@ -13,4 +13,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
13
13
  See the Apache Version 2.0 License for specific language governing permissions
14
14
  and limitations under the License.
15
15
  ***************************************************************************** */
16
- function n(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}class o extends e.Component{constructor(){super(...arguments),this.sortDirty=!1,this.visible=!0,this.alpha=1,this.zIndex=0,this.sortableChildren=!1}init(e){e&&Object.assign(this,e)}}o.componentName="Render",n([t.type("boolean")],o.prototype,"visible",void 0),n([t.type("number"),t.step(.1)],o.prototype,"alpha",void 0),n([t.type("number"),t.step(1)],o.prototype,"zIndex",void 0),n([t.type("boolean")],o.prototype,"sortableChildren",void 0);let i=class extends r.Renderer{constructor(){super(...arguments),this.name="Render"}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const t=e.getComponent("Render"),r=this.containerManager.getContainer(e.id);if(r.alpha=t.alpha,r.visible=t.visible,t.sortDirty&&t.sortableChildren){const r=e.transform.children.map((({gameObject:e})=>e)).sort(((e,t)=>{const r=e.getComponent("Render"),n=t.getComponent("Render");return r?n?r.zIndex-n.zIndex:1:-1})).map((e=>this.containerManager.getContainer(e.id))),n=this.containerManager.getContainer(t.gameObject.id).children,o=n.filter((e=>-1===r.indexOf(e)));n.length=0,n.push(...o,...r),t.sortDirty=!1}}componentChanged(t){t.type!==e.OBSERVER_TYPE.ADD&&t.type!==e.OBSERVER_TYPE.REMOVE||this.add(t),t.type===e.OBSERVER_TYPE.CHANGE&&this.change(t),t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t)}add(e){"Render"===e.component.name&&this.setDirty(e)}change(e){"Render"===e.component.name&&"zIndex"===e.prop.prop[0]&&this.setDirty(e)}remove(e){if("Render"===e.component.name){this.containerManager.getContainer(e.gameObject.id).alpha=1}}setDirty(e){const t=e.gameObject.parent&&e.gameObject.parent.getComponent("Render");t&&(t.sortDirty=!0)}};i.systemName="Render",i=n([e.decorators.componentObserver({Render:["zIndex"]})],i);var s=i;exports.Render=o,exports.RenderSystem=s;
16
+ function n(e,t,r,n){var o,s=arguments.length,i=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,r,i):o(t,r))||i);return s>3&&i&&Object.defineProperty(t,r,i),i}class o extends e.Component{constructor(){super(...arguments),this.sortDirty=!1,this.visible=!0,this.alpha=1,this.zIndex=0,this.sortableChildren=!1}init(e){e&&Object.assign(this,e)}}o.componentName="Render",n([t.type("boolean")],o.prototype,"visible",void 0),n([t.type("number"),t.step(.1)],o.prototype,"alpha",void 0),n([t.type("number"),t.step(1)],o.prototype,"zIndex",void 0),n([t.type("boolean")],o.prototype,"sortableChildren",void 0);let s=class extends r.Renderer{constructor(){super(...arguments),this.name="Render"}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const t=e.getComponent("Render"),r=this.containerManager.getContainer(e.id);r.alpha=t.alpha,r.visible=t.visible,r.zIndex=t.zIndex}componentChanged(t){t.type!==e.OBSERVER_TYPE.ADD&&t.type!==e.OBSERVER_TYPE.REMOVE||this.add(t),t.type===e.OBSERVER_TYPE.CHANGE&&this.change(t),t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t)}add(e){"Render"===e.component.name&&this.setDirty(e)}change(e){"Render"===e.component.name&&"zIndex"===e.prop.prop[0]&&this.setDirty(e)}remove(e){if("Render"===e.component.name){this.containerManager.getContainer(e.gameObject.id).alpha=1}}setDirty(e){const t=e.gameObject.parent&&e.gameObject.parent.getComponent("Render");t&&(t.sortDirty=!0)}};s.systemName="Render",s=n([e.decorators.componentObserver({Render:["zIndex"]})],s);var i=s;exports.Render=o,exports.RenderSystem=i;
@@ -67,29 +67,7 @@ let Render = class Render extends Renderer {
67
67
  const container = this.containerManager.getContainer(gameObject.id);
68
68
  container.alpha = component.alpha;
69
69
  container.visible = component.visible;
70
- if (component.sortDirty && component.sortableChildren) {
71
- const gameObjects = gameObject.transform.children.map(({ gameObject }) => gameObject);
72
- const children = gameObjects
73
- .sort((a, b) => {
74
- const aRender = a.getComponent('Render');
75
- const bRender = b.getComponent('Render');
76
- if (!aRender) {
77
- return -1;
78
- }
79
- if (!bRender) {
80
- return 1;
81
- }
82
- return aRender.zIndex - bRender.zIndex;
83
- })
84
- .map(gameObject => {
85
- return this.containerManager.getContainer(gameObject.id);
86
- });
87
- const oldChildren = this.containerManager.getContainer(component.gameObject.id).children;
88
- const elements = oldChildren.filter(c => children.indexOf(c) === -1);
89
- oldChildren.length = 0;
90
- oldChildren.push(...elements, ...children);
91
- component.sortDirty = false;
92
- }
70
+ container.zIndex = component.zIndex;
93
71
  }
94
72
  componentChanged(changed) {
95
73
  if (changed.type === OBSERVER_TYPE.ADD || changed.type === OBSERVER_TYPE.REMOVE) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-render",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "@eva/plugin-renderer-render",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-render.esm.js",
@@ -19,9 +19,9 @@
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
21
  "@eva/inspector-decorator": "^0.0.5",
22
- "@eva/plugin-renderer": "2.0.0-beta.5",
23
- "@eva/renderer-adapter": "2.0.0-beta.5",
24
- "@eva/eva.js": "2.0.0-beta.5",
25
- "pixi.js": "^8.6.3"
22
+ "@eva/plugin-renderer": "2.0.0-beta.6",
23
+ "@eva/renderer-adapter": "2.0.0-beta.6",
24
+ "@eva/eva.js": "2.0.0-beta.6",
25
+ "pixi.js": "^8.6.5"
26
26
  }
27
27
  }