@eva/plugin-renderer-img 1.1.1-alpha.0 → 1.1.1-fix.1
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.
- package/README.md +1 -2
- package/dist/plugin-renderer-img.cjs.js +9 -11
- package/dist/plugin-renderer-img.cjs.prod.js +1 -1
- package/dist/plugin-renderer-img.esm.js +8 -10
- package/index.js +3 -3
- package/package.json +4 -4
- package/dist/EVA.plugin.renderer.img.js +0 -195
- package/dist/EVA.plugin.renderer.img.min.js +0 -1
- package/dist/examples/index.d.ts +0 -2
- package/dist/examples/index.d.ts.map +0 -1
- package/dist/examples/src/a11y.d.ts +0 -3
- package/dist/examples/src/a11y.d.ts.map +0 -1
- package/dist/examples/src/component.d.ts +0 -3
- package/dist/examples/src/component.d.ts.map +0 -1
- package/dist/examples/src/compressed-texture.d.ts +0 -1
- package/dist/examples/src/compressed-texture.d.ts.map +0 -1
- package/dist/examples/src/dragonbone.d.ts +0 -3
- package/dist/examples/src/dragonbone.d.ts.map +0 -1
- package/dist/examples/src/event.d.ts +0 -3
- package/dist/examples/src/event.d.ts.map +0 -1
- package/dist/examples/src/graphics.d.ts +0 -3
- package/dist/examples/src/graphics.d.ts.map +0 -1
- package/dist/examples/src/image.d.ts +0 -3
- package/dist/examples/src/image.d.ts.map +0 -1
- package/dist/examples/src/loader.d.ts +0 -3
- package/dist/examples/src/loader.d.ts.map +0 -1
- package/dist/examples/src/lottie.d.ts +0 -3
- package/dist/examples/src/lottie.d.ts.map +0 -1
- package/dist/examples/src/mask.d.ts +0 -4
- package/dist/examples/src/mask.d.ts.map +0 -1
- package/dist/examples/src/matter.d.ts +0 -3
- package/dist/examples/src/matter.d.ts.map +0 -1
- package/dist/examples/src/multi-canvas.d.ts +0 -3
- package/dist/examples/src/multi-canvas.d.ts.map +0 -1
- package/dist/examples/src/ninePatch.d.ts +0 -3
- package/dist/examples/src/ninePatch.d.ts.map +0 -1
- package/dist/examples/src/sound.d.ts +0 -3
- package/dist/examples/src/sound.d.ts.map +0 -1
- package/dist/examples/src/spine.d.ts +0 -3
- package/dist/examples/src/spine.d.ts.map +0 -1
- package/dist/examples/src/sprite.d.ts +0 -3
- package/dist/examples/src/sprite.d.ts.map +0 -1
- package/dist/examples/src/spriteAnimation.d.ts +0 -3
- package/dist/examples/src/spriteAnimation.d.ts.map +0 -1
- package/dist/examples/src/text.d.ts +0 -3
- package/dist/examples/src/text.d.ts.map +0 -1
- package/dist/examples/src/tilingSprite.d.ts +0 -3
- package/dist/examples/src/tilingSprite.d.ts.map +0 -1
- package/dist/examples/src/transition.d.ts +0 -3
- package/dist/examples/src/transition.d.ts.map +0 -1
- package/dist/plugin-renderer-img.d.ts +0 -34
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ function __generator(thisArg, body) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
var Img$
|
|
83
|
+
var Img$2 = (function (_super) {
|
|
84
84
|
__extends(Img, _super);
|
|
85
85
|
function Img() {
|
|
86
86
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -97,7 +97,8 @@ var Img$1 = (function (_super) {
|
|
|
97
97
|
eva_js.decorators.IDEProp
|
|
98
98
|
], Img.prototype, "resource", void 0);
|
|
99
99
|
return Img;
|
|
100
|
-
}(eva_js.Component));
|
|
100
|
+
}(eva_js.Component));
|
|
101
|
+
var Img$3 = Img$2;
|
|
101
102
|
|
|
102
103
|
eva_js.resource.registerInstance(eva_js.RESOURCE_TYPE.IMAGE, function (_a) {
|
|
103
104
|
var _b = _a.data, data = _b === void 0 ? {} : _b;
|
|
@@ -151,9 +152,7 @@ var Img = (function (_super) {
|
|
|
151
152
|
sprite_1.image = instance;
|
|
152
153
|
});
|
|
153
154
|
this.imgs[changed.gameObject.id] = sprite_1;
|
|
154
|
-
this.containerManager
|
|
155
|
-
.getContainer(changed.gameObject.id)
|
|
156
|
-
.addChildAt(sprite_1.sprite, 0);
|
|
155
|
+
this.containerManager.getContainer(changed.gameObject.id).addChildAt(sprite_1.sprite, 0);
|
|
157
156
|
return [3, 4];
|
|
158
157
|
case 1:
|
|
159
158
|
if (!(changed.type === eva_js.OBSERVER_TYPE.CHANGE)) return [3, 3];
|
|
@@ -168,9 +167,7 @@ var Img = (function (_super) {
|
|
|
168
167
|
case 3:
|
|
169
168
|
if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
|
|
170
169
|
sprite = this.imgs[changed.gameObject.id];
|
|
171
|
-
this.containerManager
|
|
172
|
-
.getContainer(changed.gameObject.id)
|
|
173
|
-
.removeChild(sprite.sprite);
|
|
170
|
+
this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite.sprite);
|
|
174
171
|
sprite.sprite.destroy({ children: true });
|
|
175
172
|
delete this.imgs[changed.gameObject.id];
|
|
176
173
|
}
|
|
@@ -187,7 +184,8 @@ var Img = (function (_super) {
|
|
|
187
184
|
})
|
|
188
185
|
], Img);
|
|
189
186
|
return Img;
|
|
190
|
-
}(pluginRenderer.Renderer));
|
|
187
|
+
}(pluginRenderer.Renderer));
|
|
188
|
+
var Img$1 = Img;
|
|
191
189
|
|
|
192
|
-
exports.Img = Img$
|
|
193
|
-
exports.ImgSystem = Img;
|
|
190
|
+
exports.Img = Img$3;
|
|
191
|
+
exports.ImgSystem = Img$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/plugin-renderer"),r=require("@eva/renderer-adapter"),n=require("pixi.js"),o=function(e,t){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/plugin-renderer"),r=require("@eva/renderer-adapter"),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])},o(e,t)};function i(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t,r,n){var o,i=arguments.length,c=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(c=(i<3?o(c):i>3?o(t,r,c):o(t,r))||c);return i>3&&c&&Object.defineProperty(t,r,c),c}function a(e,t){var r,n,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var s=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.resource="",e}return i(r,t),r.prototype.init=function(e){e&&e.resource&&(this.resource=e.resource)},r.componentName="Img",c([e.decorators.IDEProp],r.prototype,"resource",void 0),r}(e.Component),u=s;e.resource.registerInstance(e.RESOURCE_TYPE.IMAGE,(function(e){var t=e.data,r=(void 0===t?{}:t).image;if(r)return n.Texture.from(r)})),e.resource.registerDestroy(e.RESOURCE_TYPE.IMAGE,(function(e){var t=e.instance;t&&t.destroy(!0)}));var p=function(n){function o(){var e=null!==n&&n.apply(this,arguments)||this;return e.name="Img",e.imgs={},e}return i(o,n),o.prototype.init=function(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height;this.imgs[e.id]&&(this.imgs[e.id].sprite.width=r,this.imgs[e.id].sprite.height=n)},o.prototype.componentChanged=function(t){return n=this,o=void 0,c=function(){var n,o,i,c;return a(this,(function(a){switch(a.label){case 0:return"Img"!==t.componentName?[3,4]:(n=t.component,t.type!==e.OBSERVER_TYPE.ADD?[3,1]:(o=new r.Sprite(null),e.resource.getResource(n.resource).then((function(e){var r=e.instance;r||console.error("GameObject:"+t.gameObject.name+"'s Img resource load error"),o.image=r})),this.imgs[t.gameObject.id]=o,this.containerManager.getContainer(t.gameObject.id).addChildAt(o.sprite,0),[3,4]));case 1:return t.type!==e.OBSERVER_TYPE.CHANGE?[3,3]:[4,e.resource.getResource(n.resource)];case 2:return(i=a.sent().instance)||console.error("GameObject:"+t.gameObject.name+"'s Img resource load error"),this.imgs[t.gameObject.id].image=i,[3,4];case 3:t.type===e.OBSERVER_TYPE.REMOVE&&(c=this.imgs[t.gameObject.id],this.containerManager.getContainer(t.gameObject.id).removeChild(c.sprite),c.sprite.destroy({children:!0}),delete this.imgs[t.gameObject.id]),a.label=4;case 4:return[2]}}))},new((i=void 0)||(i=Promise))((function(e,t){function r(e){try{s(c.next(e))}catch(e){t(e)}}function a(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(r,a)}s((c=c.apply(n,o||[])).next())}));var n,o,i,c},o.systemName="Img",o=c([e.decorators.componentObserver({Img:[{prop:["resource"],deep:!1}]})],o)}(t.Renderer);exports.Img=u,exports.ImgSystem=p;
|
|
@@ -76,7 +76,7 @@ function __generator(thisArg, body) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
var Img$
|
|
79
|
+
var Img$2 = (function (_super) {
|
|
80
80
|
__extends(Img, _super);
|
|
81
81
|
function Img() {
|
|
82
82
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -93,7 +93,8 @@ var Img$1 = (function (_super) {
|
|
|
93
93
|
decorators.IDEProp
|
|
94
94
|
], Img.prototype, "resource", void 0);
|
|
95
95
|
return Img;
|
|
96
|
-
}(Component));
|
|
96
|
+
}(Component));
|
|
97
|
+
var Img$3 = Img$2;
|
|
97
98
|
|
|
98
99
|
resource.registerInstance(RESOURCE_TYPE.IMAGE, function (_a) {
|
|
99
100
|
var _b = _a.data, data = _b === void 0 ? {} : _b;
|
|
@@ -147,9 +148,7 @@ var Img = (function (_super) {
|
|
|
147
148
|
sprite_1.image = instance;
|
|
148
149
|
});
|
|
149
150
|
this.imgs[changed.gameObject.id] = sprite_1;
|
|
150
|
-
this.containerManager
|
|
151
|
-
.getContainer(changed.gameObject.id)
|
|
152
|
-
.addChildAt(sprite_1.sprite, 0);
|
|
151
|
+
this.containerManager.getContainer(changed.gameObject.id).addChildAt(sprite_1.sprite, 0);
|
|
153
152
|
return [3, 4];
|
|
154
153
|
case 1:
|
|
155
154
|
if (!(changed.type === OBSERVER_TYPE.CHANGE)) return [3, 3];
|
|
@@ -164,9 +163,7 @@ var Img = (function (_super) {
|
|
|
164
163
|
case 3:
|
|
165
164
|
if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
166
165
|
sprite = this.imgs[changed.gameObject.id];
|
|
167
|
-
this.containerManager
|
|
168
|
-
.getContainer(changed.gameObject.id)
|
|
169
|
-
.removeChild(sprite.sprite);
|
|
166
|
+
this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite.sprite);
|
|
170
167
|
sprite.sprite.destroy({ children: true });
|
|
171
168
|
delete this.imgs[changed.gameObject.id];
|
|
172
169
|
}
|
|
@@ -183,6 +180,7 @@ var Img = (function (_super) {
|
|
|
183
180
|
})
|
|
184
181
|
], Img);
|
|
185
182
|
return Img;
|
|
186
|
-
}(Renderer));
|
|
183
|
+
}(Renderer));
|
|
184
|
+
var Img$1 = Img;
|
|
187
185
|
|
|
188
|
-
export { Img$
|
|
186
|
+
export { Img$3 as Img, Img$1 as ImgSystem };
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
3
|
if (process.env.NODE_ENV === 'production') {
|
|
4
|
-
module.exports = require('./dist/plugin-renderer-img.cjs.prod.js')
|
|
4
|
+
module.exports = require('./dist/plugin-renderer-img.cjs.prod.js');
|
|
5
5
|
} else {
|
|
6
|
-
module.exports = require('./dist/plugin-renderer-img.cjs.js')
|
|
6
|
+
module.exports = require('./dist/plugin-renderer-img.cjs.js');
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-img",
|
|
3
|
-
"version": "1.1.1-
|
|
3
|
+
"version": "1.1.1-fix.1",
|
|
4
4
|
"description": "@eva/plugin-renderer-img",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-img.esm.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/plugin-renderer": "1.1.1-
|
|
22
|
-
"@eva/renderer-adapter": "1.1.1-
|
|
23
|
-
"@eva/eva.js": "1.1.1-
|
|
21
|
+
"@eva/plugin-renderer": "1.1.1-fix.1",
|
|
22
|
+
"@eva/renderer-adapter": "1.1.1-fix.1",
|
|
23
|
+
"@eva/eva.js": "1.1.1-fix.1",
|
|
24
24
|
"pixi.js": "^4.8.7"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter'), require('pixi.js')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter', 'pixi.js'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.img = {}), global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter, global.PIXI));
|
|
5
|
-
}(this, (function (exports, eva_js, pluginRenderer, rendererAdapter, pixi_js) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/*! *****************************************************************************
|
|
8
|
-
Copyright (c) Microsoft Corporation.
|
|
9
|
-
|
|
10
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
-
purpose with or without fee is hereby granted.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
-
***************************************************************************** */
|
|
21
|
-
/* global Reflect, Promise */
|
|
22
|
-
|
|
23
|
-
var extendStatics = function(d, b) {
|
|
24
|
-
extendStatics = Object.setPrototypeOf ||
|
|
25
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
26
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
27
|
-
return extendStatics(d, b);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function __extends(d, b) {
|
|
31
|
-
extendStatics(d, b);
|
|
32
|
-
function __() { this.constructor = d; }
|
|
33
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function __decorate(decorators, target, key, desc) {
|
|
37
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
38
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
39
|
-
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;
|
|
40
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
44
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
45
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
47
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
48
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
49
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function __generator(thisArg, body) {
|
|
54
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
55
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
56
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
57
|
-
function step(op) {
|
|
58
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
59
|
-
while (_) try {
|
|
60
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
61
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
62
|
-
switch (op[0]) {
|
|
63
|
-
case 0: case 1: t = op; break;
|
|
64
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
65
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
66
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
67
|
-
default:
|
|
68
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
69
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
70
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
71
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
72
|
-
if (t[2]) _.ops.pop();
|
|
73
|
-
_.trys.pop(); continue;
|
|
74
|
-
}
|
|
75
|
-
op = body.call(thisArg, _);
|
|
76
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
77
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var Img$1 = (function (_super) {
|
|
82
|
-
__extends(Img, _super);
|
|
83
|
-
function Img() {
|
|
84
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
85
|
-
_this.resource = '';
|
|
86
|
-
return _this;
|
|
87
|
-
}
|
|
88
|
-
Img.prototype.init = function (obj) {
|
|
89
|
-
if (obj && obj.resource) {
|
|
90
|
-
this.resource = obj.resource;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
Img.componentName = 'Img';
|
|
94
|
-
__decorate([
|
|
95
|
-
eva_js.decorators.IDEProp
|
|
96
|
-
], Img.prototype, "resource", void 0);
|
|
97
|
-
return Img;
|
|
98
|
-
}(eva_js.Component));
|
|
99
|
-
|
|
100
|
-
eva_js.resource.registerInstance(eva_js.RESOURCE_TYPE.IMAGE, function (_a) {
|
|
101
|
-
var _b = _a.data, data = _b === void 0 ? {} : _b;
|
|
102
|
-
var image = data.image;
|
|
103
|
-
if (image) {
|
|
104
|
-
var texture = pixi_js.Texture.from(image);
|
|
105
|
-
return texture;
|
|
106
|
-
}
|
|
107
|
-
return;
|
|
108
|
-
});
|
|
109
|
-
eva_js.resource.registerDestroy(eva_js.RESOURCE_TYPE.IMAGE, function (_a) {
|
|
110
|
-
var instance = _a.instance;
|
|
111
|
-
if (instance) {
|
|
112
|
-
instance.destroy(true);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
var Img = (function (_super) {
|
|
116
|
-
__extends(Img, _super);
|
|
117
|
-
function Img() {
|
|
118
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
119
|
-
_this.name = 'Img';
|
|
120
|
-
_this.imgs = {};
|
|
121
|
-
return _this;
|
|
122
|
-
}
|
|
123
|
-
Img.prototype.init = function () {
|
|
124
|
-
this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem);
|
|
125
|
-
this.renderSystem.rendererManager.register(this);
|
|
126
|
-
};
|
|
127
|
-
Img.prototype.rendererUpdate = function (gameObject) {
|
|
128
|
-
var _a = gameObject.transform.size, width = _a.width, height = _a.height;
|
|
129
|
-
if (this.imgs[gameObject.id]) {
|
|
130
|
-
this.imgs[gameObject.id].sprite.width = width;
|
|
131
|
-
this.imgs[gameObject.id].sprite.height = height;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
Img.prototype.componentChanged = function (changed) {
|
|
135
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
-
var component, sprite_1, instance, sprite;
|
|
137
|
-
return __generator(this, function (_a) {
|
|
138
|
-
switch (_a.label) {
|
|
139
|
-
case 0:
|
|
140
|
-
if (!(changed.componentName === 'Img')) return [3, 4];
|
|
141
|
-
component = changed.component;
|
|
142
|
-
if (!(changed.type === eva_js.OBSERVER_TYPE.ADD)) return [3, 1];
|
|
143
|
-
sprite_1 = new rendererAdapter.Sprite(null);
|
|
144
|
-
eva_js.resource.getResource(component.resource).then(function (_a) {
|
|
145
|
-
var instance = _a.instance;
|
|
146
|
-
if (!instance) {
|
|
147
|
-
console.error("GameObject:" + changed.gameObject.name + "'s Img resource load error");
|
|
148
|
-
}
|
|
149
|
-
sprite_1.image = instance;
|
|
150
|
-
});
|
|
151
|
-
this.imgs[changed.gameObject.id] = sprite_1;
|
|
152
|
-
this.containerManager
|
|
153
|
-
.getContainer(changed.gameObject.id)
|
|
154
|
-
.addChildAt(sprite_1.sprite, 0);
|
|
155
|
-
return [3, 4];
|
|
156
|
-
case 1:
|
|
157
|
-
if (!(changed.type === eva_js.OBSERVER_TYPE.CHANGE)) return [3, 3];
|
|
158
|
-
return [4, eva_js.resource.getResource(component.resource)];
|
|
159
|
-
case 2:
|
|
160
|
-
instance = (_a.sent()).instance;
|
|
161
|
-
if (!instance) {
|
|
162
|
-
console.error("GameObject:" + changed.gameObject.name + "'s Img resource load error");
|
|
163
|
-
}
|
|
164
|
-
this.imgs[changed.gameObject.id].image = instance;
|
|
165
|
-
return [3, 4];
|
|
166
|
-
case 3:
|
|
167
|
-
if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
|
|
168
|
-
sprite = this.imgs[changed.gameObject.id];
|
|
169
|
-
this.containerManager
|
|
170
|
-
.getContainer(changed.gameObject.id)
|
|
171
|
-
.removeChild(sprite.sprite);
|
|
172
|
-
sprite.sprite.destroy({ children: true });
|
|
173
|
-
delete this.imgs[changed.gameObject.id];
|
|
174
|
-
}
|
|
175
|
-
_a.label = 4;
|
|
176
|
-
case 4: return [2];
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
Img.systemName = 'Img';
|
|
182
|
-
Img = __decorate([
|
|
183
|
-
eva_js.decorators.componentObserver({
|
|
184
|
-
Img: [{ prop: ['resource'], deep: false }],
|
|
185
|
-
})
|
|
186
|
-
], Img);
|
|
187
|
-
return Img;
|
|
188
|
-
}(pluginRenderer.Renderer));
|
|
189
|
-
|
|
190
|
-
exports.Img = Img$1;
|
|
191
|
-
exports.ImgSystem = Img;
|
|
192
|
-
|
|
193
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
194
|
-
|
|
195
|
-
})));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e,r;e=this,r=function(e,r,t,n,o){"use strict";var i=function(e,r){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)};function a(e,r){function t(){this.constructor=e}i(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}function s(e,r,t,n){var o,i=arguments.length,a=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,t,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(r,t,a):o(r,t))||a);return i>3&&a&&Object.defineProperty(r,t,a),a}function c(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,s)}c((n=n.apply(e,r||[])).next())}))}function u(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var p=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.resource="",r}return a(t,e),t.prototype.init=function(e){e&&e.resource&&(this.resource=e.resource)},t.componentName="Img",s([r.decorators.IDEProp],t.prototype,"resource",void 0),t}(r.Component);r.resource.registerInstance(r.RESOURCE_TYPE.IMAGE,(function(e){var r=e.data,t=(void 0===r?{}:r).image;if(t)return o.Texture.from(t)})),r.resource.registerDestroy(r.RESOURCE_TYPE.IMAGE,(function(e){var r=e.instance;r&&r.destroy(!0)}));var l=function(e){function o(){var r=null!==e&&e.apply(this,arguments)||this;return r.name="Img",r.imgs={},r}return a(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var r=e.transform.size,t=r.width,n=r.height;this.imgs[e.id]&&(this.imgs[e.id].sprite.width=t,this.imgs[e.id].sprite.height=n)},o.prototype.componentChanged=function(e){return c(this,void 0,void 0,(function(){var t,o,i,a;return u(this,(function(s){switch(s.label){case 0:return"Img"!==e.componentName?[3,4]:(t=e.component,e.type!==r.OBSERVER_TYPE.ADD?[3,1]:(o=new n.Sprite(null),r.resource.getResource(t.resource).then((function(r){var t=r.instance;t||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),o.image=t})),this.imgs[e.gameObject.id]=o,this.containerManager.getContainer(e.gameObject.id).addChildAt(o.sprite,0),[3,4]));case 1:return e.type!==r.OBSERVER_TYPE.CHANGE?[3,3]:[4,r.resource.getResource(t.resource)];case 2:return(i=s.sent().instance)||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.imgs[e.gameObject.id].image=i,[3,4];case 3:e.type===r.OBSERVER_TYPE.REMOVE&&(a=this.imgs[e.gameObject.id],this.containerManager.getContainer(e.gameObject.id).removeChild(a.sprite),a.sprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]),s.label=4;case 4:return[2]}}))}))},o.systemName="Img",o=s([r.decorators.componentObserver({Img:[{prop:["resource"],deep:!1}]})],o)}(t.Renderer);e.Img=p,e.ImgSystem=l,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter","pixi.js"],r):r(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.img={}),e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter,e.PIXI);
|
package/dist/examples/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["a11y.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,IAAI,SAAS,CAAC;AAC3B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAmYhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["component.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,cAAc,CAAC;AAChC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAsJhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=compressed-texture.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compressed-texture.d.ts","sourceRoot":"","sources":["compressed-texture.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dragonbone.d.ts","sourceRoot":"","sources":["dragonbone.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,eAAe,CAAC;AACjC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA8DhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["event.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAiFhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphics.d.ts","sourceRoot":"","sources":["graphics.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,aAAa,CAAC;AAC/B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAsDhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["image.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA8ChC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["loader.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA0HhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lottie.d.ts","sourceRoot":"","sources":["lottie.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,WAAW,CAAC;AAE7B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAmHhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["mask.ts"],"names":[],"mappings":"AAGA,OAAO,6BAA6B,CAAC;AAErC,eAAO,MAAM,IAAI,SAAS,CAAC;AAC3B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAoHhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matter.d.ts","sourceRoot":"","sources":["matter.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA4ahC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi-canvas.d.ts","sourceRoot":"","sources":["multi-canvas.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,iBAAiB,CAAC;AACnC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAoFhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ninePatch.d.ts","sourceRoot":"","sources":["ninePatch.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,cAAc,CAAC;AAChC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA2EhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sound.d.ts","sourceRoot":"","sources":["sound.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA2NhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spine.d.ts","sourceRoot":"","sources":["spine.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA+DhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sprite.d.ts","sourceRoot":"","sources":["sprite.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA4HhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spriteAnimation.d.ts","sourceRoot":"","sources":["spriteAnimation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,oBAAoB,CAAC;AACtC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAwDhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA+DhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tilingSprite.d.ts","sourceRoot":"","sources":["tilingSprite.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,iBAAiB,CAAC;AACnC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAuChC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["transition.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,eAAe,CAAC;AACjC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAoIhC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Component } from '@eva/eva.js';
|
|
2
|
-
import { ComponentChanged } from '@eva/eva.js';
|
|
3
|
-
import { ContainerManager } from '@eva/plugin-renderer';
|
|
4
|
-
import { GameObject } from '@eva/eva.js';
|
|
5
|
-
import { Renderer } from '@eva/plugin-renderer';
|
|
6
|
-
import { RendererManager } from '@eva/plugin-renderer';
|
|
7
|
-
import { RendererSystem } from '@eva/plugin-renderer';
|
|
8
|
-
import { Sprite } from '@eva/renderer-adapter';
|
|
9
|
-
|
|
10
|
-
export declare class Img extends Component<ImgParams> {
|
|
11
|
-
static componentName: string;
|
|
12
|
-
resource: string;
|
|
13
|
-
init(obj?: ImgParams): void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export declare interface ImgParams {
|
|
17
|
-
resource: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export declare class ImgSystem extends Renderer {
|
|
21
|
-
static systemName: string;
|
|
22
|
-
name: string;
|
|
23
|
-
imgs: {
|
|
24
|
-
[propName: number]: Sprite;
|
|
25
|
-
};
|
|
26
|
-
renderSystem: RendererSystem;
|
|
27
|
-
rendererManager: RendererManager;
|
|
28
|
-
containerManager: ContainerManager;
|
|
29
|
-
init(): void;
|
|
30
|
-
rendererUpdate(gameObject: GameObject): void;
|
|
31
|
-
componentChanged(changed: ComponentChanged): Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { }
|