@vpmedia/phaser 1.104.0 → 1.105.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/dist/index.js +151 -574
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +35 -57
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +11 -10
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +2 -2
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts +3 -3
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +60 -60
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts +10 -10
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +6 -5
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/event_manager.d.ts +49 -174
- package/dist/phaser/core/event_manager.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +7 -7
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/frame.d.ts +27 -48
- package/dist/phaser/core/frame.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts +11 -60
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/frame_util.d.ts +4 -14
- package/dist/phaser/core/frame_util.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts +49 -58
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +15 -13
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +23 -20
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +26 -1
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +2 -2
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +9 -9
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +2 -1
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +28 -28
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +4 -4
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts +2 -2
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts +22 -17
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +1 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts +10 -9
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +9 -8
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +2 -2
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +56 -101
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +11 -9
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts +4 -4
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts +3 -3
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts +5 -5
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +10 -10
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/timer_event.d.ts +11 -21
- package/dist/phaser/core/timer_event.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +37 -59
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +6 -5
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_easing.d.ts +31 -31
- package/dist/phaser/core/tween_easing.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +4 -4
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts +1 -1
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +22 -20
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +23 -35
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts +2 -2
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts +3 -3
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts +2 -2
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts +5 -5
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -3
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +9 -9
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +45 -42
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +24 -16
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts +24 -37
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +34 -49
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts +1 -1
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +5 -5
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +86 -66
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts +2 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts +2 -2
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts +3 -2
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +10 -10
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +2 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts +3 -2
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +11 -10
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts +2 -1
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +8 -6
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +1 -0
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +4 -2
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +3 -2
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts +5 -4
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +15 -2
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts +6 -6
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +11 -10
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts +6 -5
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +14 -14
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts +13 -12
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts +19 -19
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts +6 -6
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts +20 -20
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts +9 -7
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts +5 -3
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +2 -1
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts +19 -19
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/polygon.d.ts +2 -1
- package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +17 -15
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts +51 -142
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/animation.ts +38 -61
- package/src/phaser/core/animation_manager.ts +21 -21
- package/src/phaser/core/animation_parser.ts +11 -3
- package/src/phaser/core/array_set.ts +8 -8
- package/src/phaser/core/cache.ts +75 -68
- package/src/phaser/core/device.ts +23 -24
- package/src/phaser/core/device_util.ts +10 -10
- package/src/phaser/core/dom.ts +5 -5
- package/src/phaser/core/event_manager.ts +52 -193
- package/src/phaser/core/factory.ts +25 -18
- package/src/phaser/core/frame.ts +37 -51
- package/src/phaser/core/frame_data.ts +29 -76
- package/src/phaser/core/frame_util.ts +3 -16
- package/src/phaser/core/game.ts +36 -63
- package/src/phaser/core/input.ts +68 -68
- package/src/phaser/core/input_handler.ts +81 -86
- package/src/phaser/core/input_mouse.ts +42 -36
- package/src/phaser/core/input_mspointer.ts +24 -25
- package/src/phaser/core/input_pointer.ts +55 -56
- package/src/phaser/core/input_touch.ts +26 -26
- package/src/phaser/core/loader.ts +97 -70
- package/src/phaser/core/loader_parser.ts +6 -7
- package/src/phaser/core/raf.ts +2 -2
- package/src/phaser/core/scale_manager.ts +85 -82
- package/src/phaser/core/scene.ts +3 -4
- package/src/phaser/core/scene_manager.ts +26 -26
- package/src/phaser/core/signal.ts +10 -10
- package/src/phaser/core/signal_binding.ts +2 -2
- package/src/phaser/core/sound.ts +65 -112
- package/src/phaser/core/sound_manager.ts +31 -30
- package/src/phaser/core/sound_sprite.ts +10 -11
- package/src/phaser/core/stage.ts +8 -8
- package/src/phaser/core/time.ts +33 -34
- package/src/phaser/core/timer.ts +40 -34
- package/src/phaser/core/timer_event.ts +23 -23
- package/src/phaser/core/tween.ts +42 -68
- package/src/phaser/core/tween_data.ts +31 -31
- package/src/phaser/core/tween_easing.ts +31 -31
- package/src/phaser/core/tween_manager.ts +10 -11
- package/src/phaser/core/world.ts +1 -2
- package/src/phaser/display/bitmap_text.ts +41 -31
- package/src/phaser/display/button.ts +24 -51
- package/src/phaser/display/canvas/buffer.ts +6 -7
- package/src/phaser/display/canvas/graphics.ts +3 -4
- package/src/phaser/display/canvas/masker.ts +2 -3
- package/src/phaser/display/canvas/pool.ts +3 -4
- package/src/phaser/display/canvas/renderer.ts +19 -20
- package/src/phaser/display/canvas/tinter.ts +4 -5
- package/src/phaser/display/canvas/util.ts +9 -9
- package/src/phaser/display/display_object.ts +49 -50
- package/src/phaser/display/graphics.ts +56 -43
- package/src/phaser/display/graphics_data.ts +11 -12
- package/src/phaser/display/graphics_data_util.ts +1 -2
- package/src/phaser/display/group.ts +32 -42
- package/src/phaser/display/image.ts +32 -52
- package/src/phaser/display/sprite_batch.ts +1 -2
- package/src/phaser/display/sprite_util.ts +5 -6
- package/src/phaser/display/text.ts +82 -56
- package/src/phaser/display/webgl/abstract_filter.ts +8 -8
- package/src/phaser/display/webgl/base_texture.ts +14 -15
- package/src/phaser/display/webgl/blend_manager.ts +5 -5
- package/src/phaser/display/webgl/earcut.ts +27 -27
- package/src/phaser/display/webgl/earcut_node.ts +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -19
- package/src/phaser/display/webgl/filter_manager.ts +5 -5
- package/src/phaser/display/webgl/filter_texture.ts +7 -7
- package/src/phaser/display/webgl/graphics.ts +10 -11
- package/src/phaser/display/webgl/graphics_data.ts +11 -11
- package/src/phaser/display/webgl/mask_manager.ts +2 -3
- package/src/phaser/display/webgl/render_texture.ts +12 -12
- package/src/phaser/display/webgl/renderer.ts +24 -24
- package/src/phaser/display/webgl/shader/complex.ts +7 -7
- package/src/phaser/display/webgl/shader/fast.ts +8 -8
- package/src/phaser/display/webgl/shader/normal.ts +12 -12
- package/src/phaser/display/webgl/shader/primitive.ts +7 -7
- package/src/phaser/display/webgl/shader/strip.ts +7 -7
- package/src/phaser/display/webgl/shader_manager.ts +13 -13
- package/src/phaser/display/webgl/sprite_batch.ts +20 -20
- package/src/phaser/display/webgl/stencil_manager.ts +8 -8
- package/src/phaser/display/webgl/texture.ts +35 -24
- package/src/phaser/display/webgl/texture_util.ts +2 -3
- package/src/phaser/display/webgl/util.ts +6 -6
- package/src/phaser/geom/circle.ts +10 -10
- package/src/phaser/geom/ellipse.ts +6 -6
- package/src/phaser/geom/line.ts +14 -14
- package/src/phaser/geom/matrix.ts +12 -12
- package/src/phaser/geom/point.ts +19 -19
- package/src/phaser/geom/polygon.ts +5 -5
- package/src/phaser/geom/rectangle.ts +21 -21
- package/src/phaser/geom/rounded_rectangle.ts +2 -2
- package/src/phaser/geom/util/circle.ts +7 -7
- package/src/phaser/geom/util/ellipse.ts +1 -1
- package/src/phaser/geom/util/line.ts +5 -5
- package/src/phaser/geom/util/matrix.ts +1 -1
- package/src/phaser/geom/util/point.ts +20 -20
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +15 -15
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
- package/src/phaser/util/math.ts +65 -151
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { TEXT } from '../core/const.js';
|
|
3
2
|
import { Point } from '../geom/point.js';
|
|
4
3
|
import { Rectangle } from '../geom/rectangle.js';
|
|
@@ -9,6 +8,26 @@ import { getBounds, renderCanvas, renderWebGL } from './sprite_util.js';
|
|
|
9
8
|
import { textureFromCanvas } from './webgl/texture_util.js';
|
|
10
9
|
|
|
11
10
|
export class Text extends Image {
|
|
11
|
+
declare type: any;
|
|
12
|
+
canvas!: any;
|
|
13
|
+
context!: any;
|
|
14
|
+
padding!: any;
|
|
15
|
+
textBounds!: any;
|
|
16
|
+
style!: any;
|
|
17
|
+
colors!: any;
|
|
18
|
+
strokeColors!: any;
|
|
19
|
+
fontStyles!: any;
|
|
20
|
+
fontWeights!: any;
|
|
21
|
+
autoRound!: any;
|
|
22
|
+
useAdvancedWrap!: any;
|
|
23
|
+
_res!: any;
|
|
24
|
+
_text!: any;
|
|
25
|
+
_fontComponents!: any;
|
|
26
|
+
_lineSpacing!: any;
|
|
27
|
+
_charCount!: any;
|
|
28
|
+
declare _width: any;
|
|
29
|
+
declare _height: any;
|
|
30
|
+
dirty!: any;
|
|
12
31
|
/**
|
|
13
32
|
* Creates a new Text object.
|
|
14
33
|
* @param {import('../core/game.js').Game} game - The game instance this text belongs to.
|
|
@@ -17,7 +36,7 @@ export class Text extends Image {
|
|
|
17
36
|
* @param {string} text - The text content to display.
|
|
18
37
|
* @param {object} style - The style settings for the text.
|
|
19
38
|
*/
|
|
20
|
-
constructor(game, x, y, text = '', style = {}) {
|
|
39
|
+
constructor(game: import('../core/game.js').Game, x: number, y: number, text: string = '', style: any = {}) {
|
|
21
40
|
super(game, x, y, null);
|
|
22
41
|
this.game = game;
|
|
23
42
|
/** @type {number} */
|
|
@@ -85,7 +104,14 @@ export class Text extends Image {
|
|
|
85
104
|
* @param {boolean} shadowFill - Whether to apply the shadow to the fill.
|
|
86
105
|
* @returns {Text} This Text object for chaining.
|
|
87
106
|
*/
|
|
88
|
-
setShadow(
|
|
107
|
+
setShadow(
|
|
108
|
+
x: number = 0,
|
|
109
|
+
y: number = 0,
|
|
110
|
+
color: string = 'rgba(0, 0, 0, 1)',
|
|
111
|
+
blur: number = 0,
|
|
112
|
+
shadowStroke: boolean = true,
|
|
113
|
+
shadowFill: boolean = true
|
|
114
|
+
) {
|
|
89
115
|
this.style.shadowOffsetX = x;
|
|
90
116
|
this.style.shadowOffsetY = y;
|
|
91
117
|
this.style.shadowColor = color;
|
|
@@ -102,7 +128,7 @@ export class Text extends Image {
|
|
|
102
128
|
* @param {boolean} update - Whether to update the text immediately.
|
|
103
129
|
* @returns {Text} This Text object for chaining.
|
|
104
130
|
*/
|
|
105
|
-
setStyle(style = null, update = false) {
|
|
131
|
+
setStyle(style: any = null, update: boolean = false) {
|
|
106
132
|
style = JSON.parse(JSON.stringify(style)) || {};
|
|
107
133
|
style.font = style.font || 'bold 20pt Arial';
|
|
108
134
|
style.backgroundColor = style.backgroundColor || null;
|
|
@@ -152,7 +178,7 @@ export class Text extends Image {
|
|
|
152
178
|
updateText() {
|
|
153
179
|
this.texture.baseTexture.resolution = this._res;
|
|
154
180
|
this.context.font = this.style.font;
|
|
155
|
-
let outputText = this.text;
|
|
181
|
+
let outputText: any = this.text;
|
|
156
182
|
if (this.style.wordWrap) {
|
|
157
183
|
outputText = this.runWordWrap(this.text);
|
|
158
184
|
}
|
|
@@ -316,7 +342,7 @@ export class Text extends Image {
|
|
|
316
342
|
* @param {number} y - The y position to start rendering from.
|
|
317
343
|
* @param {boolean} fill - True to fill the text, false to stroke it.
|
|
318
344
|
*/
|
|
319
|
-
renderTabLine(line, x, y, fill) {
|
|
345
|
+
renderTabLine(line: string, x: number, y: number, fill: boolean) {
|
|
320
346
|
const text = line.split(/(?:\t)/);
|
|
321
347
|
const tabs = this.style.tabs;
|
|
322
348
|
let snap = 0;
|
|
@@ -352,7 +378,7 @@ export class Text extends Image {
|
|
|
352
378
|
* Updates the shadow properties for this text.
|
|
353
379
|
* @param {string} state - The shadow state to update ('stroke' or 'fill').
|
|
354
380
|
*/
|
|
355
|
-
updateShadow(state) {
|
|
381
|
+
updateShadow(state: string) {
|
|
356
382
|
if (state) {
|
|
357
383
|
this.context.shadowOffsetX = this.style.shadowOffsetX;
|
|
358
384
|
this.context.shadowOffsetY = this.style.shadowOffsetY;
|
|
@@ -371,7 +397,7 @@ export class Text extends Image {
|
|
|
371
397
|
* @param {string} line - The line of text to measure.
|
|
372
398
|
* @returns {number} The width of the line in pixels.
|
|
373
399
|
*/
|
|
374
|
-
measureLine(line) {
|
|
400
|
+
measureLine(line: string) {
|
|
375
401
|
let lineLength = 0;
|
|
376
402
|
for (let i = 0; i < line.length; i += 1) {
|
|
377
403
|
const letter = line[i];
|
|
@@ -409,7 +435,7 @@ export class Text extends Image {
|
|
|
409
435
|
* @param {number} x - The x position to start updating from.
|
|
410
436
|
* @param {number} y - The y position to start updating from.
|
|
411
437
|
*/
|
|
412
|
-
updateLine(line, x, y) {
|
|
438
|
+
updateLine(line: string, x: number, y: number) {
|
|
413
439
|
for (let i = 0; i < line.length; i += 1) {
|
|
414
440
|
const letter = line[i];
|
|
415
441
|
if (this.fontWeights.length > 0 || this.fontStyles.length > 0) {
|
|
@@ -469,7 +495,7 @@ export class Text extends Image {
|
|
|
469
495
|
* @param {number} position - The character position to apply the color at.
|
|
470
496
|
* @returns {Text} This Text object for chaining.
|
|
471
497
|
*/
|
|
472
|
-
addColor(color, position) {
|
|
498
|
+
addColor(color: string, position: number) {
|
|
473
499
|
this.colors[position] = color;
|
|
474
500
|
this.dirty = true;
|
|
475
501
|
return this;
|
|
@@ -481,7 +507,7 @@ export class Text extends Image {
|
|
|
481
507
|
* @param {number} position - The character position to apply the stroke color at.
|
|
482
508
|
* @returns {Text} This Text object for chaining.
|
|
483
509
|
*/
|
|
484
|
-
addStrokeColor(color, position) {
|
|
510
|
+
addStrokeColor(color: number, position: number) {
|
|
485
511
|
this.strokeColors[position] = color;
|
|
486
512
|
this.dirty = true;
|
|
487
513
|
return this;
|
|
@@ -493,7 +519,7 @@ export class Text extends Image {
|
|
|
493
519
|
* @param {number} position - The character position to apply the font style at.
|
|
494
520
|
* @returns {Text} This Text object for chaining.
|
|
495
521
|
*/
|
|
496
|
-
addFontStyle(style, position) {
|
|
522
|
+
addFontStyle(style: any, position: number) {
|
|
497
523
|
this.fontStyles[position] = style;
|
|
498
524
|
this.dirty = true;
|
|
499
525
|
return this;
|
|
@@ -505,7 +531,7 @@ export class Text extends Image {
|
|
|
505
531
|
* @param {number} position - The character position to apply the font weight at.
|
|
506
532
|
* @returns {Text} This Text object for chaining.
|
|
507
533
|
*/
|
|
508
|
-
addFontWeight(weight, position) {
|
|
534
|
+
addFontWeight(weight: number, position: number) {
|
|
509
535
|
this.fontWeights[position] = weight;
|
|
510
536
|
this.dirty = true;
|
|
511
537
|
return this;
|
|
@@ -516,7 +542,7 @@ export class Text extends Image {
|
|
|
516
542
|
* @param {string} text - The text to precalculate word wrap for.
|
|
517
543
|
* @returns {string[]} The wrapped lines of text.
|
|
518
544
|
*/
|
|
519
|
-
precalculateWordWrap(text) {
|
|
545
|
+
precalculateWordWrap(text: string) {
|
|
520
546
|
this.texture.baseTexture.resolution = this._res;
|
|
521
547
|
this.context.font = this.style.font;
|
|
522
548
|
const wrappedLines = this.runWordWrap(text);
|
|
@@ -528,7 +554,7 @@ export class Text extends Image {
|
|
|
528
554
|
* @param {string} text - The text to run word wrap on.
|
|
529
555
|
* @returns {string} The wrapped text.
|
|
530
556
|
*/
|
|
531
|
-
runWordWrap(text) {
|
|
557
|
+
runWordWrap(text: any) {
|
|
532
558
|
if (this.useAdvancedWrap) {
|
|
533
559
|
return this.advancedWordWrap(text);
|
|
534
560
|
}
|
|
@@ -541,7 +567,7 @@ export class Text extends Image {
|
|
|
541
567
|
* @returns {string} The wrapped text.
|
|
542
568
|
* @throws {Error} If the wordWrapWidth setting is less than a single character.
|
|
543
569
|
*/
|
|
544
|
-
advancedWordWrap(text) {
|
|
570
|
+
advancedWordWrap(text: string) {
|
|
545
571
|
const context = this.context;
|
|
546
572
|
const wordWrapWidth = this.style.wordWrapWidth;
|
|
547
573
|
let output = '';
|
|
@@ -623,7 +649,7 @@ export class Text extends Image {
|
|
|
623
649
|
* @param {string} text - The text to run basic word wrap on.
|
|
624
650
|
* @returns {string} The wrapped text.
|
|
625
651
|
*/
|
|
626
|
-
basicWordWrap(text) {
|
|
652
|
+
basicWordWrap(text: string) {
|
|
627
653
|
let result = '';
|
|
628
654
|
const lines = text.split('\n');
|
|
629
655
|
for (let i = 0; i < lines.length; i += 1) {
|
|
@@ -655,7 +681,7 @@ export class Text extends Image {
|
|
|
655
681
|
* Updates the font properties based on the given components.
|
|
656
682
|
* @param {object} components - The font components to update from.
|
|
657
683
|
*/
|
|
658
|
-
updateFont(components) {
|
|
684
|
+
updateFont(components: any) {
|
|
659
685
|
const font = this.componentsToFont(components);
|
|
660
686
|
if (this.style.font !== font) {
|
|
661
687
|
this.style.font = font;
|
|
@@ -671,7 +697,7 @@ export class Text extends Image {
|
|
|
671
697
|
* @param {string} font - The font string to convert.
|
|
672
698
|
* @returns {{ font: string, fontStyle?: string, fontVariant?: string, fontWeight?: string, fontSize?: string, fontFamily?: string }} The font components.
|
|
673
699
|
*/
|
|
674
|
-
fontToComponents(font) {
|
|
700
|
+
fontToComponents(font: string) {
|
|
675
701
|
// The format is specified in http://www.w3.org/TR/CSS2/fonts.html#font-shorthand:
|
|
676
702
|
// style - normal | italic | oblique | inherit
|
|
677
703
|
// variant - normal | small-caps | inherit
|
|
@@ -707,7 +733,7 @@ export class Text extends Image {
|
|
|
707
733
|
* @param {object} components - The font components to convert.
|
|
708
734
|
* @returns {string} The font string.
|
|
709
735
|
*/
|
|
710
|
-
componentsToFont(components) {
|
|
736
|
+
componentsToFont(components: any) {
|
|
711
737
|
const parts = [];
|
|
712
738
|
let v;
|
|
713
739
|
v = components.fontStyle;
|
|
@@ -743,7 +769,7 @@ export class Text extends Image {
|
|
|
743
769
|
* @param {boolean} immediate - If true, updates the text immediately.
|
|
744
770
|
* @returns {Text} This Text object for chaining.
|
|
745
771
|
*/
|
|
746
|
-
setText(text, immediate = false) {
|
|
772
|
+
setText(text: any, immediate: boolean = false) {
|
|
747
773
|
this.text = text.toString() || '';
|
|
748
774
|
if (immediate) {
|
|
749
775
|
this.updateText();
|
|
@@ -758,7 +784,7 @@ export class Text extends Image {
|
|
|
758
784
|
* @param {string[]|string[][]} list - The list of text to parse.
|
|
759
785
|
* @returns {Text} This Text object for chaining.
|
|
760
786
|
*/
|
|
761
|
-
parseList(list) {
|
|
787
|
+
parseList(list: any) {
|
|
762
788
|
if (!Array.isArray(list)) {
|
|
763
789
|
return this;
|
|
764
790
|
}
|
|
@@ -789,7 +815,7 @@ export class Text extends Image {
|
|
|
789
815
|
* @param {number} height - The height of the bounds.
|
|
790
816
|
* @returns {Text} This Text object for chaining.
|
|
791
817
|
*/
|
|
792
|
-
setTextBounds(x, y, width, height) {
|
|
818
|
+
setTextBounds(x: number, y: number, width: number, height: number) {
|
|
793
819
|
if (x === undefined) {
|
|
794
820
|
this.textBounds = null;
|
|
795
821
|
} else {
|
|
@@ -852,7 +878,7 @@ export class Text extends Image {
|
|
|
852
878
|
* Renders this text object using WebGL.
|
|
853
879
|
* @param {object} renderSession - The render session to use.
|
|
854
880
|
*/
|
|
855
|
-
renderWebGL(renderSession) {
|
|
881
|
+
renderWebGL(renderSession: any) {
|
|
856
882
|
if (this.dirty) {
|
|
857
883
|
this.updateText();
|
|
858
884
|
this.dirty = false;
|
|
@@ -864,7 +890,7 @@ export class Text extends Image {
|
|
|
864
890
|
* Renders this text object using Canvas.
|
|
865
891
|
* @param {object} renderSession - The render session to use.
|
|
866
892
|
*/
|
|
867
|
-
renderCanvas(renderSession) {
|
|
893
|
+
renderCanvas(renderSession: any) {
|
|
868
894
|
if (this.dirty) {
|
|
869
895
|
this.updateText();
|
|
870
896
|
this.dirty = false;
|
|
@@ -912,7 +938,7 @@ export class Text extends Image {
|
|
|
912
938
|
* @param {string} font - The font to determine properties for.
|
|
913
939
|
* @returns {object} The font properties.
|
|
914
940
|
*/
|
|
915
|
-
determineFontProperties(font) {
|
|
941
|
+
determineFontProperties(font: string) {
|
|
916
942
|
const fontPropertiesCache = this.getFontPropertiesCache();
|
|
917
943
|
let properties = fontPropertiesCache[font];
|
|
918
944
|
if (properties) {
|
|
@@ -937,7 +963,7 @@ export class Text extends Image {
|
|
|
937
963
|
* @param {string} fontStyle - The font style to determine properties for.
|
|
938
964
|
* @returns {{ascent: number, descent: number, fontSize: number}} The font properties.
|
|
939
965
|
*/
|
|
940
|
-
determineFontPropertiesFallback(fontStyle) {
|
|
966
|
+
determineFontPropertiesFallback(fontStyle: string) {
|
|
941
967
|
const fontPropertiesCache = this.getFontPropertiesCache();
|
|
942
968
|
let properties = fontPropertiesCache[fontStyle];
|
|
943
969
|
if (!properties) {
|
|
@@ -1018,7 +1044,7 @@ export class Text extends Image {
|
|
|
1018
1044
|
* @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
|
|
1019
1045
|
* @returns {Rectangle} The bounds of this text object.
|
|
1020
1046
|
*/
|
|
1021
|
-
getBounds(matrix = null) {
|
|
1047
|
+
getBounds(matrix: import('../geom/matrix.js').Matrix = null) {
|
|
1022
1048
|
if (this.dirty) {
|
|
1023
1049
|
this.updateText();
|
|
1024
1050
|
this.dirty = false;
|
|
@@ -1038,7 +1064,7 @@ export class Text extends Image {
|
|
|
1038
1064
|
* Sets the text content of this object.
|
|
1039
1065
|
* @param {string | number | boolean | Date} value - The new text content to set.
|
|
1040
1066
|
*/
|
|
1041
|
-
set text(value) {
|
|
1067
|
+
set text(value: any) {
|
|
1042
1068
|
if (value !== this._text) {
|
|
1043
1069
|
this._text = value.toString() || '';
|
|
1044
1070
|
this.dirty = true;
|
|
@@ -1060,7 +1086,7 @@ export class Text extends Image {
|
|
|
1060
1086
|
* Sets the CSS font string for this object.
|
|
1061
1087
|
* @param {string} value - The new CSS font string to set.
|
|
1062
1088
|
*/
|
|
1063
|
-
set cssFont(value) {
|
|
1089
|
+
set cssFont(value: string) {
|
|
1064
1090
|
this._fontComponents = this.fontToComponents(value || 'bold 20pt Arial');
|
|
1065
1091
|
this.updateFont(this._fontComponents);
|
|
1066
1092
|
}
|
|
@@ -1077,7 +1103,7 @@ export class Text extends Image {
|
|
|
1077
1103
|
* Sets the font family of this object.
|
|
1078
1104
|
* @param {string} value - The new font family to set.
|
|
1079
1105
|
*/
|
|
1080
|
-
set font(value) {
|
|
1106
|
+
set font(value: string) {
|
|
1081
1107
|
let mutatedValue = value || 'Arial';
|
|
1082
1108
|
mutatedValue = mutatedValue.trim();
|
|
1083
1109
|
// If it looks like the value should be quoted, but isn't, then quote it.
|
|
@@ -1105,10 +1131,10 @@ export class Text extends Image {
|
|
|
1105
1131
|
* Sets the font size of this object.
|
|
1106
1132
|
* @param {number} value - The new font size to set.
|
|
1107
1133
|
*/
|
|
1108
|
-
set fontSize(value) {
|
|
1109
|
-
let mutatedValue = value || '0';
|
|
1134
|
+
set fontSize(value: number) {
|
|
1135
|
+
let mutatedValue: any = value || '0';
|
|
1110
1136
|
if (typeof mutatedValue === 'number') {
|
|
1111
|
-
mutatedValue
|
|
1137
|
+
mutatedValue = `${mutatedValue}px`;
|
|
1112
1138
|
}
|
|
1113
1139
|
this._fontComponents.fontSize = mutatedValue;
|
|
1114
1140
|
this.updateFont(this._fontComponents);
|
|
@@ -1126,7 +1152,7 @@ export class Text extends Image {
|
|
|
1126
1152
|
* Sets the font weight of this object.
|
|
1127
1153
|
* @param {string} value - The new font weight to set.
|
|
1128
1154
|
*/
|
|
1129
|
-
set fontWeight(value) {
|
|
1155
|
+
set fontWeight(value: string) {
|
|
1130
1156
|
this._fontComponents.fontWeight = value || 'normal';
|
|
1131
1157
|
this.updateFont(this._fontComponents);
|
|
1132
1158
|
}
|
|
@@ -1143,7 +1169,7 @@ export class Text extends Image {
|
|
|
1143
1169
|
* Sets the font style of this object.
|
|
1144
1170
|
* @param {string} value - The new font style to set.
|
|
1145
1171
|
*/
|
|
1146
|
-
set fontStyle(value) {
|
|
1172
|
+
set fontStyle(value: string) {
|
|
1147
1173
|
this._fontComponents.fontStyle = value || 'normal';
|
|
1148
1174
|
this.updateFont(this._fontComponents);
|
|
1149
1175
|
}
|
|
@@ -1160,7 +1186,7 @@ export class Text extends Image {
|
|
|
1160
1186
|
* Sets the font variant of this object.
|
|
1161
1187
|
* @param {string} value - The new font variant to set.
|
|
1162
1188
|
*/
|
|
1163
|
-
set fontVariant(value) {
|
|
1189
|
+
set fontVariant(value: string) {
|
|
1164
1190
|
this._fontComponents.fontVariant = value || 'normal';
|
|
1165
1191
|
this.updateFont(this._fontComponents);
|
|
1166
1192
|
}
|
|
@@ -1177,7 +1203,7 @@ export class Text extends Image {
|
|
|
1177
1203
|
* Sets the fill color of this object.
|
|
1178
1204
|
* @param {string} value - The new fill color to set.
|
|
1179
1205
|
*/
|
|
1180
|
-
set fill(value) {
|
|
1206
|
+
set fill(value: string) {
|
|
1181
1207
|
if (value !== this.style.fill) {
|
|
1182
1208
|
this.style.fill = value;
|
|
1183
1209
|
this.dirty = true;
|
|
@@ -1196,7 +1222,7 @@ export class Text extends Image {
|
|
|
1196
1222
|
* Sets the alignment of this object.
|
|
1197
1223
|
* @param {string} value - The new text alignment to set.
|
|
1198
1224
|
*/
|
|
1199
|
-
set align(value) {
|
|
1225
|
+
set align(value: string) {
|
|
1200
1226
|
if (value !== this.style.align) {
|
|
1201
1227
|
this.style.align = value;
|
|
1202
1228
|
this.dirty = true;
|
|
@@ -1215,7 +1241,7 @@ export class Text extends Image {
|
|
|
1215
1241
|
* Sets the resolution of this object.
|
|
1216
1242
|
* @param {number} value - The new resolution to set.
|
|
1217
1243
|
*/
|
|
1218
|
-
set resolution(value) {
|
|
1244
|
+
set resolution(value: number) {
|
|
1219
1245
|
if (value !== this._res) {
|
|
1220
1246
|
this._res = value;
|
|
1221
1247
|
this.dirty = true;
|
|
@@ -1234,7 +1260,7 @@ export class Text extends Image {
|
|
|
1234
1260
|
* Sets the tabs setting of this object.
|
|
1235
1261
|
* @param {number} value - The new tabs setting to set.
|
|
1236
1262
|
*/
|
|
1237
|
-
set tabs(value) {
|
|
1263
|
+
set tabs(value: number) {
|
|
1238
1264
|
if (value !== this.style.tabs) {
|
|
1239
1265
|
this.style.tabs = value;
|
|
1240
1266
|
this.dirty = true;
|
|
@@ -1253,7 +1279,7 @@ export class Text extends Image {
|
|
|
1253
1279
|
* Sets the horizontal bounds alignment of this object.
|
|
1254
1280
|
* @param {number} value - The new horizontal bounds alignment to set.
|
|
1255
1281
|
*/
|
|
1256
|
-
set boundsAlignH(value) {
|
|
1282
|
+
set boundsAlignH(value: number) {
|
|
1257
1283
|
if (value !== this.style.boundsAlignH) {
|
|
1258
1284
|
this.style.boundsAlignH = value;
|
|
1259
1285
|
this.dirty = true;
|
|
@@ -1272,7 +1298,7 @@ export class Text extends Image {
|
|
|
1272
1298
|
* Sets the vertical bounds alignment of this object.
|
|
1273
1299
|
* @param {number} value - The new vertical bounds alignment to set.
|
|
1274
1300
|
*/
|
|
1275
|
-
set boundsAlignV(value) {
|
|
1301
|
+
set boundsAlignV(value: number) {
|
|
1276
1302
|
if (value !== this.style.boundsAlignV) {
|
|
1277
1303
|
this.style.boundsAlignV = value;
|
|
1278
1304
|
this.dirty = true;
|
|
@@ -1291,7 +1317,7 @@ export class Text extends Image {
|
|
|
1291
1317
|
* Sets the stroke color of this object.
|
|
1292
1318
|
* @param {string} value - The new stroke color to set.
|
|
1293
1319
|
*/
|
|
1294
|
-
set stroke(value) {
|
|
1320
|
+
set stroke(value: string) {
|
|
1295
1321
|
if (value !== this.style.stroke) {
|
|
1296
1322
|
this.style.stroke = value;
|
|
1297
1323
|
this.dirty = true;
|
|
@@ -1310,7 +1336,7 @@ export class Text extends Image {
|
|
|
1310
1336
|
* Sets the stroke thickness of this object.
|
|
1311
1337
|
* @param {number} value - The new stroke thickness to set.
|
|
1312
1338
|
*/
|
|
1313
|
-
set strokeThickness(value) {
|
|
1339
|
+
set strokeThickness(value: number) {
|
|
1314
1340
|
if (value !== this.style.strokeThickness) {
|
|
1315
1341
|
this.style.strokeThickness = value;
|
|
1316
1342
|
this.dirty = true;
|
|
@@ -1329,7 +1355,7 @@ export class Text extends Image {
|
|
|
1329
1355
|
* Sets the word wrap setting of this object.
|
|
1330
1356
|
* @param {boolean} value - The new word wrap setting to set.
|
|
1331
1357
|
*/
|
|
1332
|
-
set wordWrap(value) {
|
|
1358
|
+
set wordWrap(value: boolean) {
|
|
1333
1359
|
if (value !== this.style.wordWrap) {
|
|
1334
1360
|
this.style.wordWrap = value;
|
|
1335
1361
|
this.dirty = true;
|
|
@@ -1348,7 +1374,7 @@ export class Text extends Image {
|
|
|
1348
1374
|
* Sets the word wrap width of this object.
|
|
1349
1375
|
* @param {number} value - The new word wrap width to set.
|
|
1350
1376
|
*/
|
|
1351
|
-
set wordWrapWidth(value) {
|
|
1377
|
+
set wordWrapWidth(value: number) {
|
|
1352
1378
|
if (value !== this.style.wordWrapWidth) {
|
|
1353
1379
|
this.style.wordWrapWidth = value;
|
|
1354
1380
|
this.dirty = true;
|
|
@@ -1367,7 +1393,7 @@ export class Text extends Image {
|
|
|
1367
1393
|
* Sets the line spacing of this object.
|
|
1368
1394
|
* @param {number} value - The new line spacing to set.
|
|
1369
1395
|
*/
|
|
1370
|
-
set lineSpacing(value) {
|
|
1396
|
+
set lineSpacing(value: any) {
|
|
1371
1397
|
if (value !== this._lineSpacing) {
|
|
1372
1398
|
this._lineSpacing = Number.parseFloat(value);
|
|
1373
1399
|
this.dirty = true;
|
|
@@ -1389,7 +1415,7 @@ export class Text extends Image {
|
|
|
1389
1415
|
* Sets the shadow offset X of this object.
|
|
1390
1416
|
* @param {number} value - The new shadow offset X to set.
|
|
1391
1417
|
*/
|
|
1392
|
-
set shadowOffsetX(value) {
|
|
1418
|
+
set shadowOffsetX(value: number) {
|
|
1393
1419
|
if (value !== this.style.shadowOffsetX) {
|
|
1394
1420
|
this.style.shadowOffsetX = value;
|
|
1395
1421
|
this.dirty = true;
|
|
@@ -1408,7 +1434,7 @@ export class Text extends Image {
|
|
|
1408
1434
|
* Sets the shadow offset Y of this object.
|
|
1409
1435
|
* @param {number} value - The new shadow offset Y to set.
|
|
1410
1436
|
*/
|
|
1411
|
-
set shadowOffsetY(value) {
|
|
1437
|
+
set shadowOffsetY(value: number) {
|
|
1412
1438
|
if (value !== this.style.shadowOffsetY) {
|
|
1413
1439
|
this.style.shadowOffsetY = value;
|
|
1414
1440
|
this.dirty = true;
|
|
@@ -1427,7 +1453,7 @@ export class Text extends Image {
|
|
|
1427
1453
|
* Sets the shadow color of this object.
|
|
1428
1454
|
* @param {string} value - The new shadow color to set.
|
|
1429
1455
|
*/
|
|
1430
|
-
set shadowColor(value) {
|
|
1456
|
+
set shadowColor(value: string) {
|
|
1431
1457
|
if (value !== this.style.shadowColor) {
|
|
1432
1458
|
this.style.shadowColor = value;
|
|
1433
1459
|
this.dirty = true;
|
|
@@ -1446,7 +1472,7 @@ export class Text extends Image {
|
|
|
1446
1472
|
* Sets the shadow blur of this object.
|
|
1447
1473
|
* @param {number} value - The new shadow blur to set.
|
|
1448
1474
|
*/
|
|
1449
|
-
set shadowBlur(value) {
|
|
1475
|
+
set shadowBlur(value: number) {
|
|
1450
1476
|
if (value !== this.style.shadowBlur) {
|
|
1451
1477
|
this.style.shadowBlur = value;
|
|
1452
1478
|
this.dirty = true;
|
|
@@ -1465,7 +1491,7 @@ export class Text extends Image {
|
|
|
1465
1491
|
* Sets the shadow stroke setting of this object.
|
|
1466
1492
|
* @param {boolean} value - The new shadow stroke setting to set.
|
|
1467
1493
|
*/
|
|
1468
|
-
set shadowStroke(value) {
|
|
1494
|
+
set shadowStroke(value: boolean) {
|
|
1469
1495
|
if (value !== this.style.shadowStroke) {
|
|
1470
1496
|
this.style.shadowStroke = value;
|
|
1471
1497
|
this.dirty = true;
|
|
@@ -1484,7 +1510,7 @@ export class Text extends Image {
|
|
|
1484
1510
|
* Sets the shadow fill setting of this object.
|
|
1485
1511
|
* @param {boolean} value - The new shadow fill setting to set.
|
|
1486
1512
|
*/
|
|
1487
|
-
set shadowFill(value) {
|
|
1513
|
+
set shadowFill(value: boolean) {
|
|
1488
1514
|
if (value !== this.style.shadowFill) {
|
|
1489
1515
|
this.style.shadowFill = value;
|
|
1490
1516
|
this.dirty = true;
|
|
@@ -1507,7 +1533,7 @@ export class Text extends Image {
|
|
|
1507
1533
|
* Sets the width of this object.
|
|
1508
1534
|
* @param {number} value - The new width to set in pixels.
|
|
1509
1535
|
*/
|
|
1510
|
-
set width(value) {
|
|
1536
|
+
set width(value: number) {
|
|
1511
1537
|
this.scale.x = value / this.texture.frame.width;
|
|
1512
1538
|
this._width = value;
|
|
1513
1539
|
}
|
|
@@ -1528,7 +1554,7 @@ export class Text extends Image {
|
|
|
1528
1554
|
* Sets the height of this object.
|
|
1529
1555
|
* @param {number} value - The new height to set in pixels.
|
|
1530
1556
|
*/
|
|
1531
|
-
set height(value) {
|
|
1557
|
+
set height(value: number) {
|
|
1532
1558
|
this.scale.y = value / this.texture.frame.height;
|
|
1533
1559
|
this._height = value;
|
|
1534
1560
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
export class AbstractFilter {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
passes!: any;
|
|
4
|
+
shaders!: any;
|
|
5
|
+
dirty!: any;
|
|
6
|
+
padding!: any;
|
|
7
|
+
uniforms!: any;
|
|
8
|
+
fragmentSrc!: any;
|
|
9
9
|
/**
|
|
10
10
|
* Creates a new AbstractFilter instance.
|
|
11
11
|
* @param {string[]} fragmentSrc - The fragment shader source.
|
|
12
12
|
* @param {object} uniforms - The uniform variables for the shader.
|
|
13
13
|
*/
|
|
14
|
-
constructor(fragmentSrc, uniforms) {
|
|
14
|
+
constructor(fragmentSrc: string[], uniforms?: any) {
|
|
15
15
|
this.passes = [this];
|
|
16
16
|
this.shaders = [];
|
|
17
17
|
this.dirty = true;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { removeByCanvas } from '../canvas/pool.js';
|
|
3
2
|
|
|
4
3
|
export class BaseTexture {
|
|
5
|
-
resolution;
|
|
6
|
-
width;
|
|
7
|
-
height;
|
|
8
|
-
scaleMode;
|
|
9
|
-
hasLoaded;
|
|
10
|
-
source;
|
|
11
|
-
premultipliedAlpha;
|
|
12
|
-
_glTextures;
|
|
13
|
-
mipmap;
|
|
14
|
-
skipRender;
|
|
15
|
-
_powerOf2;
|
|
16
|
-
_dirty;
|
|
4
|
+
resolution!: any;
|
|
5
|
+
width!: any;
|
|
6
|
+
height!: any;
|
|
7
|
+
scaleMode!: any;
|
|
8
|
+
hasLoaded!: any;
|
|
9
|
+
source!: any;
|
|
10
|
+
premultipliedAlpha!: any;
|
|
11
|
+
_glTextures!: any;
|
|
12
|
+
mipmap!: any;
|
|
13
|
+
skipRender!: any;
|
|
14
|
+
_powerOf2!: any;
|
|
15
|
+
_dirty!: any;
|
|
17
16
|
/**
|
|
18
17
|
* Updates the base texture with a new source.
|
|
19
18
|
* @param {HTMLCanvasElement} source - The new canvas element to use as the texture source.
|
|
20
19
|
* @param {number} [scaleMode] - The scale mode to use for the texture.
|
|
21
20
|
*/
|
|
22
|
-
constructor(source, scaleMode) {
|
|
21
|
+
constructor(source: any, scaleMode?: any) {
|
|
23
22
|
this.resolution = 1;
|
|
24
23
|
this.width = 100;
|
|
25
24
|
this.height = 100;
|
|
@@ -47,7 +46,7 @@ _dirty;
|
|
|
47
46
|
* @param {number} width - The new width of the texture.
|
|
48
47
|
* @param {number} height - The new height of the texture.
|
|
49
48
|
*/
|
|
50
|
-
forceLoaded(width, height) {
|
|
49
|
+
forceLoaded(width: number, height: number) {
|
|
51
50
|
this.hasLoaded = true;
|
|
52
51
|
this.width = width;
|
|
53
52
|
this.height = height;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
export class WebGLBlendModeManager {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
gl!: any;
|
|
4
|
+
currentBlendMode!: any;
|
|
5
5
|
/**
|
|
6
6
|
* Creates a new BlendModeManager instance.
|
|
7
7
|
*/
|
|
@@ -14,7 +14,7 @@ currentBlendMode;
|
|
|
14
14
|
* Initializes the blend mode manager with a WebGL context.
|
|
15
15
|
* @param {WebGLRenderingContext} gl - The WebGL rendering context.
|
|
16
16
|
*/
|
|
17
|
-
setContext(gl) {
|
|
17
|
+
setContext(gl: WebGLRenderingContext) {
|
|
18
18
|
this.gl = gl;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ currentBlendMode;
|
|
|
23
23
|
* @param {number} blendMode - The blend mode to set.
|
|
24
24
|
* @returns {boolean} True if the blend mode was set successfully, false otherwise.
|
|
25
25
|
*/
|
|
26
|
-
setBlendMode(blendMode) {
|
|
26
|
+
setBlendMode(blendMode: number) {
|
|
27
27
|
if (this.currentBlendMode === blendMode) {
|
|
28
28
|
return false;
|
|
29
29
|
}
|