@eva/plugin-renderer-text 1.3.0-alpha.1 → 2.0.0-beta.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/dist/EVA.plugin.renderer.text.js +77 -143
- package/dist/EVA.plugin.renderer.text.min.js +1 -1
- package/dist/plugin-renderer-text.cjs.js +1 -0
- package/dist/plugin-renderer-text.cjs.prod.js +1 -1
- package/dist/plugin-renderer-text.d.ts +13 -7
- package/dist/plugin-renderer-text.esm.js +1 -0
- package/package.json +5 -5
|
@@ -1,53 +1,39 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRenderer, rendererAdapter) {
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
window.EVA = window.EVA || {};
|
|
3
|
+
window.EVA.plugin = window.EVA.plugin || {};
|
|
4
|
+
window.EVA.plugin.renderer = window.EVA.plugin.renderer || {};
|
|
5
|
+
var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendererAdapter) {
|
|
8
6
|
'use strict';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_extendStatics = Object.setPrototypeOf || {
|
|
7
|
+
var extendStatics = function (d, b) {
|
|
8
|
+
extendStatics = Object.setPrototypeOf || {
|
|
12
9
|
__proto__: []
|
|
13
10
|
} instanceof Array && function (d, b) {
|
|
14
11
|
d.__proto__ = b;
|
|
15
12
|
} || function (d, b) {
|
|
16
|
-
for (var p in b)
|
|
17
|
-
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
18
|
-
}
|
|
13
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
19
14
|
};
|
|
20
|
-
|
|
21
|
-
return _extendStatics(d, b);
|
|
15
|
+
return extendStatics(d, b);
|
|
22
16
|
};
|
|
23
|
-
|
|
24
17
|
function __extends(d, b) {
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
extendStatics(d, b);
|
|
27
19
|
function __() {
|
|
28
20
|
this.constructor = d;
|
|
29
21
|
}
|
|
30
|
-
|
|
31
22
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function __decorate(decorators, target, key, desc) {
|
|
35
25
|
var c = arguments.length,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
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--)
|
|
39
|
-
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
40
|
-
}
|
|
26
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
27
|
+
d;
|
|
28
|
+
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--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
41
29
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
45
32
|
function adopt(value) {
|
|
46
33
|
return value instanceof P ? value : new P(function (resolve) {
|
|
47
34
|
resolve(value);
|
|
48
35
|
});
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
52
38
|
function fulfilled(value) {
|
|
53
39
|
try {
|
|
@@ -56,7 +42,6 @@ this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRender
|
|
|
56
42
|
reject(e);
|
|
57
43
|
}
|
|
58
44
|
}
|
|
59
|
-
|
|
60
45
|
function rejected(value) {
|
|
61
46
|
try {
|
|
62
47
|
step(generator["throw"](value));
|
|
@@ -64,29 +49,26 @@ this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRender
|
|
|
64
49
|
reject(e);
|
|
65
50
|
}
|
|
66
51
|
}
|
|
67
|
-
|
|
68
52
|
function step(result) {
|
|
69
53
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
70
54
|
}
|
|
71
|
-
|
|
72
55
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
73
56
|
});
|
|
74
57
|
}
|
|
75
|
-
|
|
76
58
|
function __generator(thisArg, body) {
|
|
77
59
|
var _ = {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
60
|
+
label: 0,
|
|
61
|
+
sent: function () {
|
|
62
|
+
if (t[0] & 1) throw t[1];
|
|
63
|
+
return t[1];
|
|
64
|
+
},
|
|
65
|
+
trys: [],
|
|
66
|
+
ops: []
|
|
82
67
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
y,
|
|
88
|
-
t,
|
|
89
|
-
g;
|
|
68
|
+
f,
|
|
69
|
+
y,
|
|
70
|
+
t,
|
|
71
|
+
g;
|
|
90
72
|
return g = {
|
|
91
73
|
next: verb(0),
|
|
92
74
|
"throw": verb(1),
|
|
@@ -94,88 +76,66 @@ this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRender
|
|
|
94
76
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
95
77
|
return this;
|
|
96
78
|
}), g;
|
|
97
|
-
|
|
98
79
|
function verb(n) {
|
|
99
80
|
return function (v) {
|
|
100
81
|
return step([n, v]);
|
|
101
82
|
};
|
|
102
83
|
}
|
|
103
|
-
|
|
104
84
|
function step(op) {
|
|
105
85
|
if (f) throw new TypeError("Generator is already executing.");
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
86
|
+
while (_) try {
|
|
87
|
+
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;
|
|
88
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
89
|
+
switch (op[0]) {
|
|
90
|
+
case 0:
|
|
91
|
+
case 1:
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
case 4:
|
|
95
|
+
_.label++;
|
|
96
|
+
return {
|
|
97
|
+
value: op[1],
|
|
98
|
+
done: false
|
|
99
|
+
};
|
|
100
|
+
case 5:
|
|
101
|
+
_.label++;
|
|
102
|
+
y = op[1];
|
|
103
|
+
op = [0];
|
|
104
|
+
continue;
|
|
105
|
+
case 7:
|
|
106
|
+
op = _.ops.pop();
|
|
107
|
+
_.trys.pop();
|
|
108
|
+
continue;
|
|
109
|
+
default:
|
|
110
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
111
|
+
_ = 0;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
115
|
+
_.label = op[1];
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
119
|
+
_.label = t[1];
|
|
115
120
|
t = op;
|
|
116
121
|
break;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
_.label
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
_.label++;
|
|
127
|
-
y = op[1];
|
|
128
|
-
op = [0];
|
|
129
|
-
continue;
|
|
130
|
-
|
|
131
|
-
case 7:
|
|
132
|
-
op = _.ops.pop();
|
|
133
|
-
|
|
134
|
-
_.trys.pop();
|
|
135
|
-
|
|
136
|
-
continue;
|
|
137
|
-
|
|
138
|
-
default:
|
|
139
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
140
|
-
_ = 0;
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
145
|
-
_.label = op[1];
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
150
|
-
_.label = t[1];
|
|
151
|
-
t = op;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (t && _.label < t[2]) {
|
|
156
|
-
_.label = t[2];
|
|
157
|
-
|
|
158
|
-
_.ops.push(op);
|
|
159
|
-
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (t[2]) _.ops.pop();
|
|
164
|
-
|
|
165
|
-
_.trys.pop();
|
|
166
|
-
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
op = body.call(thisArg, _);
|
|
171
|
-
} catch (e) {
|
|
172
|
-
op = [6, e];
|
|
173
|
-
y = 0;
|
|
174
|
-
} finally {
|
|
175
|
-
f = t = 0;
|
|
122
|
+
}
|
|
123
|
+
if (t && _.label < t[2]) {
|
|
124
|
+
_.label = t[2];
|
|
125
|
+
_.ops.push(op);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
if (t[2]) _.ops.pop();
|
|
129
|
+
_.trys.pop();
|
|
130
|
+
continue;
|
|
176
131
|
}
|
|
132
|
+
op = body.call(thisArg, _);
|
|
133
|
+
} catch (e) {
|
|
134
|
+
op = [6, e];
|
|
135
|
+
y = 0;
|
|
136
|
+
} finally {
|
|
137
|
+
f = t = 0;
|
|
177
138
|
}
|
|
178
|
-
|
|
179
139
|
if (op[0] & 5) throw op[1];
|
|
180
140
|
return {
|
|
181
141
|
value: op[0] ? op[1] : void 0,
|
|
@@ -183,20 +143,16 @@ this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRender
|
|
|
183
143
|
};
|
|
184
144
|
}
|
|
185
145
|
}
|
|
186
|
-
|
|
187
146
|
function getIDEPropsPropertyObj(target, propertyKey) {
|
|
188
147
|
if (!target.constructor.IDEProps) {
|
|
189
148
|
target.constructor.IDEProps = {};
|
|
190
149
|
}
|
|
191
|
-
|
|
192
150
|
if (!target.constructor.IDEProps[propertyKey]) {
|
|
193
151
|
target.constructor.IDEProps[propertyKey] = {};
|
|
194
152
|
}
|
|
195
|
-
|
|
196
153
|
var propertyObj = target.constructor.IDEProps[propertyKey];
|
|
197
154
|
return propertyObj;
|
|
198
155
|
}
|
|
199
|
-
|
|
200
156
|
function type(type) {
|
|
201
157
|
return function (target, propertyKey) {
|
|
202
158
|
var prop = getIDEPropsPropertyObj(target, propertyKey);
|
|
@@ -204,70 +160,53 @@ this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRender
|
|
|
204
160
|
prop.type = type;
|
|
205
161
|
};
|
|
206
162
|
}
|
|
207
|
-
|
|
208
163
|
var Text$2 = function (_super) {
|
|
209
164
|
__extends(Text, _super);
|
|
210
|
-
|
|
211
165
|
function Text() {
|
|
212
166
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
213
|
-
|
|
214
167
|
_this.text = '';
|
|
215
168
|
_this.style = {};
|
|
216
169
|
return _this;
|
|
217
170
|
}
|
|
218
|
-
|
|
219
171
|
Text.prototype.init = function (obj) {
|
|
220
172
|
var style = new pixi_js.TextStyle({
|
|
221
173
|
fontSize: 20
|
|
222
174
|
});
|
|
223
175
|
var newStyle = {};
|
|
224
|
-
|
|
225
176
|
for (var key in style) {
|
|
226
177
|
if (key.indexOf('_') === 0) {
|
|
227
178
|
newStyle[key.substring(1)] = style[key];
|
|
228
179
|
}
|
|
229
180
|
}
|
|
230
|
-
|
|
181
|
+
delete newStyle['styleKey'];
|
|
231
182
|
this.style = newStyle;
|
|
232
|
-
|
|
233
183
|
if (obj) {
|
|
234
184
|
this.text = obj.text;
|
|
235
|
-
|
|
236
185
|
_extends(this.style, obj.style);
|
|
237
186
|
}
|
|
238
187
|
};
|
|
239
|
-
|
|
240
188
|
Text.componentName = 'Text';
|
|
241
|
-
|
|
242
189
|
__decorate([type('string')], Text.prototype, "text", void 0);
|
|
243
|
-
|
|
244
190
|
return Text;
|
|
245
191
|
}(eva_js.Component);
|
|
246
|
-
|
|
247
192
|
var Text$3 = Text$2;
|
|
248
|
-
|
|
249
193
|
var Text = function (_super) {
|
|
250
194
|
__extends(Text, _super);
|
|
251
|
-
|
|
252
195
|
function Text() {
|
|
253
196
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
254
|
-
|
|
255
197
|
_this.name = 'Text';
|
|
256
198
|
_this.texts = {};
|
|
257
199
|
return _this;
|
|
258
200
|
}
|
|
259
|
-
|
|
260
201
|
Text.prototype.init = function () {
|
|
261
202
|
this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem);
|
|
262
203
|
this.renderSystem.rendererManager.register(this);
|
|
263
204
|
};
|
|
264
|
-
|
|
265
205
|
Text.prototype.componentChanged = function (changed) {
|
|
266
206
|
return __awaiter(this, void 0, void 0, function () {
|
|
267
207
|
var component, text;
|
|
268
208
|
return __generator(this, function (_a) {
|
|
269
209
|
if (changed.componentName !== 'Text') return [2];
|
|
270
|
-
|
|
271
210
|
if (changed.type === eva_js.OBSERVER_TYPE.ADD) {
|
|
272
211
|
component = changed.component;
|
|
273
212
|
text = new rendererAdapter.Text(component.text, component.style);
|
|
@@ -287,31 +226,26 @@ this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRender
|
|
|
287
226
|
this.change(changed);
|
|
288
227
|
this.setSize(changed);
|
|
289
228
|
}
|
|
290
|
-
|
|
291
229
|
return [2];
|
|
292
230
|
});
|
|
293
231
|
});
|
|
294
232
|
};
|
|
295
|
-
|
|
296
233
|
Text.prototype.change = function (changed) {
|
|
297
234
|
var _a = this.texts[changed.gameObject.id],
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
235
|
+
text = _a.text,
|
|
236
|
+
component = _a.component;
|
|
301
237
|
if (changed.prop.prop[0] === 'text') {
|
|
302
238
|
text.text = component.text;
|
|
303
239
|
} else if (changed.prop.prop[0] === 'style') {
|
|
304
240
|
_extends(text.style, changed.component.style);
|
|
305
241
|
}
|
|
306
242
|
};
|
|
307
|
-
|
|
308
243
|
Text.prototype.setSize = function (changed) {
|
|
309
244
|
var transform = changed.gameObject.transform;
|
|
310
245
|
if (!transform) return;
|
|
311
246
|
transform.size.width = this.texts[changed.gameObject.id].text.width;
|
|
312
247
|
transform.size.height = this.texts[changed.gameObject.id].text.height;
|
|
313
248
|
};
|
|
314
|
-
|
|
315
249
|
Text.systemName = 'Text';
|
|
316
250
|
Text = __decorate([eva_js.decorators.componentObserver({
|
|
317
251
|
Text: ['text', {
|
|
@@ -321,7 +255,6 @@ this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRender
|
|
|
321
255
|
})], Text);
|
|
322
256
|
return Text;
|
|
323
257
|
}(pluginRenderer.Renderer);
|
|
324
|
-
|
|
325
258
|
var Text$1 = Text;
|
|
326
259
|
exports.Text = Text$3;
|
|
327
260
|
exports.TextSystem = Text$1;
|
|
@@ -330,3 +263,4 @@ this.EVA.plugin.renderer.text = function (exports, pixi_js, eva_js, pluginRender
|
|
|
330
263
|
});
|
|
331
264
|
return exports;
|
|
332
265
|
}({}, PIXI, EVA, EVA.plugin.renderer, EVA.rendererAdapter);
|
|
266
|
+
window.EVA.plugin.renderer.text = window.EVA.plugin.renderer.text || _EVA_IIFE_text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_extends.apply(null,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_text=function(t,e,n,r,o){"use strict";var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},i(t,e)};function c(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e,n,r){var o,i=arguments.length,c=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(c=(i<3?o(c):i>3?o(e,n,c):o(e,n))||c);return i>3&&c&&Object.defineProperty(e,n,c),c}function a(t,e,n,r){return new(n||(n=Promise))((function(o,i){function c(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,s)}a((r=r.apply(t,e||[])).next())}))}function u(t,e){var n,r,o,i,c={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(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=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=e.call(t,c)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function p(t){return function(e,n){var r=function(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}(e,n);r.key=n,r.type=t}}var l=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="",e.style={},e}return c(n,t),n.prototype.init=function(t){var n=new e.TextStyle({fontSize:20}),r={};for(var o in n)0===o.indexOf("_")&&(r[o.substring(1)]=n[o]);delete r.styleKey,this.style=r,t&&(this.text=t.text,_extends(this.style,t.style))},n.componentName="Text",s([p("string")],n.prototype,"text",void 0),n}(n.Component),f=l,d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Text",e.texts={},e}return c(e,t),e.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},e.prototype.componentChanged=function(t){return a(this,void 0,void 0,(function(){var e,r;return u(this,(function(i){return"Text"!==t.componentName||(t.type===n.OBSERVER_TYPE.ADD?(e=t.component,r=new o.Text(e.text,e.style),this.containerManager.getContainer(t.gameObject.id).addChildAt(r,0),this.texts[t.gameObject.id]={text:r,component:t.component},this.setSize(t)):t.type===n.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(t.gameObject.id).removeChild(this.texts[t.gameObject.id].text),this.texts[t.gameObject.id].text.destroy({children:!0}),delete this.texts[t.gameObject.id]):(this.change(t),this.setSize(t))),[2]}))}))},e.prototype.change=function(t){var e=this.texts[t.gameObject.id],n=e.text,r=e.component;"text"===t.prop.prop[0]?n.text=r.text:"style"===t.prop.prop[0]&&_extends(n.style,t.component.style)},e.prototype.setSize=function(t){var e=t.gameObject.transform;e&&(e.size.width=this.texts[t.gameObject.id].text.width,e.size.height=this.texts[t.gameObject.id].text.height)},e.systemName="Text",e=s([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],e)}(r.Renderer),h=d;return t.Text=f,t.TextSystem=h,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.text=window.EVA.plugin.renderer.text||_EVA_IIFE_text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js"),t=require("@eva/eva.js"),n=require("@eva/inspector-decorator"),r=require("@eva/plugin-renderer"),o=require("@eva/renderer-adapter"),i=function(e,t){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js"),t=require("@eva/eva.js"),n=require("@eva/inspector-decorator"),r=require("@eva/plugin-renderer"),o=require("@eva/renderer-adapter"),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},i(e,t)};function s(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function a(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}function c(e,t){var n,r,o,i,s={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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var p=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="",e.style={},e}return s(r,t),r.prototype.init=function(t){var n=new e.TextStyle({fontSize:20}),r={};for(var o in n)0===o.indexOf("_")&&(r[o.substring(1)]=n[o]);delete r.styleKey,this.style=r,t&&(this.text=t.text,Object.assign(this.style,t.style))},r.componentName="Text",a([n.type("string")],r.prototype,"text",void 0),r}(t.Component),u=p,l=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Text",t.texts={},t}return s(n,e),n.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},n.prototype.componentChanged=function(e){return n=this,r=void 0,s=function(){var n,r;return c(this,(function(i){return"Text"!==e.componentName||(e.type===t.OBSERVER_TYPE.ADD?(n=e.component,r=new o.Text(n.text,n.style),this.containerManager.getContainer(e.gameObject.id).addChildAt(r,0),this.texts[e.gameObject.id]={text:r,component:e.component},this.setSize(e)):e.type===t.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(e.gameObject.id).removeChild(this.texts[e.gameObject.id].text),this.texts[e.gameObject.id].text.destroy({children:!0}),delete this.texts[e.gameObject.id]):(this.change(e),this.setSize(e))),[2]}))},new((i=void 0)||(i=Promise))((function(e,t){function o(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(o,a)}c((s=s.apply(n,r||[])).next())}));var n,r,i,s},n.prototype.change=function(e){var t=this.texts[e.gameObject.id],n=t.text,r=t.component;"text"===e.prop.prop[0]?n.text=r.text:"style"===e.prop.prop[0]&&Object.assign(n.style,e.component.style)},n.prototype.setSize=function(e){var t=e.gameObject.transform;t&&(t.size.width=this.texts[e.gameObject.id].text.width,t.size.height=this.texts[e.gameObject.id].text.height)},n.systemName="Text",n=a([t.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],n)}(r.Renderer);exports.Text=u,exports.TextSystem=l;
|
|
@@ -5,6 +5,12 @@ import { Renderer } from '@eva/plugin-renderer';
|
|
|
5
5
|
import { RendererManager } from '@eva/plugin-renderer';
|
|
6
6
|
import { RendererSystem } from '@eva/plugin-renderer';
|
|
7
7
|
import { Text as Text_3 } from '@eva/renderer-adapter';
|
|
8
|
+
import { TextStyleAlign } from 'pixi.js';
|
|
9
|
+
import { TextStyleFontStyle } from 'pixi.js';
|
|
10
|
+
import { TextStyleFontVariant } from 'pixi.js';
|
|
11
|
+
import { TextStyleFontWeight } from 'pixi.js';
|
|
12
|
+
import { TextStyleTextBaseline } from 'pixi.js';
|
|
13
|
+
import { TextStyleWhiteSpace } from 'pixi.js';
|
|
8
14
|
|
|
9
15
|
declare class Text_2 extends Component<TextParams> {
|
|
10
16
|
static componentName: string;
|
|
@@ -17,7 +23,7 @@ export { Text_2 as Text }
|
|
|
17
23
|
export declare interface TextParams {
|
|
18
24
|
text: string;
|
|
19
25
|
style?: {
|
|
20
|
-
align?:
|
|
26
|
+
align?: TextStyleAlign;
|
|
21
27
|
breakWords?: boolean;
|
|
22
28
|
dropShadow?: boolean;
|
|
23
29
|
dropShadowAlpha?: number;
|
|
@@ -25,14 +31,14 @@ export declare interface TextParams {
|
|
|
25
31
|
dropShadowBlur?: number;
|
|
26
32
|
dropShadowColor?: string | number;
|
|
27
33
|
dropShadowDistance?: number;
|
|
28
|
-
fill?:
|
|
34
|
+
fill?: any;
|
|
29
35
|
fillGradientType?: number;
|
|
30
36
|
fillGradientStops?: number[];
|
|
31
37
|
fontFamily?: string | string[];
|
|
32
38
|
fontSize?: number | string;
|
|
33
|
-
fontStyle?:
|
|
34
|
-
fontVariant?:
|
|
35
|
-
fontWeight?:
|
|
39
|
+
fontStyle?: TextStyleFontStyle;
|
|
40
|
+
fontVariant?: TextStyleFontVariant;
|
|
41
|
+
fontWeight?: TextStyleFontWeight;
|
|
36
42
|
letterSpacing?: number;
|
|
37
43
|
lineHeight?: number;
|
|
38
44
|
lineJoin?: string;
|
|
@@ -40,9 +46,9 @@ export declare interface TextParams {
|
|
|
40
46
|
padding?: number;
|
|
41
47
|
stroke?: string | number;
|
|
42
48
|
strokeThickness?: number;
|
|
43
|
-
textBaseline?:
|
|
49
|
+
textBaseline?: TextStyleTextBaseline;
|
|
44
50
|
trim?: boolean;
|
|
45
|
-
whiteSpace?:
|
|
51
|
+
whiteSpace?: TextStyleWhiteSpace;
|
|
46
52
|
wordWrap?: boolean;
|
|
47
53
|
wordWrapWidth?: number;
|
|
48
54
|
leading?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-text",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"description": "@eva/plugin-renderer-text",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-text.esm.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@eva/inspector-decorator": "^0.0.5",
|
|
22
|
-
"@eva/plugin-renderer": "
|
|
23
|
-
"@eva/renderer-adapter": "
|
|
24
|
-
"@eva/eva.js": "
|
|
25
|
-
"pixi.js": "^
|
|
22
|
+
"@eva/plugin-renderer": "2.0.0-beta.1",
|
|
23
|
+
"@eva/renderer-adapter": "2.0.0-beta.1",
|
|
24
|
+
"@eva/eva.js": "2.0.0-beta.1",
|
|
25
|
+
"pixi.js": "^8.6.3"
|
|
26
26
|
}
|
|
27
27
|
}
|