@eva/plugin-renderer-nine-patch 1.1.1-beta.0 → 1.1.1-fix.2

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.
Files changed (106) hide show
  1. package/dist/EVA.plugin.renderer.ninePatch.js +369 -213
  2. package/dist/EVA.plugin.renderer.ninePatch.min.js +1 -0
  3. package/dist/EVA.plugin.renderer.ninePatch.min.js.map +1 -0
  4. package/dist/plugin-renderer-nine-patch.cjs.js +28 -14
  5. package/dist/plugin-renderer-nine-patch.cjs.prod.js +1 -0
  6. package/dist/plugin-renderer-nine-patch.cjs.prod.js.map +1 -0
  7. package/dist/plugin-renderer-nine-patch.esm.js +30 -16
  8. package/package.json +4 -4
  9. package/dist/vite-test/dist/assets/Graphics.f535ed8f.d.ts +0 -6
  10. package/dist/vite-test/dist/assets/Graphics.f535ed8f.d.ts.map +0 -1
  11. package/dist/vite-test/dist/assets/Sprite.703a9f94.d.ts +0 -9
  12. package/dist/vite-test/dist/assets/Sprite.703a9f94.d.ts.map +0 -1
  13. package/dist/vite-test/dist/assets/a11y.9b3ce839.d.ts +0 -4
  14. package/dist/vite-test/dist/assets/a11y.9b3ce839.d.ts.map +0 -1
  15. package/dist/vite-test/dist/assets/component.caf56816.d.ts +0 -4
  16. package/dist/vite-test/dist/assets/component.caf56816.d.ts.map +0 -1
  17. package/dist/vite-test/dist/assets/compressed-texture-animation.6dcf9ab4.d.ts +0 -4
  18. package/dist/vite-test/dist/assets/compressed-texture-animation.6dcf9ab4.d.ts.map +0 -1
  19. package/dist/vite-test/dist/assets/compressed-texture-mipmap.cc4fada9.d.ts +0 -4
  20. package/dist/vite-test/dist/assets/compressed-texture-mipmap.cc4fada9.d.ts.map +0 -1
  21. package/dist/vite-test/dist/assets/compressed-texture.07a67c9f.d.ts +0 -4
  22. package/dist/vite-test/dist/assets/compressed-texture.07a67c9f.d.ts.map +0 -1
  23. package/dist/vite-test/dist/assets/dragonbone.bfd80a38.d.ts +0 -4
  24. package/dist/vite-test/dist/assets/dragonbone.bfd80a38.d.ts.map +0 -1
  25. package/dist/vite-test/dist/assets/event.0de0fd28.d.ts +0 -4
  26. package/dist/vite-test/dist/assets/event.0de0fd28.d.ts.map +0 -1
  27. package/dist/vite-test/dist/assets/graphics.df3659e9.d.ts +0 -4
  28. package/dist/vite-test/dist/assets/graphics.df3659e9.d.ts.map +0 -1
  29. package/dist/vite-test/dist/assets/image.9d7f7b54.d.ts +0 -4
  30. package/dist/vite-test/dist/assets/image.9d7f7b54.d.ts.map +0 -1
  31. package/dist/vite-test/dist/assets/index.cf7bfffd.d.ts +0 -2
  32. package/dist/vite-test/dist/assets/index.cf7bfffd.d.ts.map +0 -1
  33. package/dist/vite-test/dist/assets/loader.03643d14.d.ts +0 -4
  34. package/dist/vite-test/dist/assets/loader.03643d14.d.ts.map +0 -1
  35. package/dist/vite-test/dist/assets/lottie.8e29b509.d.ts +0 -4
  36. package/dist/vite-test/dist/assets/lottie.8e29b509.d.ts.map +0 -1
  37. package/dist/vite-test/dist/assets/mask.c3592934.d.ts +0 -4
  38. package/dist/vite-test/dist/assets/mask.c3592934.d.ts.map +0 -1
  39. package/dist/vite-test/dist/assets/matter.bcb02c9e.d.ts +0 -4
  40. package/dist/vite-test/dist/assets/matter.bcb02c9e.d.ts.map +0 -1
  41. package/dist/vite-test/dist/assets/multi-canvas.a081d481.d.ts +0 -4
  42. package/dist/vite-test/dist/assets/multi-canvas.a081d481.d.ts.map +0 -1
  43. package/dist/vite-test/dist/assets/ninePatch.ec5000f5.d.ts +0 -4
  44. package/dist/vite-test/dist/assets/ninePatch.ec5000f5.d.ts.map +0 -1
  45. package/dist/vite-test/dist/assets/sound.81f19bb0.d.ts +0 -4
  46. package/dist/vite-test/dist/assets/sound.81f19bb0.d.ts.map +0 -1
  47. package/dist/vite-test/dist/assets/spine.08037e2f.d.ts +0 -4
  48. package/dist/vite-test/dist/assets/spine.08037e2f.d.ts.map +0 -1
  49. package/dist/vite-test/dist/assets/sprite.ab61ce04.d.ts +0 -4
  50. package/dist/vite-test/dist/assets/sprite.ab61ce04.d.ts.map +0 -1
  51. package/dist/vite-test/dist/assets/spriteAnimation.fbd1b62d.d.ts +0 -4
  52. package/dist/vite-test/dist/assets/spriteAnimation.fbd1b62d.d.ts.map +0 -1
  53. package/dist/vite-test/dist/assets/text.3e406bba.d.ts +0 -4
  54. package/dist/vite-test/dist/assets/text.3e406bba.d.ts.map +0 -1
  55. package/dist/vite-test/dist/assets/tilingSprite.3f09d780.d.ts +0 -4
  56. package/dist/vite-test/dist/assets/tilingSprite.3f09d780.d.ts.map +0 -1
  57. package/dist/vite-test/dist/assets/transition.f3d6a6eb.d.ts +0 -4
  58. package/dist/vite-test/dist/assets/transition.f3d6a6eb.d.ts.map +0 -1
  59. package/dist/vite-test/dist/assets/vendor.1f31f96e.d.ts +0 -5
  60. package/dist/vite-test/dist/assets/vendor.1f31f96e.d.ts.map +0 -1
  61. package/dist/vite-test/index.d.ts +0 -2
  62. package/dist/vite-test/index.d.ts.map +0 -1
  63. package/dist/vite-test/ts/a11y.d.ts +0 -3
  64. package/dist/vite-test/ts/a11y.d.ts.map +0 -1
  65. package/dist/vite-test/ts/component.d.ts +0 -3
  66. package/dist/vite-test/ts/component.d.ts.map +0 -1
  67. package/dist/vite-test/ts/compressed-texture-animation.d.ts +0 -3
  68. package/dist/vite-test/ts/compressed-texture-animation.d.ts.map +0 -1
  69. package/dist/vite-test/ts/compressed-texture-mipmap.d.ts +0 -3
  70. package/dist/vite-test/ts/compressed-texture-mipmap.d.ts.map +0 -1
  71. package/dist/vite-test/ts/compressed-texture.d.ts +0 -3
  72. package/dist/vite-test/ts/compressed-texture.d.ts.map +0 -1
  73. package/dist/vite-test/ts/dragonbone.d.ts +0 -3
  74. package/dist/vite-test/ts/dragonbone.d.ts.map +0 -1
  75. package/dist/vite-test/ts/event.d.ts +0 -3
  76. package/dist/vite-test/ts/event.d.ts.map +0 -1
  77. package/dist/vite-test/ts/graphics.d.ts +0 -3
  78. package/dist/vite-test/ts/graphics.d.ts.map +0 -1
  79. package/dist/vite-test/ts/image.d.ts +0 -3
  80. package/dist/vite-test/ts/image.d.ts.map +0 -1
  81. package/dist/vite-test/ts/loader.d.ts +0 -3
  82. package/dist/vite-test/ts/loader.d.ts.map +0 -1
  83. package/dist/vite-test/ts/lottie.d.ts +0 -3
  84. package/dist/vite-test/ts/lottie.d.ts.map +0 -1
  85. package/dist/vite-test/ts/mask.d.ts +0 -4
  86. package/dist/vite-test/ts/mask.d.ts.map +0 -1
  87. package/dist/vite-test/ts/matter.d.ts +0 -3
  88. package/dist/vite-test/ts/matter.d.ts.map +0 -1
  89. package/dist/vite-test/ts/multi-canvas.d.ts +0 -3
  90. package/dist/vite-test/ts/multi-canvas.d.ts.map +0 -1
  91. package/dist/vite-test/ts/ninePatch.d.ts +0 -3
  92. package/dist/vite-test/ts/ninePatch.d.ts.map +0 -1
  93. package/dist/vite-test/ts/sound.d.ts +0 -3
  94. package/dist/vite-test/ts/sound.d.ts.map +0 -1
  95. package/dist/vite-test/ts/spine.d.ts +0 -3
  96. package/dist/vite-test/ts/spine.d.ts.map +0 -1
  97. package/dist/vite-test/ts/sprite.d.ts +0 -3
  98. package/dist/vite-test/ts/sprite.d.ts.map +0 -1
  99. package/dist/vite-test/ts/spriteAnimation.d.ts +0 -3
  100. package/dist/vite-test/ts/spriteAnimation.d.ts.map +0 -1
  101. package/dist/vite-test/ts/text.d.ts +0 -3
  102. package/dist/vite-test/ts/text.d.ts.map +0 -1
  103. package/dist/vite-test/ts/tilingSprite.d.ts +0 -3
  104. package/dist/vite-test/ts/tilingSprite.d.ts.map +0 -1
  105. package/dist/vite-test/ts/transition.d.ts +0 -3
  106. package/dist/vite-test/ts/transition.d.ts.map +0 -1
