@eva/plugin-renderer-nine-patch 2.1.0-beta.2 → 2.1.0-beta.4
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.
|
@@ -40,6 +40,10 @@ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAda
|
|
|
40
40
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
44
|
+
var e = new Error(message);
|
|
45
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
46
|
+
};
|
|
43
47
|
class NinePatch$2 extends eva_js.Component {
|
|
44
48
|
constructor() {
|
|
45
49
|
super(...arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_ninePatch=function(e,t,i,
|
|
1
|
+
globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_ninePatch=function(e,t,i,r){"use strict";function n(e,t,i,r){var n,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var h=e.length-1;h>=0;h--)(n=e[h])&&(s=(o<3?n(s):o>3?n(t,i,s):n(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s}function o(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function s(e,t,i,r){return new(i||(i=Promise))(function(n,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function h(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,h)}c((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class h extends t.Component{constructor(){super(...arguments),this.resource="",this.spriteName="",this.leftWidth=0,this.topHeight=0,this.rightWidth=0,this.bottomHeight=0}init(e){e&&(this.resource=e.resource,this.spriteName=e.spriteName,this.leftWidth=e.leftWidth,this.topHeight=e.topHeight,this.rightWidth=e.rightWidth,this.bottomHeight=e.bottomHeight)}}h.componentName="NinePatch",n([t.type("string"),o("design:type",String)],h.prototype,"resource",void 0),n([t.type("string"),o("design:type",String)],h.prototype,"spriteName",void 0),n([t.type("number"),t.step(1),o("design:type",Number)],h.prototype,"leftWidth",void 0),n([t.type("number"),t.step(1),o("design:type",Number)],h.prototype,"topHeight",void 0),n([t.type("number"),t.step(1),o("design:type",Number)],h.prototype,"rightWidth",void 0),n([t.type("number"),t.step(1),o("design:type",Number)],h.prototype,"bottomHeight",void 0);let c=class extends i.Renderer{constructor(){super(...arguments),this.name="NinePatch",this.ninePatch={}}init(){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:t,height:i}=e.transform.size;this.ninePatch[e.id]&&(this.ninePatch[e.id].width=t,this.ninePatch[e.id].height=i)}componentChanged(e){return s(this,void 0,void 0,function*(){"NinePatch"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.add(e):e.type===t.OBSERVER_TYPE.REMOVE?this.remove(e):(this.remove(e),this.add(e)))})}add(e){return s(this,void 0,void 0,function*(){const i=e.component,n=e.gameObject.id,o=this.increaseAsyncId(n),{type:s,data:h,instance:c}=yield t.resource.getResource(i.resource);if(!this.validateAsyncId(n,o))return;if(!h)return void console.error(`GameObject:${e.gameObject.name}'s NinePatch resource load error`);let a;if(s===t.RESOURCE_TYPE.SPRITE&&i.spriteName){if(!c)return void console.error("GameObjectNinePatch Sprite resource rely on the Sprite system");a=c[i.resource+"_s|r|c_"+i.spriteName]}else a=h.image;const{leftWidth:d,topHeight:p,rightWidth:g,bottomHeight:u}=i,l=new r.NinePatch(a,d,p,g,u);this.ninePatch[e.gameObject.id]=l,i.ninePatch=l,this.containerManager.getContainer(e.gameObject.id).addChildAt(l,0)})}remove(e){const t=e.gameObject.id;this.increaseAsyncId(t);const i=this.ninePatch[t];i&&(this.containerManager.getContainer(e.gameObject.id).removeChild(i),delete this.ninePatch[e.gameObject.id],i.destroy({children:!0}))}};c.systemName="NinePatch",c=n([t.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],c);var a=c;return e.NinePatch=h,e.NinePatchSystem=a,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);globalThis.EVA.plugin.renderer.ninePatch=globalThis.EVA.plugin.renderer.ninePatch||_EVA_IIFE_ninePatch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-nine-patch",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.4",
|
|
4
4
|
"description": "@eva/plugin-renderer-nine-patch",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-nine-patch.esm.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@eva/inspector-decorator": "^2.0.0-beta.0",
|
|
22
|
-
"@eva/plugin-renderer": "2.1.0-beta.
|
|
23
|
-
"@eva/renderer-adapter": "2.1.0-beta.
|
|
24
|
-
"@eva/eva.js": "2.1.0-beta.
|
|
22
|
+
"@eva/plugin-renderer": "2.1.0-beta.4",
|
|
23
|
+
"@eva/renderer-adapter": "2.1.0-beta.4",
|
|
24
|
+
"@eva/eva.js": "2.1.0-beta.4"
|
|
25
25
|
}
|
|
26
26
|
}
|