@eva/plugin-renderer-text 2.0.2 → 2.1.0-beta.10
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 +137 -38
- package/dist/EVA.plugin.renderer.text.min.js +1 -1
- package/dist/plugin-renderer-text.cjs.js +387 -33
- package/dist/plugin-renderer-text.cjs.prod.js +1 -1
- package/dist/plugin-renderer-text.d.ts +20 -13
- package/dist/plugin-renderer-text.esm.js +388 -34
- package/package.json +5 -5
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Component, decorators, OBSERVER_TYPE, resource } from '@eva/eva.js';
|
|
2
|
-
import { type } from '@eva/inspector-decorator';
|
|
1
|
+
import { Component, type, Field, decorators, OBSERVER_TYPE, resource } from '@eva/eva.js';
|
|
3
2
|
import { TextStyle, FillGradient, Color } from 'pixi.js';
|
|
4
3
|
import { Renderer, RendererSystem } from '@eva/plugin-renderer';
|
|
5
4
|
import { HTMLText as HTMLText$1, Text as Text$3, BitmapText as BitmapText$1 } from '@eva/renderer-adapter';
|
|
@@ -26,6 +25,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
26
25
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
27
26
|
}
|
|
28
27
|
|
|
28
|
+
function __metadata(metadataKey, metadataValue) {
|
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
30
|
+
}
|
|
31
|
+
|
|
29
32
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
30
33
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
31
34
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,6 +44,48 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
41
44
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
42
45
|
};
|
|
43
46
|
|
|
47
|
+
class BitmapTextStyleMetadata {
|
|
48
|
+
}
|
|
49
|
+
__decorate([
|
|
50
|
+
type('string'),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], BitmapTextStyleMetadata.prototype, "fontFamily", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
type('number'),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], BitmapTextStyleMetadata.prototype, "fontSize", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
Field({ type: 'color' }),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], BitmapTextStyleMetadata.prototype, "fill", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
type('string'),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], BitmapTextStyleMetadata.prototype, "align", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
type('number'),
|
|
67
|
+
__metadata("design:type", Number)
|
|
68
|
+
], BitmapTextStyleMetadata.prototype, "letterSpacing", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
type('number'),
|
|
71
|
+
__metadata("design:type", Number)
|
|
72
|
+
], BitmapTextStyleMetadata.prototype, "padding", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
Field({ type: 'color' }),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], BitmapTextStyleMetadata.prototype, "stroke", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
type('number'),
|
|
79
|
+
__metadata("design:type", Number)
|
|
80
|
+
], BitmapTextStyleMetadata.prototype, "strokeThickness", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
type('string'),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], BitmapTextStyleMetadata.prototype, "fontWeight", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
type('string'),
|
|
87
|
+
__metadata("design:type", String)
|
|
88
|
+
], BitmapTextStyleMetadata.prototype, "fontStyle", void 0);
|
|
44
89
|
/**
|
|
45
90
|
* 位图文本组件
|
|
46
91
|
*
|
|
@@ -79,9 +124,184 @@ class BitmapText extends Component {
|
|
|
79
124
|
}
|
|
80
125
|
BitmapText.componentName = 'BitmapText';
|
|
81
126
|
__decorate([
|
|
82
|
-
type('string')
|
|
83
|
-
|
|
127
|
+
type('string'),
|
|
128
|
+
__metadata("design:type", String)
|
|
129
|
+
], BitmapText.prototype, "text", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
Field(() => BitmapTextStyleMetadata),
|
|
132
|
+
__metadata("design:type", Object)
|
|
133
|
+
], BitmapText.prototype, "style", void 0);
|
|
84
134
|
|
|
135
|
+
class TextStyleStrokeMetadata {
|
|
136
|
+
}
|
|
137
|
+
__decorate([
|
|
138
|
+
type('number'),
|
|
139
|
+
__metadata("design:type", Number)
|
|
140
|
+
], TextStyleStrokeMetadata.prototype, "alpha", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
Field({ type: 'color' }),
|
|
143
|
+
__metadata("design:type", Object)
|
|
144
|
+
], TextStyleStrokeMetadata.prototype, "color", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
type('string'),
|
|
147
|
+
__metadata("design:type", String)
|
|
148
|
+
], TextStyleStrokeMetadata.prototype, "join", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
type('number'),
|
|
151
|
+
__metadata("design:type", Number)
|
|
152
|
+
], TextStyleStrokeMetadata.prototype, "miterLimit", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
type('number'),
|
|
155
|
+
__metadata("design:type", Number)
|
|
156
|
+
], TextStyleStrokeMetadata.prototype, "width", void 0);
|
|
157
|
+
class TextStyleDropShadowMetadata {
|
|
158
|
+
}
|
|
159
|
+
__decorate([
|
|
160
|
+
type('number'),
|
|
161
|
+
__metadata("design:type", Number)
|
|
162
|
+
], TextStyleDropShadowMetadata.prototype, "alpha", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
type('number'),
|
|
165
|
+
__metadata("design:type", Number)
|
|
166
|
+
], TextStyleDropShadowMetadata.prototype, "angle", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
type('number'),
|
|
169
|
+
__metadata("design:type", Number)
|
|
170
|
+
], TextStyleDropShadowMetadata.prototype, "blur", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
Field({ type: 'color' }),
|
|
173
|
+
__metadata("design:type", Object)
|
|
174
|
+
], TextStyleDropShadowMetadata.prototype, "color", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
type('number'),
|
|
177
|
+
__metadata("design:type", Number)
|
|
178
|
+
], TextStyleDropShadowMetadata.prototype, "distance", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
type('boolean'),
|
|
181
|
+
__metadata("design:type", Boolean)
|
|
182
|
+
], TextStyleDropShadowMetadata.prototype, "enabled", void 0);
|
|
183
|
+
class TextStyleMetadata {
|
|
184
|
+
}
|
|
185
|
+
__decorate([
|
|
186
|
+
type('string'),
|
|
187
|
+
__metadata("design:type", String)
|
|
188
|
+
], TextStyleMetadata.prototype, "align", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
type('boolean'),
|
|
191
|
+
__metadata("design:type", Boolean)
|
|
192
|
+
], TextStyleMetadata.prototype, "breakWords", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
Field(() => TextStyleDropShadowMetadata),
|
|
195
|
+
__metadata("design:type", Object)
|
|
196
|
+
], TextStyleMetadata.prototype, "dropShadow", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
type('number'),
|
|
199
|
+
__metadata("design:type", Number)
|
|
200
|
+
], TextStyleMetadata.prototype, "dropShadowAlpha", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
type('number'),
|
|
203
|
+
__metadata("design:type", Number)
|
|
204
|
+
], TextStyleMetadata.prototype, "dropShadowAngle", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
type('number'),
|
|
207
|
+
__metadata("design:type", Number)
|
|
208
|
+
], TextStyleMetadata.prototype, "dropShadowBlur", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
Field({ type: 'color' }),
|
|
211
|
+
__metadata("design:type", Object)
|
|
212
|
+
], TextStyleMetadata.prototype, "dropShadowColor", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
type('number'),
|
|
215
|
+
__metadata("design:type", Number)
|
|
216
|
+
], TextStyleMetadata.prototype, "dropShadowDistance", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
Field({ type: 'color' }),
|
|
219
|
+
__metadata("design:type", Object)
|
|
220
|
+
], TextStyleMetadata.prototype, "fill", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
type('number'),
|
|
223
|
+
__metadata("design:type", Number)
|
|
224
|
+
], TextStyleMetadata.prototype, "fillGradientType", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
type('number'),
|
|
227
|
+
__metadata("design:type", Array)
|
|
228
|
+
], TextStyleMetadata.prototype, "fillGradientStops", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
type('string'),
|
|
231
|
+
__metadata("design:type", Object)
|
|
232
|
+
], TextStyleMetadata.prototype, "fontFamily", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
type('number'),
|
|
235
|
+
__metadata("design:type", Object)
|
|
236
|
+
], TextStyleMetadata.prototype, "fontSize", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
type('string'),
|
|
239
|
+
__metadata("design:type", String)
|
|
240
|
+
], TextStyleMetadata.prototype, "fontStyle", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
type('string'),
|
|
243
|
+
__metadata("design:type", String)
|
|
244
|
+
], TextStyleMetadata.prototype, "fontVariant", void 0);
|
|
245
|
+
__decorate([
|
|
246
|
+
type('string'),
|
|
247
|
+
__metadata("design:type", String)
|
|
248
|
+
], TextStyleMetadata.prototype, "fontWeight", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
type('number'),
|
|
251
|
+
__metadata("design:type", Number)
|
|
252
|
+
], TextStyleMetadata.prototype, "leading", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
type('number'),
|
|
255
|
+
__metadata("design:type", Number)
|
|
256
|
+
], TextStyleMetadata.prototype, "letterSpacing", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
type('number'),
|
|
259
|
+
__metadata("design:type", Number)
|
|
260
|
+
], TextStyleMetadata.prototype, "lineHeight", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
type('string'),
|
|
263
|
+
__metadata("design:type", String)
|
|
264
|
+
], TextStyleMetadata.prototype, "lineJoin", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
type('number'),
|
|
267
|
+
__metadata("design:type", Number)
|
|
268
|
+
], TextStyleMetadata.prototype, "miterLimit", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
type('number'),
|
|
271
|
+
__metadata("design:type", Number)
|
|
272
|
+
], TextStyleMetadata.prototype, "padding", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
Field(() => TextStyleStrokeMetadata),
|
|
275
|
+
__metadata("design:type", Object)
|
|
276
|
+
], TextStyleMetadata.prototype, "stroke", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
type('number'),
|
|
279
|
+
__metadata("design:type", Number)
|
|
280
|
+
], TextStyleMetadata.prototype, "strokeThickness", void 0);
|
|
281
|
+
__decorate([
|
|
282
|
+
type('string'),
|
|
283
|
+
__metadata("design:type", String)
|
|
284
|
+
], TextStyleMetadata.prototype, "textBaseline", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
type('string'),
|
|
287
|
+
__metadata("design:type", String)
|
|
288
|
+
], TextStyleMetadata.prototype, "verticalAlign", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
type('boolean'),
|
|
291
|
+
__metadata("design:type", Boolean)
|
|
292
|
+
], TextStyleMetadata.prototype, "trim", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
type('string'),
|
|
295
|
+
__metadata("design:type", String)
|
|
296
|
+
], TextStyleMetadata.prototype, "whiteSpace", void 0);
|
|
297
|
+
__decorate([
|
|
298
|
+
type('boolean'),
|
|
299
|
+
__metadata("design:type", Boolean)
|
|
300
|
+
], TextStyleMetadata.prototype, "wordWrap", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
type('number'),
|
|
303
|
+
__metadata("design:type", Number)
|
|
304
|
+
], TextStyleMetadata.prototype, "wordWrapWidth", void 0);
|
|
85
305
|
/**
|
|
86
306
|
* 文本组件(基于 PixiJS Text)
|
|
87
307
|
*
|
|
@@ -125,19 +345,17 @@ __decorate([
|
|
|
125
345
|
* ```
|
|
126
346
|
*/
|
|
127
347
|
class Text$2 extends Component {
|
|
128
|
-
constructor() {
|
|
129
|
-
super(
|
|
348
|
+
constructor(params) {
|
|
349
|
+
super(params);
|
|
130
350
|
/** 文本内容 */
|
|
131
351
|
this.text = '';
|
|
132
352
|
/** 文本样式配置 */
|
|
133
|
-
// @decorators.IDEProp 复杂编辑后续添加
|
|
134
353
|
this.style = {};
|
|
354
|
+
this.init(params);
|
|
135
355
|
}
|
|
136
356
|
/**
|
|
137
357
|
* 初始化组件
|
|
138
358
|
* @param obj - 初始化参数
|
|
139
|
-
* @param obj.text - 文本内容
|
|
140
|
-
* @param obj.style - 文本样式
|
|
141
359
|
*/
|
|
142
360
|
init(obj) {
|
|
143
361
|
const style = new TextStyle({
|
|
@@ -160,9 +378,130 @@ class Text$2 extends Component {
|
|
|
160
378
|
/** 组件名称 */
|
|
161
379
|
Text$2.componentName = 'Text';
|
|
162
380
|
__decorate([
|
|
163
|
-
type('string')
|
|
164
|
-
|
|
381
|
+
type('string'),
|
|
382
|
+
__metadata("design:type", String)
|
|
383
|
+
], Text$2.prototype, "text", void 0);
|
|
384
|
+
__decorate([
|
|
385
|
+
Field(() => TextStyleMetadata),
|
|
386
|
+
__metadata("design:type", Object)
|
|
387
|
+
], Text$2.prototype, "style", void 0);
|
|
165
388
|
|
|
389
|
+
class HTMLTextTextureStyleMetadata {
|
|
390
|
+
}
|
|
391
|
+
__decorate([
|
|
392
|
+
type('string'),
|
|
393
|
+
__metadata("design:type", String)
|
|
394
|
+
], HTMLTextTextureStyleMetadata.prototype, "scaleMode", void 0);
|
|
395
|
+
__decorate([
|
|
396
|
+
type('number'),
|
|
397
|
+
__metadata("design:type", Number)
|
|
398
|
+
], HTMLTextTextureStyleMetadata.prototype, "resolution", void 0);
|
|
399
|
+
class HTMLTextStyleMetadata {
|
|
400
|
+
}
|
|
401
|
+
__decorate([
|
|
402
|
+
type('string'),
|
|
403
|
+
__metadata("design:type", Object)
|
|
404
|
+
], HTMLTextStyleMetadata.prototype, "fontFamily", void 0);
|
|
405
|
+
__decorate([
|
|
406
|
+
type('number'),
|
|
407
|
+
__metadata("design:type", Object)
|
|
408
|
+
], HTMLTextStyleMetadata.prototype, "fontSize", void 0);
|
|
409
|
+
__decorate([
|
|
410
|
+
type('string'),
|
|
411
|
+
__metadata("design:type", String)
|
|
412
|
+
], HTMLTextStyleMetadata.prototype, "fontWeight", void 0);
|
|
413
|
+
__decorate([
|
|
414
|
+
type('string'),
|
|
415
|
+
__metadata("design:type", String)
|
|
416
|
+
], HTMLTextStyleMetadata.prototype, "fontStyle", void 0);
|
|
417
|
+
__decorate([
|
|
418
|
+
type('string'),
|
|
419
|
+
__metadata("design:type", String)
|
|
420
|
+
], HTMLTextStyleMetadata.prototype, "fontVariant", void 0);
|
|
421
|
+
__decorate([
|
|
422
|
+
type('string'),
|
|
423
|
+
__metadata("design:type", String)
|
|
424
|
+
], HTMLTextStyleMetadata.prototype, "align", void 0);
|
|
425
|
+
__decorate([
|
|
426
|
+
type('string'),
|
|
427
|
+
__metadata("design:type", String)
|
|
428
|
+
], HTMLTextStyleMetadata.prototype, "textBaseline", void 0);
|
|
429
|
+
__decorate([
|
|
430
|
+
Field({ type: 'color' }),
|
|
431
|
+
__metadata("design:type", Object)
|
|
432
|
+
], HTMLTextStyleMetadata.prototype, "fill", void 0);
|
|
433
|
+
__decorate([
|
|
434
|
+
Field({ type: 'color' }),
|
|
435
|
+
__metadata("design:type", Object)
|
|
436
|
+
], HTMLTextStyleMetadata.prototype, "stroke", void 0);
|
|
437
|
+
__decorate([
|
|
438
|
+
type('number'),
|
|
439
|
+
__metadata("design:type", Number)
|
|
440
|
+
], HTMLTextStyleMetadata.prototype, "strokeThickness", void 0);
|
|
441
|
+
__decorate([
|
|
442
|
+
type('number'),
|
|
443
|
+
__metadata("design:type", Number)
|
|
444
|
+
], HTMLTextStyleMetadata.prototype, "lineHeight", void 0);
|
|
445
|
+
__decorate([
|
|
446
|
+
type('number'),
|
|
447
|
+
__metadata("design:type", Number)
|
|
448
|
+
], HTMLTextStyleMetadata.prototype, "letterSpacing", void 0);
|
|
449
|
+
__decorate([
|
|
450
|
+
type('number'),
|
|
451
|
+
__metadata("design:type", Number)
|
|
452
|
+
], HTMLTextStyleMetadata.prototype, "padding", void 0);
|
|
453
|
+
__decorate([
|
|
454
|
+
type('boolean'),
|
|
455
|
+
__metadata("design:type", Boolean)
|
|
456
|
+
], HTMLTextStyleMetadata.prototype, "wordWrap", void 0);
|
|
457
|
+
__decorate([
|
|
458
|
+
type('number'),
|
|
459
|
+
__metadata("design:type", Number)
|
|
460
|
+
], HTMLTextStyleMetadata.prototype, "wordWrapWidth", void 0);
|
|
461
|
+
__decorate([
|
|
462
|
+
type('boolean'),
|
|
463
|
+
__metadata("design:type", Boolean)
|
|
464
|
+
], HTMLTextStyleMetadata.prototype, "breakWords", void 0);
|
|
465
|
+
__decorate([
|
|
466
|
+
type('string'),
|
|
467
|
+
__metadata("design:type", String)
|
|
468
|
+
], HTMLTextStyleMetadata.prototype, "whiteSpace", void 0);
|
|
469
|
+
__decorate([
|
|
470
|
+
type('boolean'),
|
|
471
|
+
__metadata("design:type", Boolean)
|
|
472
|
+
], HTMLTextStyleMetadata.prototype, "dropShadow", void 0);
|
|
473
|
+
__decorate([
|
|
474
|
+
Field({ type: 'color' }),
|
|
475
|
+
__metadata("design:type", Object)
|
|
476
|
+
], HTMLTextStyleMetadata.prototype, "dropShadowColor", void 0);
|
|
477
|
+
__decorate([
|
|
478
|
+
type('number'),
|
|
479
|
+
__metadata("design:type", Number)
|
|
480
|
+
], HTMLTextStyleMetadata.prototype, "dropShadowAlpha", void 0);
|
|
481
|
+
__decorate([
|
|
482
|
+
type('number'),
|
|
483
|
+
__metadata("design:type", Number)
|
|
484
|
+
], HTMLTextStyleMetadata.prototype, "dropShadowAngle", void 0);
|
|
485
|
+
__decorate([
|
|
486
|
+
type('number'),
|
|
487
|
+
__metadata("design:type", Number)
|
|
488
|
+
], HTMLTextStyleMetadata.prototype, "dropShadowBlur", void 0);
|
|
489
|
+
__decorate([
|
|
490
|
+
type('number'),
|
|
491
|
+
__metadata("design:type", Number)
|
|
492
|
+
], HTMLTextStyleMetadata.prototype, "dropShadowDistance", void 0);
|
|
493
|
+
__decorate([
|
|
494
|
+
type('object'),
|
|
495
|
+
__metadata("design:type", Array)
|
|
496
|
+
], HTMLTextStyleMetadata.prototype, "cssOverrides", void 0);
|
|
497
|
+
__decorate([
|
|
498
|
+
type('object'),
|
|
499
|
+
__metadata("design:type", Object)
|
|
500
|
+
], HTMLTextStyleMetadata.prototype, "tagStyles", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
type('boolean'),
|
|
503
|
+
__metadata("design:type", Boolean)
|
|
504
|
+
], HTMLTextStyleMetadata.prototype, "trim", void 0);
|
|
166
505
|
/**
|
|
167
506
|
* HTML 富文本组件
|
|
168
507
|
*
|
|
@@ -237,9 +576,6 @@ class HTMLText extends Component {
|
|
|
237
576
|
/**
|
|
238
577
|
* 初始化组件
|
|
239
578
|
* @param obj - 初始化参数
|
|
240
|
-
* @param obj.text - 富文本内容
|
|
241
|
-
* @param obj.style - 文本样式
|
|
242
|
-
* @param obj.textureStyle - 纹理配置
|
|
243
579
|
*/
|
|
244
580
|
init(obj) {
|
|
245
581
|
this.style = Object.assign({ fontSize: 24, fill: '#000000', fontFamily: 'Arial' }, obj === null || obj === void 0 ? void 0 : obj.style);
|
|
@@ -252,8 +588,17 @@ class HTMLText extends Component {
|
|
|
252
588
|
/** 组件名称 */
|
|
253
589
|
HTMLText.componentName = 'HTMLText';
|
|
254
590
|
__decorate([
|
|
255
|
-
type('string')
|
|
256
|
-
|
|
591
|
+
type('string'),
|
|
592
|
+
__metadata("design:type", String)
|
|
593
|
+
], HTMLText.prototype, "text", void 0);
|
|
594
|
+
__decorate([
|
|
595
|
+
Field(() => HTMLTextStyleMetadata),
|
|
596
|
+
__metadata("design:type", Object)
|
|
597
|
+
], HTMLText.prototype, "style", void 0);
|
|
598
|
+
__decorate([
|
|
599
|
+
Field(() => HTMLTextTextureStyleMetadata),
|
|
600
|
+
__metadata("design:type", Object)
|
|
601
|
+
], HTMLText.prototype, "textureStyle", void 0);
|
|
257
602
|
|
|
258
603
|
let Text = class Text extends Renderer {
|
|
259
604
|
constructor() {
|
|
@@ -305,7 +650,7 @@ let Text = class Text extends Renderer {
|
|
|
305
650
|
return __awaiter(this, void 0, void 0, function* () {
|
|
306
651
|
const component = changed.component;
|
|
307
652
|
// 创建文本样式副本,先不设置 fontFamily
|
|
308
|
-
const styleWithoutFont =
|
|
653
|
+
const styleWithoutFont = this.processStyle(component.style);
|
|
309
654
|
const fontFamily = styleWithoutFont.fontFamily;
|
|
310
655
|
delete styleWithoutFont.fontFamily;
|
|
311
656
|
const initialText = fontFamily ? '' : component.text;
|
|
@@ -325,7 +670,7 @@ let Text = class Text extends Renderer {
|
|
|
325
670
|
return __awaiter(this, void 0, void 0, function* () {
|
|
326
671
|
const component = changed.component;
|
|
327
672
|
// 创建样式副本,先不设置 fontFamily
|
|
328
|
-
const styleWithoutFont =
|
|
673
|
+
const styleWithoutFont = this.processStyle(component.style);
|
|
329
674
|
const fontFamily = styleWithoutFont.fontFamily;
|
|
330
675
|
delete styleWithoutFont.fontFamily;
|
|
331
676
|
const initialText = fontFamily ? '' : component.text;
|
|
@@ -345,7 +690,7 @@ let Text = class Text extends Renderer {
|
|
|
345
690
|
return __awaiter(this, void 0, void 0, function* () {
|
|
346
691
|
const component = changed.component;
|
|
347
692
|
// 创建样式副本,先不设置 fontFamily
|
|
348
|
-
const styleWithoutFont =
|
|
693
|
+
const styleWithoutFont = this.processStyle(component.style);
|
|
349
694
|
const fontFamily = styleWithoutFont.fontFamily;
|
|
350
695
|
delete styleWithoutFont.fontFamily;
|
|
351
696
|
const initialText = fontFamily ? '' : component.text;
|
|
@@ -402,31 +747,40 @@ let Text = class Text extends Renderer {
|
|
|
402
747
|
};
|
|
403
748
|
delete processed.strokeThickness;
|
|
404
749
|
}
|
|
405
|
-
// dropShadow* -> dropShadow: { color, distance, angle, alpha, blur }
|
|
406
|
-
|
|
407
|
-
|
|
750
|
+
// dropShadow*(v7 平铺 alias) -> dropShadow: { color, distance, angle, alpha, blur }
|
|
751
|
+
// 关键:只有当存在任何 v7 平铺 alias 时才合并;否则保留 v8 嵌套对象(以及
|
|
752
|
+
// dropShadow: true / false 这种纯开关)原样透传。否则上一种情况会用空对象
|
|
753
|
+
// 把 DSL 已经写好的 angle/blur/distance/... 整个覆盖。
|
|
754
|
+
const hasFlatDropShadowAlias = processed.dropShadowColor != null ||
|
|
755
|
+
processed.dropShadowDistance != null ||
|
|
756
|
+
processed.dropShadowAngle != null ||
|
|
757
|
+
processed.dropShadowAlpha != null ||
|
|
758
|
+
processed.dropShadowBlur != null;
|
|
759
|
+
if (processed.dropShadow && hasFlatDropShadowAlias) {
|
|
760
|
+
const base = processed.dropShadow && typeof processed.dropShadow === 'object' && !Array.isArray(processed.dropShadow)
|
|
761
|
+
? Object.assign({}, processed.dropShadow) : {};
|
|
408
762
|
if (processed.dropShadowColor != null) {
|
|
409
|
-
|
|
763
|
+
base.color = processed.dropShadowColor;
|
|
410
764
|
}
|
|
411
765
|
if (processed.dropShadowDistance != null) {
|
|
412
|
-
|
|
766
|
+
base.distance = processed.dropShadowDistance;
|
|
413
767
|
}
|
|
414
768
|
if (processed.dropShadowAngle != null) {
|
|
415
|
-
|
|
769
|
+
base.angle = processed.dropShadowAngle;
|
|
416
770
|
}
|
|
417
771
|
if (processed.dropShadowAlpha != null) {
|
|
418
|
-
|
|
772
|
+
base.alpha = processed.dropShadowAlpha;
|
|
419
773
|
}
|
|
420
774
|
if (processed.dropShadowBlur != null) {
|
|
421
|
-
|
|
775
|
+
base.blur = processed.dropShadowBlur;
|
|
422
776
|
}
|
|
423
|
-
processed.dropShadow =
|
|
424
|
-
delete processed.dropShadowColor;
|
|
425
|
-
delete processed.dropShadowDistance;
|
|
426
|
-
delete processed.dropShadowAngle;
|
|
427
|
-
delete processed.dropShadowAlpha;
|
|
428
|
-
delete processed.dropShadowBlur;
|
|
777
|
+
processed.dropShadow = base;
|
|
429
778
|
}
|
|
779
|
+
delete processed.dropShadowColor;
|
|
780
|
+
delete processed.dropShadowDistance;
|
|
781
|
+
delete processed.dropShadowAngle;
|
|
782
|
+
delete processed.dropShadowAlpha;
|
|
783
|
+
delete processed.dropShadowBlur;
|
|
430
784
|
// fill 数组 -> 取第一个值 (deprecated)
|
|
431
785
|
if (Array.isArray(processed.fill)) {
|
|
432
786
|
processed.fill = processed.fill[0];
|
|
@@ -474,7 +828,7 @@ let Text = class Text extends Renderer {
|
|
|
474
828
|
const newText = new HTMLText$1({
|
|
475
829
|
text: htmlComponent.text,
|
|
476
830
|
style: htmlComponent.style,
|
|
477
|
-
textureStyle: htmlComponent.textureStyle
|
|
831
|
+
textureStyle: htmlComponent.textureStyle,
|
|
478
832
|
});
|
|
479
833
|
container.addChildAt(newText, index);
|
|
480
834
|
this.texts[changed.gameObject.id].text = newText;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-text",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-beta.10",
|
|
4
4
|
"description": "@eva/plugin-renderer-text",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-text.esm.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/inspector-decorator": "^0.0.
|
|
22
|
-
"@eva/plugin-renderer": "2.0.
|
|
23
|
-
"@eva/renderer-adapter": "2.0.
|
|
24
|
-
"@eva/eva.js": "2.0.
|
|
21
|
+
"@eva/inspector-decorator": "^2.0.0-beta.0",
|
|
22
|
+
"@eva/plugin-renderer": "2.1.0-beta.10",
|
|
23
|
+
"@eva/renderer-adapter": "2.1.0-beta.10",
|
|
24
|
+
"@eva/eva.js": "2.1.0-beta.10",
|
|
25
25
|
"pixi.js": "^8.17.0"
|
|
26
26
|
}
|
|
27
27
|
}
|