Socket
Socket
Sign inDemoInstall

@eva/plugin-renderer

Package Overview
Dependencies
Maintainers
2
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eva/plugin-renderer - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1-alpha.1

2

dist/plugin-renderer.cjs.prod.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/renderer-adapter"),r=require("lodash"),n=require("pixi.js"),o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function a(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function s(e,t,r,n){var o,a=arguments.length,i=a<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 s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function p(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function l(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(p(arguments[t]));return e}var f=function(){function t(e){var t=e.game,r=e.rendererSystem;this.renderers=[],this.game=t,this.rendererSystem=r}return t.prototype.register=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=c(r),a=o.next();!a.done;a=o.next()){var i=a.value;i.game=this.game,i.rendererManager=this.rendererSystem.rendererManager,i.containerManager=this.rendererSystem.containerManager,this.renderers.push(i)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}},t.prototype.componentChanged=function(t){var n,o,a=function(t){var n,o;try{for(var a=(n=void 0,c(i.renderers)),s=a.next();!s.done;s=a.next()){var p=s.value,l=p.observerInfo[t.componentName];if(l){if([e.OBSERVER_TYPE.ADD,e.OBSERVER_TYPE.REMOVE].indexOf(t.type)>-1){try{p.componentChanged&&p.componentChanged(t)}catch(e){console.error("gameObject: "+t.gameObject.name+", "+t.componentName+" is error.",t,e)}continue}if(l.findIndex((function(e){return r.isEqual(e,t.prop)}))>-1)try{p.componentChanged&&p.componentChanged(t)}catch(e){console.error("gameObject: "+(t.gameObject&&t.gameObject.name)+", "+t.componentName+" is componentChanged error.",t,e)}}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},i=this;try{for(var s=c(t),p=s.next();!p.done;p=s.next()){a(p.value)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}},t.prototype.update=function(e){var t,r,n,o;try{for(var a=c(e.components),i=a.next();!i.done;i=a.next()){var s=i.value;try{for(var p=(n=void 0,c(this.renderers)),l=p.next();!l.done;l=p.next()){var f=l.value,h=[];if(f.observerInfo[s.name]&&-1===h.indexOf(e)){h.push(e);try{f.rendererUpdate&&f.rendererUpdate(e)}catch(t){console.info("gameObject: "+e.name+", "+s.name+" is update error",t)}}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}},t}(),h=function(){function e(){this.containerMap={}}return e.prototype.addContainer=function(e){var t=e.name,r=e.container;this.containerMap[t]=r},e.prototype.getContainer=function(e){return this.containerMap[e]},e.prototype.removeContainer=function(e){delete this.containerMap[e]},e.prototype.updateTransform=function(e){var t=e.name,r=e.transform,n=this.containerMap[t];if(n){var o=r.anchor,a=r.origin,i=r.position,s=r.rotation,c=r.scale,p=r.size,l=r.skew;n.rotation=s,n.scale=c,n.pivot.x=p.width*a.x,n.pivot.y=p.height*a.y,n.skew=l;var f=i.x,h=i.y;if(r.parent){var u=r.parent;f+=u.size.width*o.x,h+=u.size.height*o.y}n.position={x:f,y:h}}},e}();var u,v,y=function(r){function n(e){var t=e.system,n=e.containerManager,o=r.call(this)||this;return o.name="Transform",o.waitRemoveIds=[],o.waitChangeScenes=[],o.containerManager=n,o.init(t),o}return a(n,r),n.prototype.init=function(e){var t=this;this.system=e,this.on("changeScene",(function(e){var r=e.scene,n=e.mode,o=e.application;t.waitChangeScenes.push({scene:r,mode:n,application:o})}))},n.prototype.update=function(){var e,t,r,n;try{for(var o=c(this.waitRemoveIds),a=o.next();!a.done;a=o.next()){var i=a.value;this.containerManager.removeContainer(i)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.waitRemoveIds=[];try{for(var s=c(this.waitChangeScenes),p=s.next();!p.done;p=s.next()){var l=p.value,f=this.containerManager.getContainer(l.scene.id);f&&(l.application.stage.removeChildren(),l.application.stage.addChild(f))}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}this.waitChangeScenes=[]},n.prototype.componentChanged=function(t){t.type===e.OBSERVER_TYPE.ADD?this.addContainer(t):t.type===e.OBSERVER_TYPE.CHANGE?this.change(t):t.type===e.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(t.gameObject.id)},n.prototype.addContainer=function(e){var r=new t.Container;r.name=e.gameObject.name,this.containerManager.addContainer({name:e.gameObject.id,container:r}),e.component.worldTransform=r.transform.worldTransform},n.prototype.change=function(e){var t=e.component;if(t.parent){this.containerManager.getContainer(t.parent.gameObject.id).addChild(this.containerManager.getContainer(e.gameObject.id));var r=e.gameObject.transform.parent&&e.gameObject.transform.parent.gameObject.getComponent("Render");r&&(r.sortDirty=!0)}else{var n=this.containerManager.getContainer(e.gameObject.id);n.parent&&n.parent.removeChild(n)}},n.prototype.destroy=function(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null},n=s([e.decorators.componentObserver({Transform:["_parent"]})],n)}((function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,n,a,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,a||e,i),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function i(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,a=n.length,i=new Array(a);o<a;o++)i[o]=n[o].fn;return i},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,o,a,i){var s=r?r+e:e;if(!this._events[s])return!1;var c,p,l=this._events[s],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,o),!0;case 5:return l.fn.call(l.context,t,n,o,a),!0;case 6:return l.fn.call(l.context,t,n,o,a,i),!0}for(p=1,c=new Array(f-1);p<f;p++)c[p-1]=arguments[p];l.fn.apply(l.context,c)}else{var h,u=l.length;for(p=0;p<u;p++)switch(l[p].once&&this.removeListener(e,l[p].fn,void 0,!0),f){case 1:l[p].fn.call(l[p].context);break;case 2:l[p].fn.call(l[p].context,t);break;case 3:l[p].fn.call(l[p].context,t,n);break;case 4:l[p].fn.call(l[p].context,t,n,o);break;default:if(!c)for(h=1,c=new Array(f-1);h<f;h++)c[h-1]=arguments[h];l[p].fn.apply(l[p].context,c)}}return!0},s.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,o){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return i(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||o&&!s.once||n&&s.context!==n||i(this,a);else{for(var c=0,p=[],l=s.length;c<l;c++)(s[c].fn!==t||o&&!s[c].once||n&&s[c].context!==n)&&p.push(s[c]);p.length?this._events[a]=1===p.length?p[0]:p:i(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&i(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(u={exports:{}},u.exports),u.exports));exports.RENDERER_TYPE=void 0,(v=exports.RENDERER_TYPE||(exports.RENDERER_TYPE={}))[v.UNKNOWN=0]="UNKNOWN",v[v.WEBGL=1]="WEBGL",v[v.CANVAS=2]="CANVAS";var d=function(r){function o(){var e=null!==r&&r.apply(this,arguments)||this;return e.multiApps=[],e}return a(o,r),o.prototype.init=function(t){var r=this;this.params=t,this.application=this.createApplication(t),this.containerManager=new h,this.rendererManager=new f({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new y({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(t){var n,o=t.scene,a=t.mode,i=t.params;switch(a){case e.LOAD_SCENE_MODE.SINGLE:n=r.application;break;case e.LOAD_SCENE_MODE.MULTI_CANVAS:n=r.createMultiApplication({params:i})}o.canvas=n.view,r.transform.emit("changeScene",{scene:o,mode:a,application:n})}))},o.prototype.registerObserver=function(e){var t,r=this.constructor.observerInfo;for(var n in e)r[n]||(r[n]=[]),(t=r[n]).push.apply(t,l(e[n]))},o.prototype.createMultiApplication=function(e){var t=e.params,r=this.createApplication(t);return this.multiApps.push(r),r},o.prototype.createApplication=function(e){e.view=e.canvas,e.renderType===exports.RENDERER_TYPE.CANVAS&&(e.forceCanvas=!0),n.ticker.shared.autoStart=!1,n.ticker.shared.stop();var r=new t.Application(i({sharedTicker:!0},e));return!1!==e.preventScroll&&(r.renderer.plugins.interaction.autoPreventDefault=!1,r.renderer.view.style.touchAction="auto"),r},o.prototype.update=function(e){var t,r,n,o,a=this.componentObserver.clear();try{for(var i=c(a),s=i.next();!s.done;s=i.next()){var p=s.value;this.transform.componentChanged(p)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}try{for(var l=c(this.game.gameObjects),f=l.next();!f.done;f=l.next()){var h=f.value;this.containerManager.updateTransform({name:h.id,transform:h.transform}),this.rendererManager.update(h)}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}this.application.ticker.update(e.time)},o.prototype.lateUpdate=function(){this.transform.update()},o.prototype.onDestroy=function(){var e,t;this.application.destroy();try{for(var r=c(this.multiApps),n=r.next();!n.done;n=r.next()){var o=n.value;o&&o.destroy()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.transform.destroy(),this.transform=null,this.params=null,this.rendererManager=null,this.containerManager=null,this.application=null,this.game=null,this.multiApps=null},o.systemName="Renderer",o=s([e.decorators.componentObserver({Transform:["_parent"]})],o)}(e.System),m=function(e){function t(){var t=e.call(this)||this;return t.observerInfo=t.constructor.observerInfo,t}return a(t,e),t.prototype.update=function(){var e,t,r=this.componentObserver.clear();try{for(var n=c(r),o=n.next();!o.done;o=n.next()){var a=o.value;this.componentChanged(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},t}(e.System);exports.ContainerManager=h,exports.Renderer=m,exports.RendererManager=f,exports.RendererSystem=d;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/renderer-adapter"),r=require("eventemitter3"),n=require("pixi.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(r),i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function c(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function u(e,t,r,n){var o,a=arguments.length,i=a<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 c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function f(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function p(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function l(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(p(arguments[t]));return e}var h=function(){this.__data__=[],this.size=0};var v=function(e,t){return e===t||e!=e&&t!=t};var y=function(e,t){for(var r=e.length;r--;)if(v(e[r][0],t))return r;return-1},d=Array.prototype.splice;var b=function(e){var t=this.__data__,r=y(t,e);return!(r<0)&&(r==t.length-1?t.pop():d.call(t,r,1),--this.size,!0)};var _=function(e){var t=this.__data__,r=y(t,e);return r<0?void 0:t[r][1]};var g=function(e){return y(this.__data__,e)>-1};var m=function(e,t){var r=this.__data__,n=y(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function j(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}j.prototype.clear=h,j.prototype.delete=b,j.prototype.get=_,j.prototype.has=g,j.prototype.set=m;var O=j;var w=function(){this.__data__=new O,this.size=0};var E=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var x=function(e){return this.__data__.get(e)};var A=function(e){return this.__data__.has(e)},S="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},M="object"==typeof S&&S&&S.Object===Object&&S;function C(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}function R(e){var t={exports:{}};return e(t,t.exports),t.exports}module.exports=M;var P=C(Object.freeze({__proto__:null})),z="object"==typeof self&&self&&self.Object===Object&&self,T=P||z||Function("return this")(),N=T.Symbol,D=Object.prototype,k=D.hasOwnProperty,I=D.toString,V=N?N.toStringTag:void 0;var B=function(e){var t=k.call(e,V),r=e[V];try{e[V]=void 0;var n=!0}catch(e){}var o=I.call(e);return n&&(t?e[V]=r:delete e[V]),o},L=Object.prototype.toString;var U=function(e){return L.call(e)},F=N?N.toStringTag:void 0;var Y=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":F&&F in Object(e)?B(e):U(e)};var W=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var $,q=function(e){if(!W(e))return!1;var t=Y(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},G=T["__core-js_shared__"],K=($=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"";var H=function(e){return!!K&&K in e},J=Function.prototype.toString;var Q=function(e){if(null!=e){try{return J.call(e)}catch(e){}try{return e+""}catch(e){}}return""},X=/^\[object .+?Constructor\]$/,Z=Function.prototype,ee=Object.prototype,te=Z.toString,re=ee.hasOwnProperty,ne=RegExp("^"+te.call(re).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var oe=function(e){return!(!W(e)||H(e))&&(q(e)?ne:X).test(Q(e))};var ae=function(e,t){return null==e?void 0:e[t]};var ie=function(e,t){var r=ae(e,t);return oe(r)?r:void 0},ce=ie(T,"Map"),se=ie(Object,"create");var ue=function(){this.__data__=se?se(null):{},this.size=0};var fe=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},pe=Object.prototype.hasOwnProperty;var le=function(e){var t=this.__data__;if(se){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return pe.call(t,e)?t[e]:void 0},he=Object.prototype.hasOwnProperty;var ve=function(e){var t=this.__data__;return se?void 0!==t[e]:he.call(t,e)};var ye=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=se&&void 0===t?"__lodash_hash_undefined__":t,this};function de(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}de.prototype.clear=ue,de.prototype.delete=fe,de.prototype.get=le,de.prototype.has=ve,de.prototype.set=ye;var be=de;var _e=function(){this.size=0,this.__data__={hash:new be,map:new(ce||O),string:new be}};var ge=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var me=function(e,t){var r=e.__data__;return ge(t)?r["string"==typeof t?"string":"hash"]:r.map};var je=function(e){var t=me(this,e).delete(e);return this.size-=t?1:0,t};var Oe=function(e){return me(this,e).get(e)};var we=function(e){return me(this,e).has(e)};var Ee=function(e,t){var r=me(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function xe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}xe.prototype.clear=_e,xe.prototype.delete=je,xe.prototype.get=Oe,xe.prototype.has=we,xe.prototype.set=Ee;var Ae=xe;var Se=function(e,t){var r=this.__data__;if(r instanceof O){var n=r.__data__;if(!ce||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ae(n)}return r.set(e,t),this.size=r.size,this};function Me(e){var t=this.__data__=new O(e);this.size=t.size}Me.prototype.clear=w,Me.prototype.delete=E,Me.prototype.get=x,Me.prototype.has=A,Me.prototype.set=Se;var Ce=Me;var Re=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Pe=function(e){return this.__data__.has(e)};function ze(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Ae;++t<r;)this.add(e[t])}ze.prototype.add=ze.prototype.push=Re,ze.prototype.has=Pe;var Te=ze;var Ne=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1};var De=function(e,t){return e.has(t)};var ke=function(e,t,r,n,o,a){var i=1&r,c=e.length,s=t.length;if(c!=s&&!(i&&s>c))return!1;var u=a.get(e),f=a.get(t);if(u&&f)return u==t&&f==e;var p=-1,l=!0,h=2&r?new Te:void 0;for(a.set(e,t),a.set(t,e);++p<c;){var v=e[p],y=t[p];if(n)var d=i?n(y,v,p,t,e,a):n(v,y,p,e,t,a);if(void 0!==d){if(d)continue;l=!1;break}if(h){if(!Ne(t,(function(e,t){if(!De(h,t)&&(v===e||o(v,e,r,n,a)))return h.push(t)}))){l=!1;break}}else if(v!==y&&!o(v,y,r,n,a)){l=!1;break}}return a.delete(e),a.delete(t),l},Ie=T.Uint8Array;var Ve=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var Be=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},Le=N?N.prototype:void 0,Ue=Le?Le.valueOf:void 0;var Fe=function(e,t,r,n,o,a,i){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new Ie(e),new Ie(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return v(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var c=Ve;case"[object Set]":var s=1&n;if(c||(c=Be),e.size!=t.size&&!s)return!1;var u=i.get(e);if(u)return u==t;n|=2,i.set(e,t);var f=ke(c(e),c(t),n,o,a,i);return i.delete(e),f;case"[object Symbol]":if(Ue)return Ue.call(e)==Ue.call(t)}return!1};var Ye=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e},We=Array.isArray;var $e=function(e,t,r){var n=t(e);return We(e)?n:Ye(n,r(e))};var qe=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a};var Ge=function(){return[]},Ke=Object.prototype.propertyIsEnumerable,He=Object.getOwnPropertySymbols,Je=He?function(e){return null==e?[]:(e=Object(e),qe(He(e),(function(t){return Ke.call(e,t)})))}:Ge;var Qe=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var Xe=function(e){return null!=e&&"object"==typeof e};var Ze=function(e){return Xe(e)&&"[object Arguments]"==Y(e)},et=Object.prototype,tt=et.hasOwnProperty,rt=et.propertyIsEnumerable,nt=Ze(function(){return arguments}())?Ze:function(e){return Xe(e)&&tt.call(e,"callee")&&!rt.call(e,"callee")};var ot=function(){return!1},at=R((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?T.Buffer:void 0,a=(o?o.isBuffer:void 0)||ot;e.exports=a})),it=/^(?:0|[1-9]\d*)$/;var ct=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&it.test(e))&&e>-1&&e%1==0&&e<t};var st=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},ut={};ut["[object Float32Array]"]=ut["[object Float64Array]"]=ut["[object Int8Array]"]=ut["[object Int16Array]"]=ut["[object Int32Array]"]=ut["[object Uint8Array]"]=ut["[object Uint8ClampedArray]"]=ut["[object Uint16Array]"]=ut["[object Uint32Array]"]=!0,ut["[object Arguments]"]=ut["[object Array]"]=ut["[object ArrayBuffer]"]=ut["[object Boolean]"]=ut["[object DataView]"]=ut["[object Date]"]=ut["[object Error]"]=ut["[object Function]"]=ut["[object Map]"]=ut["[object Number]"]=ut["[object Object]"]=ut["[object RegExp]"]=ut["[object Set]"]=ut["[object String]"]=ut["[object WeakMap]"]=!1;var ft=function(e){return Xe(e)&&st(e.length)&&!!ut[Y(e)]};var pt=function(e){return function(t){return e(t)}},lt=R((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&P.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a})),ht=lt&&lt.isTypedArray,vt=ht?pt(ht):ft,yt=Object.prototype.hasOwnProperty;var dt=function(e,t){var r=We(e),n=!r&&nt(e),o=!r&&!n&&at(e),a=!r&&!n&&!o&&vt(e),i=r||n||o||a,c=i?Qe(e.length,String):[],s=c.length;for(var u in e)!t&&!yt.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ct(u,s))||c.push(u);return c},bt=Object.prototype;var _t=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||bt)};var gt=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),mt=Object.prototype.hasOwnProperty;var jt=function(e){if(!_t(e))return gt(e);var t=[];for(var r in Object(e))mt.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Ot=function(e){return null!=e&&st(e.length)&&!q(e)};var wt=function(e){return Ot(e)?dt(e):jt(e)};var Et=function(e){return $e(e,wt,Je)},xt=Object.prototype.hasOwnProperty;var At=function(e,t,r,n,o,a){var i=1&r,c=Et(e),s=c.length;if(s!=Et(t).length&&!i)return!1;for(var u=s;u--;){var f=c[u];if(!(i?f in t:xt.call(t,f)))return!1}var p=a.get(e),l=a.get(t);if(p&&l)return p==t&&l==e;var h=!0;a.set(e,t),a.set(t,e);for(var v=i;++u<s;){var y=e[f=c[u]],d=t[f];if(n)var b=i?n(d,y,f,t,e,a):n(y,d,f,e,t,a);if(!(void 0===b?y===d||o(y,d,r,n,a):b)){h=!1;break}v||(v="constructor"==f)}if(h&&!v){var _=e.constructor,g=t.constructor;_==g||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof g&&g instanceof g||(h=!1)}return a.delete(e),a.delete(t),h},St=ie(T,"DataView"),Mt=ie(T,"Promise"),Ct=ie(T,"Set"),Rt=ie(T,"WeakMap"),Pt=Q(St),zt=Q(ce),Tt=Q(Mt),Nt=Q(Ct),Dt=Q(Rt),kt=Y;(St&&"[object DataView]"!=kt(new St(new ArrayBuffer(1)))||ce&&"[object Map]"!=kt(new ce)||Mt&&"[object Promise]"!=kt(Mt.resolve())||Ct&&"[object Set]"!=kt(new Ct)||Rt&&"[object WeakMap]"!=kt(new Rt))&&(kt=function(e){var t=Y(e),r="[object Object]"==t?e.constructor:void 0,n=r?Q(r):"";if(n)switch(n){case Pt:return"[object DataView]";case zt:return"[object Map]";case Tt:return"[object Promise]";case Nt:return"[object Set]";case Dt:return"[object WeakMap]"}return t});var It=kt,Vt="[object Object]",Bt=Object.prototype.hasOwnProperty;var Lt=function(e,t,r,n,o,a){var i=We(e),c=We(t),s=i?"[object Array]":It(e),u=c?"[object Array]":It(t),f=(s="[object Arguments]"==s?Vt:s)==Vt,p=(u="[object Arguments]"==u?Vt:u)==Vt,l=s==u;if(l&&at(e)){if(!at(t))return!1;i=!0,f=!1}if(l&&!f)return a||(a=new Ce),i||vt(e)?ke(e,t,r,n,o,a):Fe(e,t,s,r,n,o,a);if(!(1&r)){var h=f&&Bt.call(e,"__wrapped__"),v=p&&Bt.call(t,"__wrapped__");if(h||v){var y=h?e.value():e,d=v?t.value():t;return a||(a=new Ce),o(y,d,r,n,a)}}return!!l&&(a||(a=new Ce),At(e,t,r,n,o,a))};var Ut=function e(t,r,n,o,a){return t===r||(null==t||null==r||!Xe(t)&&!Xe(r)?t!=t&&r!=r:Lt(t,r,n,o,e,a))};var Ft,Yt=function(e,t){return Ut(e,t)},Wt=function(){function t(e){var t=e.game,r=e.rendererSystem;this.renderers=[],this.game=t,this.rendererSystem=r}return t.prototype.register=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=f(r),a=o.next();!a.done;a=o.next()){var i=a.value;i.game=this.game,i.rendererManager=this.rendererSystem.rendererManager,i.containerManager=this.rendererSystem.containerManager,this.renderers.push(i)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}},t.prototype.componentChanged=function(t){var r,n,o=function(t){var r,n;try{for(var o=(r=void 0,f(a.renderers)),i=o.next();!i.done;i=o.next()){var c=i.value,s=c.observerInfo[t.componentName];if(s){if([e.OBSERVER_TYPE.ADD,e.OBSERVER_TYPE.REMOVE].indexOf(t.type)>-1){try{c.componentChanged&&c.componentChanged(t)}catch(e){console.error("gameObject: "+t.gameObject.name+", "+t.componentName+" is error.",t,e)}continue}if(s.findIndex((function(e){return Yt(e,t.prop)}))>-1)try{c.componentChanged&&c.componentChanged(t)}catch(e){console.error("gameObject: "+(t.gameObject&&t.gameObject.name)+", "+t.componentName+" is componentChanged error.",t,e)}}}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},a=this;try{for(var i=f(t),c=i.next();!c.done;c=i.next()){o(c.value)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.update=function(e){var t,r,n,o;try{for(var a=f(e.components),i=a.next();!i.done;i=a.next()){var c=i.value;try{for(var s=(n=void 0,f(this.renderers)),u=s.next();!u.done;u=s.next()){var p=u.value,l=[];if(p.observerInfo[c.name]&&-1===l.indexOf(e)){l.push(e);try{p.rendererUpdate&&p.rendererUpdate(e)}catch(t){console.info("gameObject: "+e.name+", "+c.name+" is update error",t)}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}},t}(),$t=function(){function e(){this.containerMap={}}return e.prototype.addContainer=function(e){var t=e.name,r=e.container;this.containerMap[t]=r},e.prototype.getContainer=function(e){return this.containerMap[e]},e.prototype.removeContainer=function(e){delete this.containerMap[e]},e.prototype.updateTransform=function(e){var t=e.name,r=e.transform,n=this.containerMap[t];if(n){var o=r.anchor,a=r.origin,i=r.position,c=r.rotation,s=r.scale,u=r.size,f=r.skew;n.rotation=c,n.scale=s,n.pivot.x=u.width*a.x,n.pivot.y=u.height*a.y,n.skew=f;var p=i.x,l=i.y;if(r.parent){var h=r.parent;p+=h.size.width*o.x,l+=h.size.height*o.y}n.position={x:p,y:l}}},e}(),qt=function(r){function n(e){var t=e.system,n=e.containerManager,o=r.call(this)||this;return o.name="Transform",o.waitRemoveIds=[],o.waitChangeScenes=[],o.containerManager=n,o.init(t),o}return c(n,r),n.prototype.init=function(e){var t=this;this.system=e,this.on("changeScene",(function(e){var r=e.scene,n=e.mode,o=e.application;t.waitChangeScenes.push({scene:r,mode:n,application:o})}))},n.prototype.update=function(){var e,t,r,n;try{for(var o=f(this.waitRemoveIds),a=o.next();!a.done;a=o.next()){var i=a.value;this.containerManager.removeContainer(i)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.waitRemoveIds=[];try{for(var c=f(this.waitChangeScenes),s=c.next();!s.done;s=c.next()){var u=s.value,p=this.containerManager.getContainer(u.scene.id);p&&(u.application.stage.removeChildren(),u.application.stage.addChild(p))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}this.waitChangeScenes=[]},n.prototype.componentChanged=function(t){t.type===e.OBSERVER_TYPE.ADD?this.addContainer(t):t.type===e.OBSERVER_TYPE.CHANGE?this.change(t):t.type===e.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(t.gameObject.id)},n.prototype.addContainer=function(e){var r=new t.Container;r.name=e.gameObject.name,this.containerManager.addContainer({name:e.gameObject.id,container:r}),e.component.worldTransform=r.transform.worldTransform},n.prototype.change=function(e){var t=e.component;if(t.parent){this.containerManager.getContainer(t.parent.gameObject.id).addChild(this.containerManager.getContainer(e.gameObject.id));var r=e.gameObject.transform.parent&&e.gameObject.transform.parent.gameObject.getComponent("Render");r&&(r.sortDirty=!0)}else{var n=this.containerManager.getContainer(e.gameObject.id);n.parent&&n.parent.removeChild(n)}},n.prototype.destroy=function(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null},n=u([e.decorators.componentObserver({Transform:["_parent"]})],n)}(a.default);exports.RENDERER_TYPE=void 0,(Ft=exports.RENDERER_TYPE||(exports.RENDERER_TYPE={}))[Ft.UNKNOWN=0]="UNKNOWN",Ft[Ft.WEBGL=1]="WEBGL",Ft[Ft.CANVAS=2]="CANVAS";var Gt=function(r){function o(){var e=null!==r&&r.apply(this,arguments)||this;return e.multiApps=[],e}return c(o,r),o.prototype.init=function(t){var r=this;this.params=t,this.application=this.createApplication(t),this.containerManager=new $t,this.rendererManager=new Wt({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new qt({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(t){var n,o=t.scene,a=t.mode,i=t.params;switch(a){case e.LOAD_SCENE_MODE.SINGLE:n=r.application;break;case e.LOAD_SCENE_MODE.MULTI_CANVAS:n=r.createMultiApplication({params:i})}o.canvas=n.view,r.transform.emit("changeScene",{scene:o,mode:a,application:n})}))},o.prototype.registerObserver=function(e){var t,r=this.constructor.observerInfo;for(var n in e)r[n]||(r[n]=[]),(t=r[n]).push.apply(t,l(e[n]))},o.prototype.createMultiApplication=function(e){var t=e.params,r=this.createApplication(t);return this.multiApps.push(r),r},o.prototype.createApplication=function(e){e.view=e.canvas,e.renderType===exports.RENDERER_TYPE.CANVAS&&(e.forceCanvas=!0),n.ticker.shared.autoStart=!1,n.ticker.shared.stop();var r=new t.Application(s({sharedTicker:!0},e));return!1!==e.preventScroll&&(r.renderer.plugins.interaction.autoPreventDefault=!1,r.renderer.view.style.touchAction="auto"),r},o.prototype.update=function(e){var t,r,n,o,a=this.componentObserver.clear();try{for(var i=f(a),c=i.next();!c.done;c=i.next()){var s=c.value;this.transform.componentChanged(s)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}try{for(var u=f(this.game.gameObjects),p=u.next();!p.done;p=u.next()){var l=p.value;this.containerManager.updateTransform({name:l.id,transform:l.transform}),this.rendererManager.update(l)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}this.application.ticker.update(e.time)},o.prototype.lateUpdate=function(){this.transform.update()},o.prototype.onDestroy=function(){var e,t;this.application.destroy();try{for(var r=f(this.multiApps),n=r.next();!n.done;n=r.next()){var o=n.value;o&&o.destroy()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.transform.destroy(),this.transform=null,this.params=null,this.rendererManager=null,this.containerManager=null,this.application=null,this.game=null,this.multiApps=null},o.systemName="Renderer",o=u([e.decorators.componentObserver({Transform:["_parent"]})],o)}(e.System),Kt=function(e){function t(){var t=e.call(this)||this;return t.observerInfo=t.constructor.observerInfo,t}return c(t,e),t.prototype.update=function(){var e,t,r=this.componentObserver.clear();try{for(var n=f(r),o=n.next();!o.done;o=n.next()){var a=o.value;this.componentChanged(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},t}(e.System);exports.ContainerManager=$t,exports.Renderer=Kt,exports.RendererManager=Wt,exports.RendererSystem=Gt;
import { Application } from '@eva/renderer-adapter';
import { ComponentChanged } from '@eva/eva.js';
import { Container } from '@eva/renderer-adapter';
import EE from 'eventemitter3';
import EventEmitter from 'eventemitter3';
import { Game } from '@eva/eva.js';

@@ -108,3 +108,3 @@ import { GameObject } from '@eva/eva.js';

declare class Transform_2 extends EE {
declare class Transform_2 extends EventEmitter {
name: string;

@@ -111,0 +111,0 @@ waitRemoveIds: number[];

{
"name": "@eva/plugin-renderer",
"version": "1.0.0",
"version": "1.0.1-alpha.1",
"description": "@eva/plugin-renderer",

@@ -20,4 +20,4 @@ "main": "index.js",

"dependencies": {
"@eva/eva.js": "^1.0.0",
"@eva/renderer-adapter": "^1.0.0",
"@eva/eva.js": "^1.0.1-alpha.1",
"@eva/renderer-adapter": "^1.0.1-alpha.1",
"eventemitter3": "^3.1.2",

@@ -24,0 +24,0 @@ "pixi.js": "^4.8.7"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc