@vpmedia/phaser 1.95.0 → 1.96.0
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/CHANGELOG.md +29 -0
- package/package.json +9 -9
- package/src/phaser/core/animation.js +61 -56
- package/src/phaser/core/animation_manager.js +55 -55
- package/src/phaser/core/cache.js +154 -154
- package/src/phaser/core/device.js +2 -1
- package/src/phaser/core/device_util.js +27 -27
- package/src/phaser/core/dom.js +43 -43
- package/src/phaser/core/event_manager.js +63 -63
- package/src/phaser/core/factory.js +47 -47
- package/src/phaser/core/frame.js +30 -30
- package/src/phaser/core/frame_data.js +30 -28
- package/src/phaser/core/frame_util.js +8 -8
- package/src/phaser/core/game.js +34 -18
- package/src/phaser/core/loader.js +170 -170
- package/src/phaser/core/loader_parser.js +22 -22
- package/src/phaser/core/raf.js +1 -1
- package/src/phaser/core/scene.js +16 -10
- package/src/phaser/core/scene_manager.js +51 -43
- package/src/phaser/core/signal.js +56 -52
- package/src/phaser/core/sound.js +54 -54
- package/src/phaser/core/sound_manager.js +49 -49
- package/src/phaser/core/stage.js +16 -16
- package/src/phaser/core/time.js +30 -30
- package/src/phaser/core/timer.js +64 -64
- package/src/phaser/core/timer_event.js +9 -9
- package/src/phaser/core/tween.js +90 -90
- package/src/phaser/core/tween_data.js +30 -30
- package/src/phaser/core/tween_manager.js +29 -24
- package/src/phaser/core/world.js +4 -3
- package/src/phaser/display/bitmap_text.js +61 -54
- package/src/phaser/display/button.js +48 -47
- package/src/phaser/display/canvas/buffer.js +8 -8
- package/src/phaser/display/canvas/graphics.js +8 -8
- package/src/phaser/display/canvas/masker.js +5 -5
- package/src/phaser/display/canvas/pool.js +18 -18
- package/src/phaser/display/canvas/renderer.js +16 -16
- package/src/phaser/display/canvas/tinter.js +22 -22
- package/src/phaser/display/canvas/util.js +42 -42
- package/src/phaser/display/display_object.js +119 -108
- package/src/phaser/display/graphics.js +112 -112
- package/src/phaser/display/graphics_data.js +10 -10
- package/src/phaser/display/graphics_data_util.js +3 -3
- package/src/phaser/display/group.js +50 -50
- package/src/phaser/display/image.js +54 -50
- package/src/phaser/display/sprite_batch.js +2 -2
- package/src/phaser/display/sprite_util.js +19 -19
- package/src/phaser/display/text.js +212 -187
- package/src/phaser/display/webgl/abstract_filter.js +4 -4
- package/src/phaser/display/webgl/base_texture.js +9 -9
- package/src/phaser/display/webgl/blend_manager.js +7 -7
- package/src/phaser/display/webgl/earcut.js +95 -95
- package/src/phaser/display/webgl/earcut_node.js +4 -4
- package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
- package/src/phaser/display/webgl/filter_manager.js +9 -9
- package/src/phaser/display/webgl/filter_texture.js +10 -10
- package/src/phaser/display/webgl/graphics.js +37 -37
- package/src/phaser/display/webgl/graphics_data.js +4 -4
- package/src/phaser/display/webgl/mask_manager.js +6 -6
- package/src/phaser/display/webgl/render_texture.js +16 -16
- package/src/phaser/display/webgl/renderer.js +20 -20
- package/src/phaser/display/webgl/shader/complex.js +4 -4
- package/src/phaser/display/webgl/shader/fast.js +4 -4
- package/src/phaser/display/webgl/shader/normal.js +8 -8
- package/src/phaser/display/webgl/shader/primitive.js +4 -4
- package/src/phaser/display/webgl/shader/strip.js +4 -4
- package/src/phaser/display/webgl/shader_manager.js +9 -9
- package/src/phaser/display/webgl/sprite_batch.js +18 -18
- package/src/phaser/display/webgl/stencil_manager.js +16 -16
- package/src/phaser/display/webgl/texture.js +13 -13
- package/src/phaser/display/webgl/texture_util.js +8 -8
- package/src/phaser/display/webgl/util.js +25 -25
- package/src/phaser/geom/circle.js +69 -69
- package/src/phaser/geom/ellipse.js +28 -28
- package/src/phaser/geom/line.js +93 -93
- package/src/phaser/geom/matrix.js +54 -54
- package/src/phaser/geom/point.js +96 -96
- package/src/phaser/geom/polygon.js +22 -22
- package/src/phaser/geom/rectangle.js +132 -132
- package/src/phaser/geom/rounded_rectangle.js +12 -12
- package/src/phaser/geom/util/circle.js +33 -33
- package/src/phaser/geom/util/ellipse.js +5 -5
- package/src/phaser/geom/util/line.js +26 -26
- package/src/phaser/geom/util/matrix.js +8 -8
- package/src/phaser/geom/util/point.js +97 -97
- package/src/phaser/geom/util/polygon.js +4 -4
- package/src/phaser/geom/util/rectangle.js +74 -74
- package/src/phaser/geom/util/rounded_rectangle.js +4 -4
- package/src/phaser/util/math.js +81 -81
- package/types/phaser/core/animation.d.ts +61 -56
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +55 -55
- package/types/phaser/core/cache.d.ts +154 -154
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +43 -43
- package/types/phaser/core/event_manager.d.ts +63 -63
- package/types/phaser/core/factory.d.ts +47 -47
- package/types/phaser/core/frame.d.ts +30 -30
- package/types/phaser/core/frame_data.d.ts +28 -27
- package/types/phaser/core/frame_data.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +52 -19
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +170 -170
- package/types/phaser/core/loader_parser.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +1 -1
- package/types/phaser/core/scene.d.ts +15 -9
- package/types/phaser/core/scene.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +51 -43
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal.d.ts +54 -51
- package/types/phaser/core/signal.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +54 -54
- package/types/phaser/core/sound_manager.d.ts +49 -49
- package/types/phaser/core/stage.d.ts +10 -10
- package/types/phaser/core/time.d.ts +30 -30
- package/types/phaser/core/timer.d.ts +64 -64
- package/types/phaser/core/timer_event.d.ts +9 -9
- package/types/phaser/core/tween.d.ts +90 -90
- package/types/phaser/core/tween_data.d.ts +30 -30
- package/types/phaser/core/tween_manager.d.ts +29 -24
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/core/world.d.ts +4 -3
- package/types/phaser/core/world.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +59 -52
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +47 -46
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +8 -8
- package/types/phaser/display/canvas/renderer.d.ts +16 -16
- package/types/phaser/display/display_object.d.ts +119 -108
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +101 -101
- package/types/phaser/display/graphics_data.d.ts +10 -10
- package/types/phaser/display/group.d.ts +47 -47
- package/types/phaser/display/image.d.ts +42 -40
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +207 -184
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
- package/types/phaser/display/webgl/base_texture.d.ts +9 -9
- package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
- package/types/phaser/display/webgl/earcut.d.ts +95 -95
- package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
- package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
- package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
- package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
- package/types/phaser/display/webgl/render_texture.d.ts +16 -16
- package/types/phaser/display/webgl/renderer.d.ts +20 -20
- package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
- package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
- package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
- package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
- package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
- package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
- package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
- package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
- package/types/phaser/display/webgl/texture.d.ts +12 -12
- package/types/phaser/geom/circle.d.ts +69 -69
- package/types/phaser/geom/ellipse.d.ts +28 -28
- package/types/phaser/geom/line.d.ts +93 -93
- package/types/phaser/geom/matrix.d.ts +54 -54
- package/types/phaser/geom/point.d.ts +96 -96
- package/types/phaser/geom/polygon.d.ts +22 -22
- package/types/phaser/geom/rectangle.d.ts +132 -132
- package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
- package/pnpm-workspace.yaml +0 -4
|
@@ -9,12 +9,12 @@ import { textureFromCanvas } from './webgl/texture_util.js';
|
|
|
9
9
|
|
|
10
10
|
export class Text extends Image {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {import('../core/game.js').Game} game -
|
|
14
|
-
* @param {number} x -
|
|
15
|
-
* @param {number} y -
|
|
16
|
-
* @param {string} text -
|
|
17
|
-
* @param {object} style -
|
|
12
|
+
* Creates a new Text object.
|
|
13
|
+
* @param {import('../core/game.js').Game} game - The game instance this text belongs to.
|
|
14
|
+
* @param {number} x - The x position of the text.
|
|
15
|
+
* @param {number} y - The y position of the text.
|
|
16
|
+
* @param {string} text - The text content to display.
|
|
17
|
+
* @param {object} style - The style settings for the text.
|
|
18
18
|
*/
|
|
19
19
|
constructor(game, x, y, text = '', style = {}) {
|
|
20
20
|
super(game, x, y, null);
|
|
@@ -55,7 +55,7 @@ export class Text extends Image {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Destroys this text object and cleans up resources.
|
|
59
59
|
*/
|
|
60
60
|
destroy() {
|
|
61
61
|
this.texture.destroy(true);
|
|
@@ -75,14 +75,14 @@ export class Text extends Image {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
79
|
-
* @param {number} x -
|
|
80
|
-
* @param {number} y -
|
|
81
|
-
* @param {string} color -
|
|
82
|
-
* @param {number} blur -
|
|
83
|
-
* @param {boolean} shadowStroke -
|
|
84
|
-
* @param {boolean} shadowFill -
|
|
85
|
-
* @returns {Text}
|
|
78
|
+
* Sets the drop shadow properties for this text.
|
|
79
|
+
* @param {number} x - The horizontal offset of the shadow.
|
|
80
|
+
* @param {number} y - The vertical offset of the shadow.
|
|
81
|
+
* @param {string} color - The color of the shadow.
|
|
82
|
+
* @param {number} blur - The blur radius of the shadow.
|
|
83
|
+
* @param {boolean} shadowStroke - Whether to apply the shadow to the stroke.
|
|
84
|
+
* @param {boolean} shadowFill - Whether to apply the shadow to the fill.
|
|
85
|
+
* @returns {Text} This Text object for chaining.
|
|
86
86
|
*/
|
|
87
87
|
setShadow(x = 0, y = 0, color = 'rgba(0, 0, 0, 1)', blur = 0, shadowStroke = true, shadowFill = true) {
|
|
88
88
|
this.style.shadowOffsetX = x;
|
|
@@ -96,10 +96,10 @@ export class Text extends Image {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
100
|
-
* @param {object} style -
|
|
101
|
-
* @param {boolean} update -
|
|
102
|
-
* @returns {Text}
|
|
99
|
+
* Sets the style properties for this text.
|
|
100
|
+
* @param {object} style - The style settings to apply.
|
|
101
|
+
* @param {boolean} update - Whether to update the text immediately.
|
|
102
|
+
* @returns {Text} This Text object for chaining.
|
|
103
103
|
*/
|
|
104
104
|
setStyle(style = null, update = false) {
|
|
105
105
|
style = JSON.parse(JSON.stringify(style)) || {};
|
|
@@ -146,7 +146,7 @@ export class Text extends Image {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
149
|
+
* Updates the text content and renders it to the canvas.
|
|
150
150
|
*/
|
|
151
151
|
updateText() {
|
|
152
152
|
this.texture.baseTexture.resolution = this._res;
|
|
@@ -309,11 +309,11 @@ export class Text extends Image {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
/**
|
|
312
|
-
*
|
|
313
|
-
* @param {string} line -
|
|
314
|
-
* @param {number} x -
|
|
315
|
-
* @param {number} y -
|
|
316
|
-
* @param {boolean} fill -
|
|
312
|
+
* Renders a tabbed line of text to the canvas.
|
|
313
|
+
* @param {string} line - The line of text to render.
|
|
314
|
+
* @param {number} x - The x position to start rendering from.
|
|
315
|
+
* @param {number} y - The y position to start rendering from.
|
|
316
|
+
* @param {boolean} fill - True to fill the text, false to stroke it.
|
|
317
317
|
*/
|
|
318
318
|
renderTabLine(line, x, y, fill) {
|
|
319
319
|
const text = line.split(/(?:\t)/);
|
|
@@ -348,8 +348,8 @@ export class Text extends Image {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
/**
|
|
351
|
-
*
|
|
352
|
-
* @param {string} state -
|
|
351
|
+
* Updates the shadow properties for this text.
|
|
352
|
+
* @param {string} state - The shadow state to update ('stroke' or 'fill').
|
|
353
353
|
*/
|
|
354
354
|
updateShadow(state) {
|
|
355
355
|
if (state) {
|
|
@@ -366,9 +366,9 @@ export class Text extends Image {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/**
|
|
369
|
-
*
|
|
370
|
-
* @param {string} line -
|
|
371
|
-
* @returns {number}
|
|
369
|
+
* Measures the width of a line of text.
|
|
370
|
+
* @param {string} line - The line of text to measure.
|
|
371
|
+
* @returns {number} The width of the line in pixels.
|
|
372
372
|
*/
|
|
373
373
|
measureLine(line) {
|
|
374
374
|
let lineLength = 0;
|
|
@@ -403,10 +403,10 @@ export class Text extends Image {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
/**
|
|
406
|
-
*
|
|
407
|
-
* @param {string} line -
|
|
408
|
-
* @param {number} x -
|
|
409
|
-
* @param {number} y -
|
|
406
|
+
* Updates a line of text to the canvas.
|
|
407
|
+
* @param {string} line - The line of text to update.
|
|
408
|
+
* @param {number} x - The x position to start updating from.
|
|
409
|
+
* @param {number} y - The y position to start updating from.
|
|
410
410
|
*/
|
|
411
411
|
updateLine(line, x, y) {
|
|
412
412
|
for (let i = 0; i < line.length; i += 1) {
|
|
@@ -441,8 +441,8 @@ export class Text extends Image {
|
|
|
441
441
|
}
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
|
-
*
|
|
445
|
-
* @returns {Text}
|
|
444
|
+
* Clears all color values from this text object.
|
|
445
|
+
* @returns {Text} This Text object for chaining.
|
|
446
446
|
*/
|
|
447
447
|
clearColors() {
|
|
448
448
|
this.colors = [];
|
|
@@ -452,8 +452,8 @@ export class Text extends Image {
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
/**
|
|
455
|
-
*
|
|
456
|
-
* @returns {Text}
|
|
455
|
+
* Clears all font style values from this text object.
|
|
456
|
+
* @returns {Text} This Text object for chaining.
|
|
457
457
|
*/
|
|
458
458
|
clearFontValues() {
|
|
459
459
|
this.fontStyles = [];
|
|
@@ -463,10 +463,10 @@ export class Text extends Image {
|
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
/**
|
|
466
|
-
*
|
|
467
|
-
* @param {string} color -
|
|
468
|
-
* @param {number} position -
|
|
469
|
-
* @returns {Text}
|
|
466
|
+
* Adds a color to this text object at the specified position.
|
|
467
|
+
* @param {string} color - The color to apply.
|
|
468
|
+
* @param {number} position - The character position to apply the color at.
|
|
469
|
+
* @returns {Text} This Text object for chaining.
|
|
470
470
|
*/
|
|
471
471
|
addColor(color, position) {
|
|
472
472
|
this.colors[position] = color;
|
|
@@ -475,10 +475,10 @@ export class Text extends Image {
|
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
/**
|
|
478
|
-
*
|
|
479
|
-
* @param {number} color -
|
|
480
|
-
* @param {number} position -
|
|
481
|
-
* @returns {Text}
|
|
478
|
+
* Adds a stroke color to this text object at the specified position.
|
|
479
|
+
* @param {number} color - The stroke color to apply.
|
|
480
|
+
* @param {number} position - The character position to apply the stroke color at.
|
|
481
|
+
* @returns {Text} This Text object for chaining.
|
|
482
482
|
*/
|
|
483
483
|
addStrokeColor(color, position) {
|
|
484
484
|
this.strokeColors[position] = color;
|
|
@@ -487,10 +487,10 @@ export class Text extends Image {
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
/**
|
|
490
|
-
*
|
|
491
|
-
* @param {object} style -
|
|
492
|
-
* @param {number} position -
|
|
493
|
-
* @returns {Text}
|
|
490
|
+
* Adds a font style to this text object at the specified position.
|
|
491
|
+
* @param {object} style - The font style to apply.
|
|
492
|
+
* @param {number} position - The character position to apply the font style at.
|
|
493
|
+
* @returns {Text} This Text object for chaining.
|
|
494
494
|
*/
|
|
495
495
|
addFontStyle(style, position) {
|
|
496
496
|
this.fontStyles[position] = style;
|
|
@@ -499,10 +499,10 @@ export class Text extends Image {
|
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
/**
|
|
502
|
-
*
|
|
503
|
-
* @param {number} weight -
|
|
504
|
-
* @param {number} position -
|
|
505
|
-
* @returns {Text}
|
|
502
|
+
* Adds a font weight to this text object at the specified position.
|
|
503
|
+
* @param {number} weight - The font weight to apply.
|
|
504
|
+
* @param {number} position - The character position to apply the font weight at.
|
|
505
|
+
* @returns {Text} This Text object for chaining.
|
|
506
506
|
*/
|
|
507
507
|
addFontWeight(weight, position) {
|
|
508
508
|
this.fontWeights[position] = weight;
|
|
@@ -511,9 +511,9 @@ export class Text extends Image {
|
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
/**
|
|
514
|
-
*
|
|
515
|
-
* @param {string} text -
|
|
516
|
-
* @returns {string[]}
|
|
514
|
+
* Precalculates word wrap for the given text.
|
|
515
|
+
* @param {string} text - The text to precalculate word wrap for.
|
|
516
|
+
* @returns {string[]} The wrapped lines of text.
|
|
517
517
|
*/
|
|
518
518
|
precalculateWordWrap(text) {
|
|
519
519
|
this.texture.baseTexture.resolution = this._res;
|
|
@@ -523,9 +523,9 @@ export class Text extends Image {
|
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
/**
|
|
526
|
-
*
|
|
527
|
-
* @param {string} text -
|
|
528
|
-
* @returns {string}
|
|
526
|
+
* Runs word wrap on the given text.
|
|
527
|
+
* @param {string} text - The text to run word wrap on.
|
|
528
|
+
* @returns {string} The wrapped text.
|
|
529
529
|
*/
|
|
530
530
|
runWordWrap(text) {
|
|
531
531
|
if (this.useAdvancedWrap) {
|
|
@@ -535,10 +535,10 @@ export class Text extends Image {
|
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
/**
|
|
538
|
-
*
|
|
539
|
-
* @param {string} text -
|
|
540
|
-
* @returns {string}
|
|
541
|
-
* @throws {Error}
|
|
538
|
+
* Runs advanced word wrap on the given text.
|
|
539
|
+
* @param {string} text - The text to run advanced word wrap on.
|
|
540
|
+
* @returns {string} The wrapped text.
|
|
541
|
+
* @throws {Error} If the wordWrapWidth setting is less than a single character.
|
|
542
542
|
*/
|
|
543
543
|
advancedWordWrap(text) {
|
|
544
544
|
const context = this.context;
|
|
@@ -618,9 +618,9 @@ export class Text extends Image {
|
|
|
618
618
|
}
|
|
619
619
|
|
|
620
620
|
/**
|
|
621
|
-
*
|
|
622
|
-
* @param {string} text -
|
|
623
|
-
* @returns {string}
|
|
621
|
+
* Runs basic word wrap on the given text.
|
|
622
|
+
* @param {string} text - The text to run basic word wrap on.
|
|
623
|
+
* @returns {string} The wrapped text.
|
|
624
624
|
*/
|
|
625
625
|
basicWordWrap(text) {
|
|
626
626
|
let result = '';
|
|
@@ -651,8 +651,8 @@ export class Text extends Image {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
/**
|
|
654
|
-
*
|
|
655
|
-
* @param {object} components -
|
|
654
|
+
* Updates the font properties based on the given components.
|
|
655
|
+
* @param {object} components - The font components to update from.
|
|
656
656
|
*/
|
|
657
657
|
updateFont(components) {
|
|
658
658
|
const font = this.componentsToFont(components);
|
|
@@ -666,9 +666,9 @@ export class Text extends Image {
|
|
|
666
666
|
}
|
|
667
667
|
|
|
668
668
|
/**
|
|
669
|
-
*
|
|
670
|
-
* @param {string} font -
|
|
671
|
-
* @returns {{ font: string, fontStyle?: string, fontVariant?: string, fontWeight?: string, fontSize?: string, fontFamily?: string }}
|
|
669
|
+
* Converts a font string to components.
|
|
670
|
+
* @param {string} font - The font string to convert.
|
|
671
|
+
* @returns {{ font: string, fontStyle?: string, fontVariant?: string, fontWeight?: string, fontSize?: string, fontFamily?: string }} The font components.
|
|
672
672
|
*/
|
|
673
673
|
fontToComponents(font) {
|
|
674
674
|
// The format is specified in http://www.w3.org/TR/CSS2/fonts.html#font-shorthand:
|
|
@@ -702,9 +702,9 @@ export class Text extends Image {
|
|
|
702
702
|
}
|
|
703
703
|
|
|
704
704
|
/**
|
|
705
|
-
*
|
|
706
|
-
* @param {object} components -
|
|
707
|
-
* @returns {string}
|
|
705
|
+
* Converts font components to a font string.
|
|
706
|
+
* @param {object} components - The font components to convert.
|
|
707
|
+
* @returns {string} The font string.
|
|
708
708
|
*/
|
|
709
709
|
componentsToFont(components) {
|
|
710
710
|
const parts = [];
|
|
@@ -737,10 +737,10 @@ export class Text extends Image {
|
|
|
737
737
|
}
|
|
738
738
|
|
|
739
739
|
/**
|
|
740
|
-
*
|
|
741
|
-
* @param {string} text -
|
|
742
|
-
* @param {boolean} immediate -
|
|
743
|
-
* @returns {Text}
|
|
740
|
+
* Sets the text content of this object.
|
|
741
|
+
* @param {string} text - The new text to set.
|
|
742
|
+
* @param {boolean} immediate - If true, updates the text immediately.
|
|
743
|
+
* @returns {Text} This Text object for chaining.
|
|
744
744
|
*/
|
|
745
745
|
setText(text, immediate = false) {
|
|
746
746
|
this.text = text.toString() || '';
|
|
@@ -753,9 +753,9 @@ export class Text extends Image {
|
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
/**
|
|
756
|
-
*
|
|
757
|
-
* @param {string[]|string[][]} list -
|
|
758
|
-
* @returns {Text}
|
|
756
|
+
* Parses a list of text into this object.
|
|
757
|
+
* @param {string[]|string[][]} list - The list of text to parse.
|
|
758
|
+
* @returns {Text} This Text object for chaining.
|
|
759
759
|
*/
|
|
760
760
|
parseList(list) {
|
|
761
761
|
if (!Array.isArray(list)) {
|
|
@@ -781,12 +781,12 @@ export class Text extends Image {
|
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
/**
|
|
784
|
-
*
|
|
785
|
-
* @param {number} x -
|
|
786
|
-
* @param {number} y -
|
|
787
|
-
* @param {number} width -
|
|
788
|
-
* @param {number} height -
|
|
789
|
-
* @returns {Text}
|
|
784
|
+
* Sets the text bounds for this object.
|
|
785
|
+
* @param {number} x - The x position of the bounds.
|
|
786
|
+
* @param {number} y - The y position of the bounds.
|
|
787
|
+
* @param {number} width - The width of the bounds.
|
|
788
|
+
* @param {number} height - The height of the bounds.
|
|
789
|
+
* @returns {Text} This Text object for chaining.
|
|
790
790
|
*/
|
|
791
791
|
setTextBounds(x, y, width, height) {
|
|
792
792
|
if (x === undefined) {
|
|
@@ -806,7 +806,7 @@ export class Text extends Image {
|
|
|
806
806
|
}
|
|
807
807
|
|
|
808
808
|
/**
|
|
809
|
-
*
|
|
809
|
+
* Updates the texture of this object.
|
|
810
810
|
*/
|
|
811
811
|
updateTexture() {
|
|
812
812
|
const base = this.texture.baseTexture;
|
|
@@ -848,8 +848,8 @@ export class Text extends Image {
|
|
|
848
848
|
}
|
|
849
849
|
|
|
850
850
|
/**
|
|
851
|
-
*
|
|
852
|
-
* @param {object} renderSession -
|
|
851
|
+
* Renders this text object using WebGL.
|
|
852
|
+
* @param {object} renderSession - The render session to use.
|
|
853
853
|
*/
|
|
854
854
|
renderWebGL(renderSession) {
|
|
855
855
|
if (this.dirty) {
|
|
@@ -860,8 +860,8 @@ export class Text extends Image {
|
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
/**
|
|
863
|
-
*
|
|
864
|
-
* @param {object} renderSession -
|
|
863
|
+
* Renders this text object using Canvas.
|
|
864
|
+
* @param {object} renderSession - The render session to use.
|
|
865
865
|
*/
|
|
866
866
|
renderCanvas(renderSession) {
|
|
867
867
|
if (this.dirty) {
|
|
@@ -872,8 +872,8 @@ export class Text extends Image {
|
|
|
872
872
|
}
|
|
873
873
|
|
|
874
874
|
/**
|
|
875
|
-
*
|
|
876
|
-
* @returns {{[key: string]: {ascent: number, descent: number, fontSize: number}}}
|
|
875
|
+
* Gets the font properties cache object.
|
|
876
|
+
* @returns {{[key: string]: {ascent: number, descent: number, fontSize: number}}} The font properties cache.
|
|
877
877
|
*/
|
|
878
878
|
getFontPropertiesCache() {
|
|
879
879
|
if (!window.PhaserRegistry.fontPropertiesCache) {
|
|
@@ -883,8 +883,8 @@ export class Text extends Image {
|
|
|
883
883
|
}
|
|
884
884
|
|
|
885
885
|
/**
|
|
886
|
-
*
|
|
887
|
-
* @returns {HTMLCanvasElement}
|
|
886
|
+
* Gets the font properties canvas element.
|
|
887
|
+
* @returns {HTMLCanvasElement} The font properties canvas element.
|
|
888
888
|
*/
|
|
889
889
|
getFontPropertiesCanvas() {
|
|
890
890
|
if (!window.PhaserRegistry.fontPropertiesCanvas) {
|
|
@@ -894,8 +894,8 @@ export class Text extends Image {
|
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
/**
|
|
897
|
-
*
|
|
898
|
-
* @returns {CanvasRenderingContext2D}
|
|
897
|
+
* Gets the font properties canvas context.
|
|
898
|
+
* @returns {CanvasRenderingContext2D} The font properties canvas context.
|
|
899
899
|
*/
|
|
900
900
|
getFontPropertiesContext() {
|
|
901
901
|
if (!window.PhaserRegistry.fontPropertiesContext) {
|
|
@@ -907,9 +907,9 @@ export class Text extends Image {
|
|
|
907
907
|
}
|
|
908
908
|
|
|
909
909
|
/**
|
|
910
|
-
*
|
|
911
|
-
* @param {string} font -
|
|
912
|
-
* @returns {object}
|
|
910
|
+
* Determines the font properties for a given font.
|
|
911
|
+
* @param {string} font - The font to determine properties for.
|
|
912
|
+
* @returns {object} The font properties.
|
|
913
913
|
*/
|
|
914
914
|
determineFontProperties(font) {
|
|
915
915
|
const fontPropertiesCache = this.getFontPropertiesCache();
|
|
@@ -932,9 +932,9 @@ export class Text extends Image {
|
|
|
932
932
|
}
|
|
933
933
|
|
|
934
934
|
/**
|
|
935
|
-
*
|
|
936
|
-
* @param {string} fontStyle -
|
|
937
|
-
* @returns {{ascent: number, descent: number, fontSize: number}}
|
|
935
|
+
* Determines font properties using a fallback method.
|
|
936
|
+
* @param {string} fontStyle - The font style to determine properties for.
|
|
937
|
+
* @returns {{ascent: number, descent: number, fontSize: number}} The font properties.
|
|
938
938
|
*/
|
|
939
939
|
determineFontPropertiesFallback(fontStyle) {
|
|
940
940
|
const fontPropertiesCache = this.getFontPropertiesCache();
|
|
@@ -1013,9 +1013,9 @@ export class Text extends Image {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
1015
|
/**
|
|
1016
|
-
*
|
|
1017
|
-
* @param {import('../geom/matrix.js').Matrix} matrix -
|
|
1018
|
-
* @returns {Rectangle}
|
|
1016
|
+
* Gets the bounds of this text object.
|
|
1017
|
+
* @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
|
|
1018
|
+
* @returns {Rectangle} The bounds of this text object.
|
|
1019
1019
|
*/
|
|
1020
1020
|
getBounds(matrix = null) {
|
|
1021
1021
|
if (this.dirty) {
|
|
@@ -1026,16 +1026,16 @@ export class Text extends Image {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
1028
|
/**
|
|
1029
|
-
*
|
|
1030
|
-
* @returns {string}
|
|
1029
|
+
* Gets the text content of this object.
|
|
1030
|
+
* @returns {string} The current text content.
|
|
1031
1031
|
*/
|
|
1032
1032
|
get text() {
|
|
1033
1033
|
return this._text;
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
1036
1036
|
/**
|
|
1037
|
-
*
|
|
1038
|
-
* @param {string | number | boolean | Date} value -
|
|
1037
|
+
* Sets the text content of this object.
|
|
1038
|
+
* @param {string | number | boolean | Date} value - The new text content to set.
|
|
1039
1039
|
*/
|
|
1040
1040
|
set text(value) {
|
|
1041
1041
|
if (value !== this._text) {
|
|
@@ -1048,15 +1048,16 @@ export class Text extends Image {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
1050
1050
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
* @returns {string}
|
|
1051
|
+
* Gets the CSS font string for this object.
|
|
1052
|
+
* @returns {string} The CSS font string.
|
|
1053
1053
|
*/
|
|
1054
1054
|
get cssFont() {
|
|
1055
1055
|
return this.componentsToFont(this._fontComponents);
|
|
1056
1056
|
}
|
|
1057
1057
|
|
|
1058
1058
|
/**
|
|
1059
|
-
*
|
|
1059
|
+
* Sets the CSS font string for this object.
|
|
1060
|
+
* @param {string} value - The new CSS font string to set.
|
|
1060
1061
|
*/
|
|
1061
1062
|
set cssFont(value) {
|
|
1062
1063
|
this._fontComponents = this.fontToComponents(value || 'bold 20pt Arial');
|
|
@@ -1064,15 +1065,16 @@ export class Text extends Image {
|
|
|
1064
1065
|
}
|
|
1065
1066
|
|
|
1066
1067
|
/**
|
|
1067
|
-
*
|
|
1068
|
-
* @returns {number}
|
|
1068
|
+
* Gets the font family of this object.
|
|
1069
|
+
* @returns {number} The font family.
|
|
1069
1070
|
*/
|
|
1070
1071
|
get font() {
|
|
1071
1072
|
return this._fontComponents.fontFamily;
|
|
1072
1073
|
}
|
|
1073
1074
|
|
|
1074
1075
|
/**
|
|
1075
|
-
*
|
|
1076
|
+
* Sets the font family of this object.
|
|
1077
|
+
* @param {string} value - The new font family to set.
|
|
1076
1078
|
*/
|
|
1077
1079
|
set font(value) {
|
|
1078
1080
|
let mutatedValue = value || 'Arial';
|
|
@@ -1087,8 +1089,8 @@ export class Text extends Image {
|
|
|
1087
1089
|
}
|
|
1088
1090
|
|
|
1089
1091
|
/**
|
|
1090
|
-
*
|
|
1091
|
-
* @returns {number}
|
|
1092
|
+
* Gets the font size of this object.
|
|
1093
|
+
* @returns {number} The font size.
|
|
1092
1094
|
*/
|
|
1093
1095
|
get fontSize() {
|
|
1094
1096
|
const size = this._fontComponents.fontSize;
|
|
@@ -1099,7 +1101,8 @@ export class Text extends Image {
|
|
|
1099
1101
|
}
|
|
1100
1102
|
|
|
1101
1103
|
/**
|
|
1102
|
-
*
|
|
1104
|
+
* Sets the font size of this object.
|
|
1105
|
+
* @param {number} value - The new font size to set.
|
|
1103
1106
|
*/
|
|
1104
1107
|
set fontSize(value) {
|
|
1105
1108
|
let mutatedValue = value || '0';
|
|
@@ -1111,15 +1114,16 @@ export class Text extends Image {
|
|
|
1111
1114
|
}
|
|
1112
1115
|
|
|
1113
1116
|
/**
|
|
1114
|
-
*
|
|
1115
|
-
* @returns {string}
|
|
1117
|
+
* Gets the font weight of this object.
|
|
1118
|
+
* @returns {string} The font weight.
|
|
1116
1119
|
*/
|
|
1117
1120
|
get fontWeight() {
|
|
1118
1121
|
return this._fontComponents.fontWeight || 'normal';
|
|
1119
1122
|
}
|
|
1120
1123
|
|
|
1121
1124
|
/**
|
|
1122
|
-
*
|
|
1125
|
+
* Sets the font weight of this object.
|
|
1126
|
+
* @param {string} value - The new font weight to set.
|
|
1123
1127
|
*/
|
|
1124
1128
|
set fontWeight(value) {
|
|
1125
1129
|
this._fontComponents.fontWeight = value || 'normal';
|
|
@@ -1127,15 +1131,16 @@ export class Text extends Image {
|
|
|
1127
1131
|
}
|
|
1128
1132
|
|
|
1129
1133
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
* @returns {string}
|
|
1134
|
+
* Gets the font style of this object.
|
|
1135
|
+
* @returns {string} The font style.
|
|
1132
1136
|
*/
|
|
1133
1137
|
get fontStyle() {
|
|
1134
1138
|
return this._fontComponents.fontStyle || 'normal';
|
|
1135
1139
|
}
|
|
1136
1140
|
|
|
1137
1141
|
/**
|
|
1138
|
-
*
|
|
1142
|
+
* Sets the font style of this object.
|
|
1143
|
+
* @param {string} value - The new font style to set.
|
|
1139
1144
|
*/
|
|
1140
1145
|
set fontStyle(value) {
|
|
1141
1146
|
this._fontComponents.fontStyle = value || 'normal';
|
|
@@ -1143,15 +1148,16 @@ export class Text extends Image {
|
|
|
1143
1148
|
}
|
|
1144
1149
|
|
|
1145
1150
|
/**
|
|
1146
|
-
*
|
|
1147
|
-
* @returns {string}
|
|
1151
|
+
* Gets the font variant of this object.
|
|
1152
|
+
* @returns {string} The font variant.
|
|
1148
1153
|
*/
|
|
1149
1154
|
get fontVariant() {
|
|
1150
1155
|
return this._fontComponents.fontVariant || 'normal';
|
|
1151
1156
|
}
|
|
1152
1157
|
|
|
1153
1158
|
/**
|
|
1154
|
-
*
|
|
1159
|
+
* Sets the font variant of this object.
|
|
1160
|
+
* @param {string} value - The new font variant to set.
|
|
1155
1161
|
*/
|
|
1156
1162
|
set fontVariant(value) {
|
|
1157
1163
|
this._fontComponents.fontVariant = value || 'normal';
|
|
@@ -1159,15 +1165,16 @@ export class Text extends Image {
|
|
|
1159
1165
|
}
|
|
1160
1166
|
|
|
1161
1167
|
/**
|
|
1162
|
-
*
|
|
1163
|
-
* @returns {number}
|
|
1168
|
+
* Gets the fill color of this object.
|
|
1169
|
+
* @returns {number} The fill color.
|
|
1164
1170
|
*/
|
|
1165
1171
|
get fill() {
|
|
1166
1172
|
return this.style.fill;
|
|
1167
1173
|
}
|
|
1168
1174
|
|
|
1169
1175
|
/**
|
|
1170
|
-
*
|
|
1176
|
+
* Sets the fill color of this object.
|
|
1177
|
+
* @param {string} value - The new fill color to set.
|
|
1171
1178
|
*/
|
|
1172
1179
|
set fill(value) {
|
|
1173
1180
|
if (value !== this.style.fill) {
|
|
@@ -1177,15 +1184,16 @@ export class Text extends Image {
|
|
|
1177
1184
|
}
|
|
1178
1185
|
|
|
1179
1186
|
/**
|
|
1180
|
-
*
|
|
1181
|
-
* @returns {string}
|
|
1187
|
+
* Gets the alignment of this object.
|
|
1188
|
+
* @returns {string} The text alignment.
|
|
1182
1189
|
*/
|
|
1183
1190
|
get align() {
|
|
1184
1191
|
return this.style.align;
|
|
1185
1192
|
}
|
|
1186
1193
|
|
|
1187
1194
|
/**
|
|
1188
|
-
*
|
|
1195
|
+
* Sets the alignment of this object.
|
|
1196
|
+
* @param {string} value - The new text alignment to set.
|
|
1189
1197
|
*/
|
|
1190
1198
|
set align(value) {
|
|
1191
1199
|
if (value !== this.style.align) {
|
|
@@ -1195,15 +1203,16 @@ export class Text extends Image {
|
|
|
1195
1203
|
}
|
|
1196
1204
|
|
|
1197
1205
|
/**
|
|
1198
|
-
*
|
|
1199
|
-
* @returns {number}
|
|
1206
|
+
* Gets the resolution of this object.
|
|
1207
|
+
* @returns {number} The resolution.
|
|
1200
1208
|
*/
|
|
1201
1209
|
get resolution() {
|
|
1202
1210
|
return this._res;
|
|
1203
1211
|
}
|
|
1204
1212
|
|
|
1205
1213
|
/**
|
|
1206
|
-
*
|
|
1214
|
+
* Sets the resolution of this object.
|
|
1215
|
+
* @param {number} value - The new resolution to set.
|
|
1207
1216
|
*/
|
|
1208
1217
|
set resolution(value) {
|
|
1209
1218
|
if (value !== this._res) {
|
|
@@ -1213,15 +1222,16 @@ export class Text extends Image {
|
|
|
1213
1222
|
}
|
|
1214
1223
|
|
|
1215
1224
|
/**
|
|
1216
|
-
*
|
|
1217
|
-
* @returns {number}
|
|
1225
|
+
* Gets the tabs setting of this object.
|
|
1226
|
+
* @returns {number} The tabs setting.
|
|
1218
1227
|
*/
|
|
1219
1228
|
get tabs() {
|
|
1220
1229
|
return this.style.tabs;
|
|
1221
1230
|
}
|
|
1222
1231
|
|
|
1223
1232
|
/**
|
|
1224
|
-
*
|
|
1233
|
+
* Sets the tabs setting of this object.
|
|
1234
|
+
* @param {number} value - The new tabs setting to set.
|
|
1225
1235
|
*/
|
|
1226
1236
|
set tabs(value) {
|
|
1227
1237
|
if (value !== this.style.tabs) {
|
|
@@ -1231,15 +1241,16 @@ export class Text extends Image {
|
|
|
1231
1241
|
}
|
|
1232
1242
|
|
|
1233
1243
|
/**
|
|
1234
|
-
*
|
|
1235
|
-
* @returns {number}
|
|
1244
|
+
* Gets the horizontal bounds alignment of this object.
|
|
1245
|
+
* @returns {number} The horizontal bounds alignment.
|
|
1236
1246
|
*/
|
|
1237
1247
|
get boundsAlignH() {
|
|
1238
1248
|
return this.style.boundsAlignH;
|
|
1239
1249
|
}
|
|
1240
1250
|
|
|
1241
1251
|
/**
|
|
1242
|
-
*
|
|
1252
|
+
* Sets the horizontal bounds alignment of this object.
|
|
1253
|
+
* @param {number} value - The new horizontal bounds alignment to set.
|
|
1243
1254
|
*/
|
|
1244
1255
|
set boundsAlignH(value) {
|
|
1245
1256
|
if (value !== this.style.boundsAlignH) {
|
|
@@ -1249,15 +1260,16 @@ export class Text extends Image {
|
|
|
1249
1260
|
}
|
|
1250
1261
|
|
|
1251
1262
|
/**
|
|
1252
|
-
*
|
|
1253
|
-
* @returns {number}
|
|
1263
|
+
* Gets the vertical bounds alignment of this object.
|
|
1264
|
+
* @returns {number} The vertical bounds alignment.
|
|
1254
1265
|
*/
|
|
1255
1266
|
get boundsAlignV() {
|
|
1256
1267
|
return this.style.boundsAlignV;
|
|
1257
1268
|
}
|
|
1258
1269
|
|
|
1259
1270
|
/**
|
|
1260
|
-
*
|
|
1271
|
+
* Sets the vertical bounds alignment of this object.
|
|
1272
|
+
* @param {number} value - The new vertical bounds alignment to set.
|
|
1261
1273
|
*/
|
|
1262
1274
|
set boundsAlignV(value) {
|
|
1263
1275
|
if (value !== this.style.boundsAlignV) {
|
|
@@ -1267,15 +1279,16 @@ export class Text extends Image {
|
|
|
1267
1279
|
}
|
|
1268
1280
|
|
|
1269
1281
|
/**
|
|
1270
|
-
*
|
|
1271
|
-
* @returns {number}
|
|
1282
|
+
* Gets the stroke color of this object.
|
|
1283
|
+
* @returns {number} The stroke color.
|
|
1272
1284
|
*/
|
|
1273
1285
|
get stroke() {
|
|
1274
1286
|
return this.style.stroke;
|
|
1275
1287
|
}
|
|
1276
1288
|
|
|
1277
1289
|
/**
|
|
1278
|
-
*
|
|
1290
|
+
* Sets the stroke color of this object.
|
|
1291
|
+
* @param {string} value - The new stroke color to set.
|
|
1279
1292
|
*/
|
|
1280
1293
|
set stroke(value) {
|
|
1281
1294
|
if (value !== this.style.stroke) {
|
|
@@ -1285,15 +1298,16 @@ export class Text extends Image {
|
|
|
1285
1298
|
}
|
|
1286
1299
|
|
|
1287
1300
|
/**
|
|
1288
|
-
*
|
|
1289
|
-
* @returns {number}
|
|
1301
|
+
* Gets the stroke thickness of this object.
|
|
1302
|
+
* @returns {number} The stroke thickness.
|
|
1290
1303
|
*/
|
|
1291
1304
|
get strokeThickness() {
|
|
1292
1305
|
return this.style.strokeThickness;
|
|
1293
1306
|
}
|
|
1294
1307
|
|
|
1295
1308
|
/**
|
|
1296
|
-
*
|
|
1309
|
+
* Sets the stroke thickness of this object.
|
|
1310
|
+
* @param {number} value - The new stroke thickness to set.
|
|
1297
1311
|
*/
|
|
1298
1312
|
set strokeThickness(value) {
|
|
1299
1313
|
if (value !== this.style.strokeThickness) {
|
|
@@ -1303,15 +1317,16 @@ export class Text extends Image {
|
|
|
1303
1317
|
}
|
|
1304
1318
|
|
|
1305
1319
|
/**
|
|
1306
|
-
*
|
|
1307
|
-
* @returns {number}
|
|
1320
|
+
* Gets the word wrap setting of this object.
|
|
1321
|
+
* @returns {number} The word wrap setting.
|
|
1308
1322
|
*/
|
|
1309
1323
|
get wordWrap() {
|
|
1310
1324
|
return this.style.wordWrap;
|
|
1311
1325
|
}
|
|
1312
1326
|
|
|
1313
1327
|
/**
|
|
1314
|
-
*
|
|
1328
|
+
* Sets the word wrap setting of this object.
|
|
1329
|
+
* @param {boolean} value - The new word wrap setting to set.
|
|
1315
1330
|
*/
|
|
1316
1331
|
set wordWrap(value) {
|
|
1317
1332
|
if (value !== this.style.wordWrap) {
|
|
@@ -1321,15 +1336,16 @@ export class Text extends Image {
|
|
|
1321
1336
|
}
|
|
1322
1337
|
|
|
1323
1338
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
* @returns {number}
|
|
1339
|
+
* Gets the word wrap width of this object.
|
|
1340
|
+
* @returns {number} The word wrap width.
|
|
1326
1341
|
*/
|
|
1327
1342
|
get wordWrapWidth() {
|
|
1328
1343
|
return this.style.wordWrapWidth;
|
|
1329
1344
|
}
|
|
1330
1345
|
|
|
1331
1346
|
/**
|
|
1332
|
-
*
|
|
1347
|
+
* Sets the word wrap width of this object.
|
|
1348
|
+
* @param {number} value - The new word wrap width to set.
|
|
1333
1349
|
*/
|
|
1334
1350
|
set wordWrapWidth(value) {
|
|
1335
1351
|
if (value !== this.style.wordWrapWidth) {
|
|
@@ -1339,15 +1355,16 @@ export class Text extends Image {
|
|
|
1339
1355
|
}
|
|
1340
1356
|
|
|
1341
1357
|
/**
|
|
1342
|
-
*
|
|
1343
|
-
* @returns {number}
|
|
1358
|
+
* Gets the line spacing of this object.
|
|
1359
|
+
* @returns {number} The line spacing.
|
|
1344
1360
|
*/
|
|
1345
1361
|
get lineSpacing() {
|
|
1346
1362
|
return this._lineSpacing;
|
|
1347
1363
|
}
|
|
1348
1364
|
|
|
1349
1365
|
/**
|
|
1350
|
-
*
|
|
1366
|
+
* Sets the line spacing of this object.
|
|
1367
|
+
* @param {number} value - The new line spacing to set.
|
|
1351
1368
|
*/
|
|
1352
1369
|
set lineSpacing(value) {
|
|
1353
1370
|
if (value !== this._lineSpacing) {
|
|
@@ -1360,15 +1377,16 @@ export class Text extends Image {
|
|
|
1360
1377
|
}
|
|
1361
1378
|
|
|
1362
1379
|
/**
|
|
1363
|
-
*
|
|
1364
|
-
* @returns {number}
|
|
1380
|
+
* Gets the shadow offset X of this object.
|
|
1381
|
+
* @returns {number} The shadow offset X.
|
|
1365
1382
|
*/
|
|
1366
1383
|
get shadowOffsetX() {
|
|
1367
1384
|
return this.style.shadowOffsetX;
|
|
1368
1385
|
}
|
|
1369
1386
|
|
|
1370
1387
|
/**
|
|
1371
|
-
*
|
|
1388
|
+
* Sets the shadow offset X of this object.
|
|
1389
|
+
* @param {number} value - The new shadow offset X to set.
|
|
1372
1390
|
*/
|
|
1373
1391
|
set shadowOffsetX(value) {
|
|
1374
1392
|
if (value !== this.style.shadowOffsetX) {
|
|
@@ -1378,15 +1396,16 @@ export class Text extends Image {
|
|
|
1378
1396
|
}
|
|
1379
1397
|
|
|
1380
1398
|
/**
|
|
1381
|
-
*
|
|
1382
|
-
* @returns {number}
|
|
1399
|
+
* Gets the shadow offset Y of this object.
|
|
1400
|
+
* @returns {number} The shadow offset Y.
|
|
1383
1401
|
*/
|
|
1384
1402
|
get shadowOffsetY() {
|
|
1385
1403
|
return this.style.shadowOffsetY;
|
|
1386
1404
|
}
|
|
1387
1405
|
|
|
1388
1406
|
/**
|
|
1389
|
-
*
|
|
1407
|
+
* Sets the shadow offset Y of this object.
|
|
1408
|
+
* @param {number} value - The new shadow offset Y to set.
|
|
1390
1409
|
*/
|
|
1391
1410
|
set shadowOffsetY(value) {
|
|
1392
1411
|
if (value !== this.style.shadowOffsetY) {
|
|
@@ -1396,15 +1415,16 @@ export class Text extends Image {
|
|
|
1396
1415
|
}
|
|
1397
1416
|
|
|
1398
1417
|
/**
|
|
1399
|
-
*
|
|
1400
|
-
* @returns {number}
|
|
1418
|
+
* Gets the shadow color of this object.
|
|
1419
|
+
* @returns {number} The shadow color.
|
|
1401
1420
|
*/
|
|
1402
1421
|
get shadowColor() {
|
|
1403
1422
|
return this.style.shadowColor;
|
|
1404
1423
|
}
|
|
1405
1424
|
|
|
1406
1425
|
/**
|
|
1407
|
-
*
|
|
1426
|
+
* Sets the shadow color of this object.
|
|
1427
|
+
* @param {string} value - The new shadow color to set.
|
|
1408
1428
|
*/
|
|
1409
1429
|
set shadowColor(value) {
|
|
1410
1430
|
if (value !== this.style.shadowColor) {
|
|
@@ -1414,15 +1434,16 @@ export class Text extends Image {
|
|
|
1414
1434
|
}
|
|
1415
1435
|
|
|
1416
1436
|
/**
|
|
1417
|
-
*
|
|
1418
|
-
* @returns {number}
|
|
1437
|
+
* Gets the shadow blur of this object.
|
|
1438
|
+
* @returns {number} The shadow blur.
|
|
1419
1439
|
*/
|
|
1420
1440
|
get shadowBlur() {
|
|
1421
1441
|
return this.style.shadowBlur;
|
|
1422
1442
|
}
|
|
1423
1443
|
|
|
1424
1444
|
/**
|
|
1425
|
-
*
|
|
1445
|
+
* Sets the shadow blur of this object.
|
|
1446
|
+
* @param {number} value - The new shadow blur to set.
|
|
1426
1447
|
*/
|
|
1427
1448
|
set shadowBlur(value) {
|
|
1428
1449
|
if (value !== this.style.shadowBlur) {
|
|
@@ -1432,15 +1453,16 @@ export class Text extends Image {
|
|
|
1432
1453
|
}
|
|
1433
1454
|
|
|
1434
1455
|
/**
|
|
1435
|
-
*
|
|
1436
|
-
* @returns {number}
|
|
1456
|
+
* Gets the shadow stroke setting of this object.
|
|
1457
|
+
* @returns {number} The shadow stroke setting.
|
|
1437
1458
|
*/
|
|
1438
1459
|
get shadowStroke() {
|
|
1439
1460
|
return this.style.shadowStroke;
|
|
1440
1461
|
}
|
|
1441
1462
|
|
|
1442
1463
|
/**
|
|
1443
|
-
*
|
|
1464
|
+
* Sets the shadow stroke setting of this object.
|
|
1465
|
+
* @param {boolean} value - The new shadow stroke setting to set.
|
|
1444
1466
|
*/
|
|
1445
1467
|
set shadowStroke(value) {
|
|
1446
1468
|
if (value !== this.style.shadowStroke) {
|
|
@@ -1450,15 +1472,16 @@ export class Text extends Image {
|
|
|
1450
1472
|
}
|
|
1451
1473
|
|
|
1452
1474
|
/**
|
|
1453
|
-
*
|
|
1454
|
-
* @returns {number}
|
|
1475
|
+
* Gets the shadow fill setting of this object.
|
|
1476
|
+
* @returns {number} The shadow fill setting.
|
|
1455
1477
|
*/
|
|
1456
1478
|
get shadowFill() {
|
|
1457
1479
|
return this.style.shadowFill;
|
|
1458
1480
|
}
|
|
1459
1481
|
|
|
1460
1482
|
/**
|
|
1461
|
-
*
|
|
1483
|
+
* Sets the shadow fill setting of this object.
|
|
1484
|
+
* @param {boolean} value - The new shadow fill setting to set.
|
|
1462
1485
|
*/
|
|
1463
1486
|
set shadowFill(value) {
|
|
1464
1487
|
if (value !== this.style.shadowFill) {
|
|
@@ -1468,8 +1491,8 @@ export class Text extends Image {
|
|
|
1468
1491
|
}
|
|
1469
1492
|
|
|
1470
1493
|
/**
|
|
1471
|
-
*
|
|
1472
|
-
* @returns {number}
|
|
1494
|
+
* Gets the width of this object.
|
|
1495
|
+
* @returns {number} The width in pixels.
|
|
1473
1496
|
*/
|
|
1474
1497
|
get width() {
|
|
1475
1498
|
if (this.dirty) {
|
|
@@ -1480,7 +1503,8 @@ export class Text extends Image {
|
|
|
1480
1503
|
}
|
|
1481
1504
|
|
|
1482
1505
|
/**
|
|
1483
|
-
*
|
|
1506
|
+
* Sets the width of this object.
|
|
1507
|
+
* @param {number} value - The new width to set in pixels.
|
|
1484
1508
|
*/
|
|
1485
1509
|
set width(value) {
|
|
1486
1510
|
this.scale.x = value / this.texture.frame.width;
|
|
@@ -1488,8 +1512,8 @@ export class Text extends Image {
|
|
|
1488
1512
|
}
|
|
1489
1513
|
|
|
1490
1514
|
/**
|
|
1491
|
-
*
|
|
1492
|
-
* @returns {number}
|
|
1515
|
+
* Gets the height of this object.
|
|
1516
|
+
* @returns {number} The height in pixels.
|
|
1493
1517
|
*/
|
|
1494
1518
|
get height() {
|
|
1495
1519
|
if (this.dirty) {
|
|
@@ -1500,7 +1524,8 @@ export class Text extends Image {
|
|
|
1500
1524
|
}
|
|
1501
1525
|
|
|
1502
1526
|
/**
|
|
1503
|
-
*
|
|
1527
|
+
* Sets the height of this object.
|
|
1528
|
+
* @param {number} value - The new height to set in pixels.
|
|
1504
1529
|
*/
|
|
1505
1530
|
set height(value) {
|
|
1506
1531
|
this.scale.y = value / this.texture.frame.height;
|