@@ -1,215 +1,371 @@
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')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter'], 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.ninePatch = {}), global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter));
5
- }(this, (function (exports, eva_js, pluginRenderer, rendererAdapter) { '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
- }
1
+ window.EVA = window.EVA || {};
2
+ window.EVA.plugin = window.EVA.plugin || {};
3
+ window.EVA.plugin.renderer = window.EVA.plugin.renderer || {};
4
+
5
+ var _EVA_IIFE_ninePatch = function (exports, eva_js, pluginRenderer, rendererAdapter) {
6
+ 'use strict';
7
+
8
+ var _extendStatics = function extendStatics(d, b) {
9
+ _extendStatics = Object.setPrototypeOf || {
10
+ __proto__: []
11
+ } instanceof Array && function (d, b) {
12
+ d.__proto__ = b;
13
+ } || function (d, b) {
14
+ for (var p in b) {
15
+ if (b.hasOwnProperty(p)) d[p] = b[p];
16
+ }
17
+ };
18
+
19
+ return _extendStatics(d, b);
20
+ };
21
+
22
+ function __extends(d, b) {
23
+ _extendStatics(d, b);
24
+
25
+ function __() {
26
+ this.constructor = d;
27
+ }
28
+
29
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30
+ }
31
+
32
+ function __decorate(decorators, target, key, desc) {
33
+ var c = arguments.length,
34
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
35
+ d;
36
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
37
+ if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
38
+ }
39
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
40
+ }
41
+
42
+ function __awaiter(thisArg, _arguments, P, generator) {
43
+ function adopt(value) {
44
+ return value instanceof P ? value : new P(function (resolve) {
45
+ resolve(value);
46
+ });
47
+ }
48
+
49
+ return new (P || (P = Promise))(function (resolve, reject) {
50
+ function fulfilled(value) {
51
+ try {
52
+ step(generator.next(value));
53
+ } catch (e) {
54
+ reject(e);
55
+ }
56
+ }
57
+
58
+ function rejected(value) {
59
+ try {
60
+ step(generator["throw"](value));
61
+ } catch (e) {
62
+ reject(e);
63
+ }
64
+ }
65
+
66
+ function step(result) {
67
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
68
+ }
69
+
70
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
71
+ });
72
+ }
73
+
74
+ function __generator(thisArg, body) {
75
+ var _ = {
76
+ label: 0,
77
+ sent: function sent() {
78
+ if (t[0] & 1) throw t[1];
79
+ return t[1];
80
+ },
81
+ trys: [],
82
+ ops: []
83
+ },
84
+ f,
85
+ y,
86
+ t,
87
+ g;
88
+ return g = {
89
+ next: verb(0),
90
+ "throw": verb(1),
91
+ "return": verb(2)
92
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
93
+ return this;
94
+ }), g;
95
+
96
+ function verb(n) {
97
+ return function (v) {
98
+ return step([n, v]);
99
+ };
100
+ }
101
+
102
+ function step(op) {
103
+ if (f) throw new TypeError("Generator is already executing.");
104
+
105
+ while (_) {
106
+ try {
107
+ 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;
108
+ if (y = 0, t) op = [op[0] & 2, t.value];
109
+
110
+ switch (op[0]) {
111
+ case 0:
112
+ case 1:
113
+ t = op;
114
+ break;
115
+
116
+ case 4:
117
+ _.label++;
118
+ return {
119
+ value: op[1],
120
+ done: false
121
+ };
122
+
123
+ case 5:
124
+ _.label++;
125
+ y = op[1];
126
+ op = [0];
127
+ continue;
128
+
129
+ case 7:
130
+ op = _.ops.pop();
131
+
132
+ _.trys.pop();
133
+
134
+ continue;
135
+
136
+ default:
137
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
138
+ _ = 0;
139
+ continue;
140
+ }
141
+
142
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
143
+ _.label = op[1];
144
+ break;
145
+ }
146
+
147
+ if (op[0] === 6 && _.label < t[1]) {
148
+ _.label = t[1];
149
+ t = op;
150
+ break;
151
+ }
152
+
153
+ if (t && _.label < t[2]) {
154
+ _.label = t[2];
155
+
156
+ _.ops.push(op);
157
+
158
+ break;
159
+ }
160
+
161
+ if (t[2]) _.ops.pop();
162
+
163
+ _.trys.pop();
164
+
165
+ continue;
166
+ }
167
+
168
+ op = body.call(thisArg, _);
169
+ } catch (e) {
170
+ op = [6, e];
171
+ y = 0;
172
+ } finally {
173
+ f = t = 0;
174
+ }
175
+ }
176
+
177
+ if (op[0] & 5) throw op[1];
178
+ return {
179
+ value: op[0] ? op[1] : void 0,
180
+ done: true
181
+ };
182
+ }
183
+ }
184
+
185
+ function getIDEPropsPropertyObj(target, propertyKey) {
186
+ if (!target.constructor.IDEProps) {
187
+ target.constructor.IDEProps = {};
79
188
  }
80
189
 
81
- var NinePatch$1 = (function (_super) {
82
- __extends(NinePatch, _super);
83
- function NinePatch() {
84
- var _this = _super !== null && _super.apply(this, arguments) || this;
85
- _this.resource = '';
86
- _this.spriteName = '';
87
- _this.leftWidth = 0;
88
- _this.topHeight = 0;
89
- _this.rightWidth = 0;
90
- _this.bottomHeight = 0;
91
- return _this;
92
- }
93
- NinePatch.prototype.init = function (obj) {
94
- this.resource = obj.resource;
95
- this.spriteName = obj.spriteName;
96
- this.leftWidth = obj.leftWidth;
97
- this.topHeight = obj.topHeight;
98
- this.rightWidth = obj.rightWidth;
99
- this.bottomHeight = obj.bottomHeight;
100
- };
101
- NinePatch.componentName = 'NinePatch';
102
- __decorate([
103
- eva_js.decorators.IDEProp
104
- ], NinePatch.prototype, "resource", void 0);
105
- __decorate([
106
- eva_js.decorators.IDEProp
107
- ], NinePatch.prototype, "spriteName", void 0);
108
- __decorate([
109
- eva_js.decorators.IDEProp
110
- ], NinePatch.prototype, "leftWidth", void 0);
111
- __decorate([
112
- eva_js.decorators.IDEProp
113
- ], NinePatch.prototype, "topHeight", void 0);
114
- __decorate([
115
- eva_js.decorators.IDEProp
116
- ], NinePatch.prototype, "rightWidth", void 0);
117
- __decorate([
118
- eva_js.decorators.IDEProp
119
- ], NinePatch.prototype, "bottomHeight", void 0);
120
- return NinePatch;
121
- }(eva_js.Component));
122
-
123
- var resourceKeySplit = '_s|r|c_';
124
- var NinePatch = (function (_super) {
125
- __extends(NinePatch, _super);
126
- function NinePatch() {
127
- var _this = _super !== null && _super.apply(this, arguments) || this;
128
- _this.name = 'NinePatch';
129
- _this.ninePatch = {};
130
- return _this;
131
- }
132
- NinePatch.prototype.init = function () {
133
- this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem);
134
- this.renderSystem.rendererManager.register(this);
135
- };
136
- NinePatch.prototype.rendererUpdate = function (gameObject) {
137
- var _a = gameObject.transform.size, width = _a.width, height = _a.height;
138
- if (this.ninePatch[gameObject.id]) {
139
- this.ninePatch[gameObject.id].width = width;
140
- this.ninePatch[gameObject.id].height = height;
141
- }
142
- };
143
- NinePatch.prototype.componentChanged = function (changed) {
144
- return __awaiter(this, void 0, void 0, function () {
145
- return __generator(this, function (_a) {
146
- if (changed.componentName === 'NinePatch') {
147
- if (changed.type === eva_js.OBSERVER_TYPE.ADD) {
148
- this.add(changed);
149
- }
150
- else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
151
- this.remove(changed);
152
- }
153
- else {
154
- this.remove(changed);
155
- this.add(changed);
156
- }
157
- }
158
- return [2];
159
- });
160
- });
161
- };
162
- NinePatch.prototype.add = function (changed) {
163
- return __awaiter(this, void 0, void 0, function () {
164
- var component, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
165
- return __generator(this, function (_b) {
166
- switch (_b.label) {
167
- case 0:
168
- component = changed.component;
169
- return [4, eva_js.resource.getResource(component.resource)];
170
- case 1:
171
- _a = _b.sent(), type = _a.type, data = _a.data;
172
- if (!data) {
173
- throw new Error("GameObject:" + changed.gameObject.name + "'s NinePatch resource load error");
174
- }
175
- if (type === eva_js.RESOURCE_TYPE.SPRITE) {
176
- img = component.resource + resourceKeySplit + component.spriteName;
177
- }
178
- else {
179
- img = data.image;
180
- }
181
- leftWidth = component.leftWidth, topHeight = component.topHeight, rightWidth = component.rightWidth, bottomHeight = component.bottomHeight;
182
- np = new rendererAdapter.NinePatch(img, leftWidth, topHeight, rightWidth, bottomHeight);
183
- this.ninePatch[changed.gameObject.id] = np;
184
- component.ninePatch = np;
185
- this.containerManager
186
- .getContainer(changed.gameObject.id)
187
- .addChildAt(np, 0);
188
- return [2];
189
- }
190
- });
191
- });
192
- };
193
- NinePatch.prototype.remove = function (changed) {
194
- var sprite = this.ninePatch[changed.gameObject.id];
195
- if (sprite) {
196
- this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);
197
- delete this.ninePatch[changed.gameObject.id];
198
- sprite.destroy({ children: true });
199
- }
200
- };
201
- NinePatch.systemName = 'NinePatch';
202
- NinePatch = __decorate([
203
- eva_js.decorators.componentObserver({
204
- NinePatch: ['resource', 'spriteName', 'leftWidth', 'topHeight', 'rightWidth', 'bottomHeight'],
205
- })
206
- ], NinePatch);
207
- return NinePatch;
208
- }(pluginRenderer.Renderer));
209
-
210
- exports.NinePatch = NinePatch$1;
211
- exports.NinePatchSystem = NinePatch;
212
-
213
- Object.defineProperty(exports, '__esModule', { value: true });
214
-
215
- })));
190
+ if (!target.constructor.IDEProps[propertyKey]) {
191
+ target.constructor.IDEProps[propertyKey] = {};
192
+ }
193
+
194
+ var propertyObj = target.constructor.IDEProps[propertyKey];
195
+ return propertyObj;
196
+ }
197
+
198
+ function type(type) {
199
+ return function (target, propertyKey) {
200
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
201
+ prop.key = propertyKey;
202
+ prop.type = type;
203
+ };
204
+ }
205
+
206
+ function step(step) {
207
+ return function (target, propertyKey) {
208
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
209
+ prop.step = step;
210
+ };
211
+ }
212
+
213
+ var NinePatch$2 = function (_super) {
214
+ __extends(NinePatch, _super);
215
+
216
+ function NinePatch() {
217
+ var _this = _super !== null && _super.apply(this, arguments) || this;
218
+
219
+ _this.resource = '';
220
+ _this.spriteName = '';
221
+ _this.leftWidth = 0;
222
+ _this.topHeight = 0;
223
+ _this.rightWidth = 0;
224
+ _this.bottomHeight = 0;
225
+ return _this;
226
+ }
227
+
228
+ NinePatch.prototype.init = function (obj) {
229
+ this.resource = obj.resource;
230
+ this.spriteName = obj.spriteName;
231
+ this.leftWidth = obj.leftWidth;
232
+ this.topHeight = obj.topHeight;
233
+ this.rightWidth = obj.rightWidth;
234
+ this.bottomHeight = obj.bottomHeight;
235
+ };
236
+
237
+ NinePatch.componentName = 'NinePatch';
238
+
239
+ __decorate([type('string')], NinePatch.prototype, "resource", void 0);
240
+
241
+ __decorate([type('string')], NinePatch.prototype, "spriteName", void 0);
242
+
243
+ __decorate([type('number'), step(1)], NinePatch.prototype, "leftWidth", void 0);
244
+
245
+ __decorate([type('number'), step(1)], NinePatch.prototype, "topHeight", void 0);
246
+
247
+ __decorate([type('number'), step(1)], NinePatch.prototype, "rightWidth", void 0);
248
+
249
+ __decorate([type('number'), step(1)], NinePatch.prototype, "bottomHeight", void 0);
250
+
251
+ return NinePatch;
252
+ }(eva_js.Component);
253
+
254
+ var NinePatch$3 = NinePatch$2;
255
+ var resourceKeySplit = '_s|r|c_';
256
+
257
+ var NinePatch = function (_super) {
258
+ __extends(NinePatch, _super);
259
+
260
+ function NinePatch() {
261
+ var _this = _super !== null && _super.apply(this, arguments) || this;
262
+
263
+ _this.name = 'NinePatch';
264
+ _this.ninePatch = {};
265
+ return _this;
266
+ }
267
+
268
+ NinePatch.prototype.init = function () {
269
+ this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem);
270
+ this.renderSystem.rendererManager.register(this);
271
+ };
272
+
273
+ NinePatch.prototype.rendererUpdate = function (gameObject) {
274
+ var _a = gameObject.transform.size,
275
+ width = _a.width,
276
+ height = _a.height;
277
+
278
+ if (this.ninePatch[gameObject.id]) {
279
+ this.ninePatch[gameObject.id].width = width;
280
+ this.ninePatch[gameObject.id].height = height;
281
+ }
282
+ };
283
+
284
+ NinePatch.prototype.componentChanged = function (changed) {
285
+ return __awaiter(this, void 0, void 0, function () {
286
+ return __generator(this, function (_a) {
287
+ if (changed.componentName === 'NinePatch') {
288
+ if (changed.type === eva_js.OBSERVER_TYPE.ADD) {
289
+ this.add(changed);
290
+ } else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
291
+ this.remove(changed);
292
+ } else {
293
+ this.remove(changed);
294
+ this.add(changed);
295
+ }
296
+ }
297
+
298
+ return [2];
299
+ });
300
+ });
301
+ };
302
+
303
+ NinePatch.prototype.add = function (changed) {
304
+ return __awaiter(this, void 0, void 0, function () {
305
+ var component, gameObjectId, asyncId, _a, type, data, img, leftWidth, topHeight, rightWidth, bottomHeight, np;
306
+
307
+ return __generator(this, function (_b) {
308
+ switch (_b.label) {
309
+ case 0:
310
+ component = changed.component;
311
+ gameObjectId = changed.gameObject.id;
312
+ asyncId = this.increaseAsyncId(gameObjectId);
313
+ return [4, eva_js.resource.getResource(component.resource)];
314
+
315
+ case 1:
316
+ _a = _b.sent(), type = _a.type, data = _a.data;
317
+ if (!this.validateAsyncId(gameObjectId, asyncId)) return [2];
318
+
319
+ if (!data) {
320
+ console.error("GameObject:" + changed.gameObject.name + "'s NinePatch resource load error");
321
+ return [2];
322
+ }
323
+
324
+ if (type === eva_js.RESOURCE_TYPE.SPRITE) {
325
+ img = component.resource + resourceKeySplit + component.spriteName;
326
+ } else {
327
+ img = data.image;
328
+ }
329
+
330
+ leftWidth = component.leftWidth, topHeight = component.topHeight, rightWidth = component.rightWidth, bottomHeight = component.bottomHeight;
331
+ np = new rendererAdapter.NinePatch(img, leftWidth, topHeight, rightWidth, bottomHeight);
332
+ this.ninePatch[changed.gameObject.id] = np;
333
+ component.ninePatch = np;
334
+ this.containerManager.getContainer(changed.gameObject.id).addChildAt(np, 0);
335
+ return [2];
336
+ }
337
+ });
338
+ });
339
+ };
340
+
341
+ NinePatch.prototype.remove = function (changed) {
342
+ var gameObjectId = changed.gameObject.id;
343
+ this.increaseAsyncId(gameObjectId);
344
+ var sprite = this.ninePatch[gameObjectId];
345
+
346
+ if (sprite) {
347
+ this.containerManager.getContainer(changed.gameObject.id).removeChild(sprite);
348
+ delete this.ninePatch[changed.gameObject.id];
349
+ sprite.destroy({
350
+ children: true
351
+ });
352
+ }
353
+ };
354
+
355
+ NinePatch.systemName = 'NinePatch';
356
+ NinePatch = __decorate([eva_js.decorators.componentObserver({
357
+ NinePatch: ['resource', 'spriteName', 'leftWidth', 'topHeight', 'rightWidth', 'bottomHeight']
358
+ })], NinePatch);
359
+ return NinePatch;
360
+ }(pluginRenderer.Renderer);
361
+
362
+ var NinePatch$1 = NinePatch;
363
+ exports.NinePatch = NinePatch$3;
364
+ exports.NinePatchSystem = NinePatch$1;
365
+ Object.defineProperty(exports, '__esModule', {
366
+ value: true
367
+ });
368
+ return exports;
369
+ }({}, EVA, EVA.plugin.renderer, EVA.rendererAdapter);
370
+
371
+ window.EVA.plugin.renderer.ninePatch = window.EVA.plugin.renderer.ninePatch || _EVA_IIFE_ninePatch;
@@ -1 +1,2 @@
1
1
  var e,t;e=this,t=function(e,t,r,n){"use strict";var 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 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 a(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{h(n.next(e))}catch(e){i(e)}}function c(e){try{h(n.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}h((n=n.apply(e,t||[])).next())}))}function h(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)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 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=t.call(e,a)}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,c])}}}var s=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.spriteName="",t.leftWidth=0,t.topHeight=0,t.rightWidth=0,t.bottomHeight=0,t}return i(r,e),r.prototype.init=function(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},r.componentName="NinePatch",a([t.decorators.IDEProp],r.prototype,"resource",void 0),a([t.decorators.IDEProp],r.prototype,"spriteName",void 0),a([t.decorators.IDEProp],r.prototype,"leftWidth",void 0),a([t.decorators.IDEProp],r.prototype,"topHeight",void 0),a([t.decorators.IDEProp],r.prototype,"rightWidth",void 0),a([t.decorators.IDEProp],r.prototype,"bottomHeight",void 0),r}(t.Component),p=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="NinePatch",t.ninePatch={},t}return i(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height;this.ninePatch[e.id]&&(this.ninePatch[e.id].width=r,this.ninePatch[e.id].height=n)},o.prototype.componentChanged=function(e){return c(this,void 0,void 0,(function(){return h(this,(function(r){return"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))),[2]}))}))},o.prototype.add=function(e){return c(this,void 0,void 0,(function(){var r,o,i,a,c,s,p,u,d,l;return h(this,(function(h){switch(h.label){case 0:return r=e.component,[4,t.resource.getResource(r.resource)];case 1:if(o=h.sent(),i=o.type,!(a=o.data))throw new Error("GameObject:"+e.gameObject.name+"'s NinePatch resource load error");return c=i===t.RESOURCE_TYPE.SPRITE?r.resource+"_s|r|c_"+r.spriteName:a.image,s=r.leftWidth,p=r.topHeight,u=r.rightWidth,d=r.bottomHeight,l=new n.NinePatch(c,s,p,u,d),this.ninePatch[e.gameObject.id]=l,r.ninePatch=l,this.containerManager.getContainer(e.gameObject.id).addChildAt(l,0),[2]}}))}))},o.prototype.remove=function(e){var t=this.ninePatch[e.gameObject.id];t&&(this.containerManager.getContainer(e.gameObject.id).removeChild(t),delete this.ninePatch[e.gameObject.id],t.destroy({children:!0}))},o.systemName="NinePatch",o=a([t.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],o)}(r.Renderer);e.NinePatch=s,e.NinePatchSystem=p,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter"],t):t(((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.ninePatch={}),e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter);
2
+ //# sourceMappingURL=EVA.plugin.renderer.ninePatch.min.js.map