@vpmedia/phaser 1.112.0 → 1.113.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 +1261 -1314
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +14 -10
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +10 -8
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +5 -4
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +4 -3
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/const.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +3 -2
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/event_manager.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +1 -1
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/frame.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +8 -6
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +40 -30
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +3 -2
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +3 -2
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +6 -4
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +3 -2
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +4 -3
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +9 -8
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts +3 -2
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/registry.d.ts +7 -0
- package/dist/phaser/core/registry.d.ts.map +1 -0
- package/dist/phaser/core/scale_manager.d.ts +1 -1
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +0 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts +1 -1
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +0 -1
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +4 -3
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +6 -4
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +3 -2
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts +5 -4
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts +3 -2
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts +1 -1
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +1 -1
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/timer_event.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +10 -7
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +3 -2
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_easing.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +3 -2
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts +3 -2
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +3 -2
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +3 -2
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts +7 -6
- package/dist/phaser/display/canvas/graphics.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 +10 -8
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -2
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +2 -2
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +14 -12
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +8 -5
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts +4 -3
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +13 -10
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts +3 -2
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +18 -15
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +11 -9
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts +0 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +4 -3
- 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 +2 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +7 -6
- 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/render_texture.d.ts +4 -2
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +16 -11
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts +16 -6
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts +19 -7
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +33 -12
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts +15 -6
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts +15 -6
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +16 -11
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +29 -20
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts +12 -10
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +3 -2
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +4 -1
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +1 -1
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +3 -2
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +2 -2
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/phaser/core/animation.ts +64 -60
- package/src/phaser/core/animation_manager.ts +50 -53
- package/src/phaser/core/animation_parser.ts +9 -9
- package/src/phaser/core/array_set.ts +16 -17
- package/src/phaser/core/cache.ts +92 -93
- package/src/phaser/core/const.ts +1 -1
- package/src/phaser/core/device.ts +24 -29
- package/src/phaser/core/device_util.ts +22 -26
- package/src/phaser/core/dom.ts +54 -65
- package/src/phaser/core/event_manager.ts +64 -94
- package/src/phaser/core/factory.ts +14 -14
- package/src/phaser/core/frame.ts +28 -28
- package/src/phaser/core/frame_data.test.ts +100 -0
- package/src/phaser/core/frame_data.ts +24 -24
- package/src/phaser/core/frame_util.ts +2 -2
- package/src/phaser/core/game.ts +47 -48
- package/src/phaser/core/input.ts +104 -110
- package/src/phaser/core/input_handler.test.ts +113 -0
- package/src/phaser/core/input_handler.ts +199 -218
- package/src/phaser/core/input_mouse.ts +71 -54
- package/src/phaser/core/input_mspointer.ts +52 -39
- package/src/phaser/core/input_pointer.ts +81 -80
- package/src/phaser/core/input_touch.ts +49 -36
- package/src/phaser/core/loader.ts +173 -152
- package/src/phaser/core/loader_parser.ts +39 -57
- package/src/phaser/core/raf.ts +8 -7
- package/src/phaser/core/registry.test.ts +31 -0
- package/src/phaser/core/registry.ts +9 -0
- package/src/phaser/core/scale_manager.ts +156 -152
- package/src/phaser/core/scene.ts +9 -13
- package/src/phaser/core/scene_manager.ts +47 -47
- package/src/phaser/core/signal.test.ts +4 -4
- package/src/phaser/core/signal.ts +41 -52
- package/src/phaser/core/signal_binding.ts +26 -25
- package/src/phaser/core/signal_dispatch.test.ts +180 -0
- package/src/phaser/core/sound.ts +75 -83
- package/src/phaser/core/sound_manager.ts +52 -51
- package/src/phaser/core/sound_sprite.ts +17 -16
- package/src/phaser/core/stage.ts +25 -24
- package/src/phaser/core/time.ts +52 -52
- package/src/phaser/core/timer.test.ts +187 -0
- package/src/phaser/core/timer.ts +82 -69
- package/src/phaser/core/timer_event.ts +10 -10
- package/src/phaser/core/tween.ts +90 -93
- package/src/phaser/core/tween_data.ts +45 -51
- package/src/phaser/core/tween_easing.test.ts +106 -0
- package/src/phaser/core/tween_easing.ts +151 -123
- package/src/phaser/core/tween_manager.ts +19 -18
- package/src/phaser/core/world.ts +4 -3
- package/src/phaser/display/bitmap_text.ts +56 -64
- package/src/phaser/display/button.ts +33 -32
- package/src/phaser/display/canvas/buffer.ts +8 -8
- package/src/phaser/display/canvas/graphics.ts +36 -37
- package/src/phaser/display/canvas/masker.ts +2 -2
- package/src/phaser/display/canvas/pool.test.ts +106 -0
- package/src/phaser/display/canvas/pool.ts +25 -27
- package/src/phaser/display/canvas/renderer.ts +32 -31
- package/src/phaser/display/canvas/tinter.ts +25 -25
- package/src/phaser/display/canvas/util.ts +7 -10
- package/src/phaser/display/display_object.ts +114 -118
- package/src/phaser/display/graphics.ts +121 -119
- package/src/phaser/display/graphics_data.ts +12 -12
- package/src/phaser/display/graphics_data_util.ts +2 -3
- package/src/phaser/display/group.ts +50 -57
- package/src/phaser/display/image.ts +55 -52
- package/src/phaser/display/sprite_batch.ts +3 -2
- package/src/phaser/display/sprite_util.ts +48 -54
- package/src/phaser/display/text.ts +199 -204
- package/src/phaser/display/webgl/abstract_filter.ts +9 -9
- package/src/phaser/display/webgl/base_texture.ts +21 -24
- package/src/phaser/display/webgl/blend_manager.ts +6 -10
- package/src/phaser/display/webgl/earcut.ts +73 -37
- package/src/phaser/display/webgl/earcut_node.ts +10 -10
- package/src/phaser/display/webgl/fast_sprite_batch.ts +34 -34
- package/src/phaser/display/webgl/filter_manager.ts +13 -12
- package/src/phaser/display/webgl/filter_texture.ts +14 -13
- package/src/phaser/display/webgl/graphics.ts +51 -57
- package/src/phaser/display/webgl/graphics_data.ts +15 -14
- package/src/phaser/display/webgl/mask_manager.ts +2 -2
- package/src/phaser/display/webgl/render_texture.ts +26 -25
- package/src/phaser/display/webgl/renderer.ts +57 -62
- package/src/phaser/display/webgl/shader/complex.ts +28 -12
- package/src/phaser/display/webgl/shader/fast.ts +30 -12
- package/src/phaser/display/webgl/shader/normal.ts +70 -57
- package/src/phaser/display/webgl/shader/primitive.ts +26 -11
- package/src/phaser/display/webgl/shader/shader.test.ts +148 -0
- package/src/phaser/display/webgl/shader/strip.ts +27 -12
- package/src/phaser/display/webgl/shader_manager.test.ts +124 -0
- package/src/phaser/display/webgl/shader_manager.ts +26 -34
- package/src/phaser/display/webgl/sprite_batch.ts +67 -61
- package/src/phaser/display/webgl/stencil_manager.ts +23 -34
- package/src/phaser/display/webgl/texture.ts +43 -50
- package/src/phaser/display/webgl/texture_util.ts +2 -3
- package/src/phaser/display/webgl/util.ts +26 -25
- package/src/phaser/geom/circle.test.ts +2 -3
- package/src/phaser/geom/circle.ts +36 -36
- package/src/phaser/geom/ellipse.test.ts +73 -71
- package/src/phaser/geom/ellipse.ts +14 -14
- package/src/phaser/geom/line.test.ts +5 -5
- package/src/phaser/geom/line.ts +35 -35
- package/src/phaser/geom/matrix.test.ts +1 -1
- package/src/phaser/geom/matrix.ts +27 -27
- package/src/phaser/geom/point.test.ts +1 -2
- package/src/phaser/geom/point.ts +35 -35
- package/src/phaser/geom/polygon.test.ts +82 -0
- package/src/phaser/geom/polygon.ts +16 -16
- package/src/phaser/geom/rectangle.test.ts +14 -14
- package/src/phaser/geom/rectangle.ts +83 -75
- package/src/phaser/geom/rounded_rectangle.test.ts +1 -7
- package/src/phaser/geom/rounded_rectangle.ts +9 -9
- package/src/phaser/geom/util/circle.test.ts +25 -23
- package/src/phaser/geom/util/circle.ts +9 -18
- package/src/phaser/geom/util/ellipse.test.ts +7 -5
- package/src/phaser/geom/util/ellipse.ts +3 -2
- package/src/phaser/geom/util/line.test.ts +10 -8
- package/src/phaser/geom/util/line.ts +6 -16
- package/src/phaser/geom/util/matrix.test.ts +20 -18
- package/src/phaser/geom/util/matrix.ts +8 -15
- package/src/phaser/geom/util/point.test.ts +8 -6
- package/src/phaser/geom/util/point.ts +24 -28
- package/src/phaser/geom/util/polygon.test.ts +12 -10
- package/src/phaser/geom/util/polygon.ts +2 -2
- package/src/phaser/geom/util/rectangle.test.ts +10 -8
- package/src/phaser/geom/util/rectangle.ts +18 -37
- package/src/phaser/geom/util/rounded_rectangle.test.ts +11 -9
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
- package/src/phaser/util/math.test.ts +11 -11
- package/src/phaser/util/math.ts +29 -46
|
@@ -6,72 +6,72 @@ import { DOM } from './dom.js';
|
|
|
6
6
|
import { Signal } from './signal.js';
|
|
7
7
|
|
|
8
8
|
export class ScaleManager {
|
|
9
|
-
game!: Game;
|
|
10
|
-
dom!: DOM;
|
|
11
|
-
width!: number;
|
|
12
|
-
height!: number;
|
|
13
|
-
minWidth!: number | null;
|
|
14
|
-
maxWidth!: number | null;
|
|
15
|
-
minHeight!: number | null;
|
|
16
|
-
maxHeight!: number | null;
|
|
17
|
-
offset!: Point;
|
|
18
|
-
forceLandscape!: boolean;
|
|
19
|
-
forcePortrait!: boolean;
|
|
20
|
-
incorrectOrientation!: boolean;
|
|
21
|
-
_pageAlignHorizontally!: boolean;
|
|
22
|
-
_pageAlignVertically!: boolean;
|
|
23
|
-
onOrientationChange!: Signal;
|
|
24
|
-
enterIncorrectOrientation!: Signal;
|
|
25
|
-
leaveIncorrectOrientation!: Signal;
|
|
26
|
-
hasPhaserSetFullScreen!: boolean;
|
|
27
|
-
fullScreenTarget!: any;
|
|
28
|
-
_createdFullScreenTarget!: any;
|
|
29
|
-
onFullScreenInit!: Signal;
|
|
30
|
-
onFullScreenChange!: Signal;
|
|
31
|
-
onFullScreenError!: Signal;
|
|
32
|
-
screenOrientation!: any;
|
|
33
|
-
scaleFactor!: Point;
|
|
34
|
-
scaleFactorInversed!: Point;
|
|
35
|
-
margin!: any;
|
|
36
|
-
bounds!: Rectangle;
|
|
37
|
-
aspectRatio!: number;
|
|
38
|
-
sourceAspectRatio!: number;
|
|
39
|
-
event!: Event | null | undefined;
|
|
40
|
-
windowConstraints!: any;
|
|
41
|
-
compatibility!: any;
|
|
42
|
-
_scaleMode!: number;
|
|
43
|
-
_fullScreenScaleMode!: number;
|
|
44
|
-
parentIsWindow!: boolean;
|
|
45
|
-
parentNode!: any;
|
|
46
|
-
parentScaleFactor!: Point;
|
|
47
|
-
trackParentInterval!: number;
|
|
48
|
-
onSizeChange!: Signal;
|
|
49
|
-
onResize!: any;
|
|
50
|
-
onResizeContext!: any;
|
|
51
|
-
_pendingScaleMode!: any;
|
|
52
|
-
_fullScreenRestore!: any;
|
|
53
|
-
_gameSize!: Rectangle;
|
|
54
|
-
_userScaleFactor!: Point;
|
|
55
|
-
_userScaleTrim!: Point;
|
|
56
|
-
_lastUpdate!: number;
|
|
57
|
-
_updateThrottle!: number;
|
|
58
|
-
_updateThrottleReset!: number;
|
|
59
|
-
_parentBounds!: Rectangle;
|
|
60
|
-
_tempBounds!: Rectangle;
|
|
61
|
-
_lastReportedCanvasSize!: Rectangle;
|
|
62
|
-
_lastReportedGameSize!: Rectangle;
|
|
63
|
-
_booted!: boolean;
|
|
64
|
-
_orientationChange!: (event: Event) => void;
|
|
65
|
-
_windowResize!: (event: UIEvent) => void;
|
|
66
|
-
_fullScreenChange!: (event: Event) => void;
|
|
67
|
-
_fullScreenError!: (event: Event) => void;
|
|
9
|
+
public game!: Game;
|
|
10
|
+
public dom!: DOM;
|
|
11
|
+
public width!: number;
|
|
12
|
+
public height!: number;
|
|
13
|
+
public minWidth!: number | null;
|
|
14
|
+
public maxWidth!: number | null;
|
|
15
|
+
public minHeight!: number | null;
|
|
16
|
+
public maxHeight!: number | null;
|
|
17
|
+
public offset!: Point;
|
|
18
|
+
public forceLandscape!: boolean;
|
|
19
|
+
public forcePortrait!: boolean;
|
|
20
|
+
public incorrectOrientation!: boolean;
|
|
21
|
+
public _pageAlignHorizontally!: boolean;
|
|
22
|
+
public _pageAlignVertically!: boolean;
|
|
23
|
+
public onOrientationChange!: Signal;
|
|
24
|
+
public enterIncorrectOrientation!: Signal;
|
|
25
|
+
public leaveIncorrectOrientation!: Signal;
|
|
26
|
+
public hasPhaserSetFullScreen!: boolean;
|
|
27
|
+
public fullScreenTarget!: any;
|
|
28
|
+
public _createdFullScreenTarget!: any;
|
|
29
|
+
public onFullScreenInit!: Signal;
|
|
30
|
+
public onFullScreenChange!: Signal;
|
|
31
|
+
public onFullScreenError!: Signal;
|
|
32
|
+
public screenOrientation!: any;
|
|
33
|
+
public scaleFactor!: Point;
|
|
34
|
+
public scaleFactorInversed!: Point;
|
|
35
|
+
public margin!: any;
|
|
36
|
+
public bounds!: Rectangle;
|
|
37
|
+
public aspectRatio!: number;
|
|
38
|
+
public sourceAspectRatio!: number;
|
|
39
|
+
public event!: Event | null | undefined;
|
|
40
|
+
public windowConstraints!: any;
|
|
41
|
+
public compatibility!: any;
|
|
42
|
+
public _scaleMode!: number;
|
|
43
|
+
public _fullScreenScaleMode!: number;
|
|
44
|
+
public parentIsWindow!: boolean;
|
|
45
|
+
public parentNode!: any;
|
|
46
|
+
public parentScaleFactor!: Point;
|
|
47
|
+
public trackParentInterval!: number;
|
|
48
|
+
public onSizeChange!: Signal;
|
|
49
|
+
public onResize!: any;
|
|
50
|
+
public onResizeContext!: any;
|
|
51
|
+
public _pendingScaleMode!: any;
|
|
52
|
+
public _fullScreenRestore!: any;
|
|
53
|
+
public _gameSize!: Rectangle;
|
|
54
|
+
public _userScaleFactor!: Point;
|
|
55
|
+
public _userScaleTrim!: Point;
|
|
56
|
+
public _lastUpdate!: number;
|
|
57
|
+
public _updateThrottle!: number;
|
|
58
|
+
public _updateThrottleReset!: number;
|
|
59
|
+
public _parentBounds!: Rectangle;
|
|
60
|
+
public _tempBounds!: Rectangle;
|
|
61
|
+
public _lastReportedCanvasSize!: Rectangle;
|
|
62
|
+
public _lastReportedGameSize!: Rectangle;
|
|
63
|
+
public _booted!: boolean;
|
|
64
|
+
public _orientationChange!: (event: Event) => void;
|
|
65
|
+
public _windowResize!: (event: UIEvent) => void;
|
|
66
|
+
public _fullScreenChange!: (event: Event) => void;
|
|
67
|
+
public _fullScreenError!: (event: Event) => void;
|
|
68
68
|
/**
|
|
69
69
|
* TBD.
|
|
70
|
-
* @param {
|
|
70
|
+
* @param {Game} game - TBD.
|
|
71
71
|
* @param {number} width - TBD.
|
|
72
72
|
* @param {number} height - TBD.
|
|
73
73
|
*/
|
|
74
|
-
constructor(game: Game, width: number, height: number) {
|
|
74
|
+
public constructor(game: Game, width: number, height: number) {
|
|
75
75
|
this.game = game;
|
|
76
76
|
this.dom = new DOM(game.device);
|
|
77
77
|
this.width = 0;
|
|
@@ -152,7 +152,7 @@ export class ScaleManager {
|
|
|
152
152
|
/**
|
|
153
153
|
* TBD.
|
|
154
154
|
*/
|
|
155
|
-
boot() {
|
|
155
|
+
public boot() {
|
|
156
156
|
// Configure device-dependent compatibility
|
|
157
157
|
const compat = this.compatibility;
|
|
158
158
|
compat.supportsFullScreen = this.game.device.fullscreen;
|
|
@@ -165,14 +165,22 @@ export class ScaleManager {
|
|
|
165
165
|
}
|
|
166
166
|
// Configure event listeners
|
|
167
167
|
const scope = this;
|
|
168
|
-
this._orientationChange = (event) =>
|
|
169
|
-
|
|
168
|
+
this._orientationChange = (event) => {
|
|
169
|
+
scope.orientationChange(event);
|
|
170
|
+
};
|
|
171
|
+
this._windowResize = (event) => {
|
|
172
|
+
scope.windowResize(event);
|
|
173
|
+
};
|
|
170
174
|
// This does not appear to be on the standards track
|
|
171
|
-
|
|
175
|
+
globalThis.addEventListener('orientationchange', this._orientationChange, false);
|
|
172
176
|
window.addEventListener('resize', this._windowResize, false);
|
|
173
177
|
if (this.compatibility.supportsFullScreen) {
|
|
174
|
-
this._fullScreenChange = (event) =>
|
|
175
|
-
|
|
178
|
+
this._fullScreenChange = (event) => {
|
|
179
|
+
scope.fullScreenChange(event);
|
|
180
|
+
};
|
|
181
|
+
this._fullScreenError = (event) => {
|
|
182
|
+
scope.fullScreenError(event);
|
|
183
|
+
};
|
|
176
184
|
document.addEventListener('webkitfullscreenchange', this._fullScreenChange, false);
|
|
177
185
|
document.addEventListener('mozfullscreenchange', this._fullScreenChange, false);
|
|
178
186
|
document.addEventListener('MSFullscreenChange', this._fullScreenChange, false);
|
|
@@ -200,7 +208,7 @@ export class ScaleManager {
|
|
|
200
208
|
* TBD.
|
|
201
209
|
* @param {object} config - TBD.
|
|
202
210
|
*/
|
|
203
|
-
parseConfig(config: any) {
|
|
211
|
+
public parseConfig(config: any) {
|
|
204
212
|
if (config.scaleMode !== undefined) {
|
|
205
213
|
if (this._booted) {
|
|
206
214
|
this.scaleMode = config.scaleMode;
|
|
@@ -223,7 +231,7 @@ export class ScaleManager {
|
|
|
223
231
|
* @param {number} width - TBD.
|
|
224
232
|
* @param {number} height - TBD.
|
|
225
233
|
*/
|
|
226
|
-
setupScale(width: number, height: number) {
|
|
234
|
+
public setupScale(width: number, height: number) {
|
|
227
235
|
let target;
|
|
228
236
|
const rect = new Rectangle();
|
|
229
237
|
if (this.game.parent !== '') {
|
|
@@ -257,14 +265,14 @@ export class ScaleManager {
|
|
|
257
265
|
newWidth = width;
|
|
258
266
|
} else {
|
|
259
267
|
// Percentage based
|
|
260
|
-
this.parentScaleFactor.x =
|
|
268
|
+
this.parentScaleFactor.x = Math.trunc(Number(width)) / 100;
|
|
261
269
|
newWidth = rect.width * this.parentScaleFactor.x;
|
|
262
270
|
}
|
|
263
271
|
if (typeof height === 'number') {
|
|
264
272
|
newHeight = height;
|
|
265
273
|
} else {
|
|
266
274
|
// Percentage based
|
|
267
|
-
this.parentScaleFactor.y =
|
|
275
|
+
this.parentScaleFactor.y = Math.trunc(Number(height)) / 100;
|
|
268
276
|
newHeight = rect.height * this.parentScaleFactor.y;
|
|
269
277
|
}
|
|
270
278
|
newWidth = Math.floor(newWidth);
|
|
@@ -276,7 +284,7 @@ export class ScaleManager {
|
|
|
276
284
|
/**
|
|
277
285
|
* TBD.
|
|
278
286
|
*/
|
|
279
|
-
_gameResumed() {
|
|
287
|
+
public _gameResumed() {
|
|
280
288
|
this.queueUpdate(true);
|
|
281
289
|
}
|
|
282
290
|
|
|
@@ -285,7 +293,7 @@ export class ScaleManager {
|
|
|
285
293
|
* @param {number} width - TBD.
|
|
286
294
|
* @param {number} height - TBD.
|
|
287
295
|
*/
|
|
288
|
-
setGameSize(width: number, height: number) {
|
|
296
|
+
public setGameSize(width: number, height: number) {
|
|
289
297
|
this._gameSize.setTo(0, 0, width, height);
|
|
290
298
|
if (this.currentScaleMode !== SCALE_RESIZE) {
|
|
291
299
|
this.updateDimensions(width, height, true);
|
|
@@ -300,9 +308,9 @@ export class ScaleManager {
|
|
|
300
308
|
* @param {number} hTrim - TBD.
|
|
301
309
|
* @param {number} vTrim - TBD.
|
|
302
310
|
*/
|
|
303
|
-
setUserScale(hScale: number, vScale: number, hTrim: number, vTrim: number) {
|
|
311
|
+
public setUserScale(hScale: number, vScale: number, hTrim: number, vTrim: number) {
|
|
304
312
|
this._userScaleFactor.setTo(hScale, vScale);
|
|
305
|
-
this._userScaleTrim.setTo(hTrim
|
|
313
|
+
this._userScaleTrim.setTo(Math.trunc(hTrim), Math.trunc(vTrim));
|
|
306
314
|
this.queueUpdate(true);
|
|
307
315
|
}
|
|
308
316
|
|
|
@@ -311,7 +319,7 @@ export class ScaleManager {
|
|
|
311
319
|
* @param {Function} callback - TBD.
|
|
312
320
|
* @param {object} context - TBD.
|
|
313
321
|
*/
|
|
314
|
-
setResizeCallback(callback: Function, context: any) {
|
|
322
|
+
public setResizeCallback(callback: Function, context: any) {
|
|
315
323
|
this.onResize = callback;
|
|
316
324
|
this.onResizeContext = context;
|
|
317
325
|
}
|
|
@@ -319,15 +327,15 @@ export class ScaleManager {
|
|
|
319
327
|
/**
|
|
320
328
|
* TBD.
|
|
321
329
|
*/
|
|
322
|
-
signalSizeChange() {
|
|
330
|
+
public signalSizeChange() {
|
|
323
331
|
if (
|
|
324
332
|
this.width !== this._lastReportedCanvasSize.width ||
|
|
325
333
|
this.height !== this._lastReportedCanvasSize.height ||
|
|
326
334
|
this.game.width !== this._lastReportedGameSize.width ||
|
|
327
335
|
this.game.height !== this._lastReportedGameSize.height
|
|
328
336
|
) {
|
|
329
|
-
const width = this
|
|
330
|
-
const height = this
|
|
337
|
+
const { width } = this;
|
|
338
|
+
const { height } = this;
|
|
331
339
|
this._lastReportedCanvasSize.setTo(0, 0, width, height);
|
|
332
340
|
this._lastReportedGameSize.setTo(0, 0, this.game.width, this.game.height);
|
|
333
341
|
this.onSizeChange.dispatch(this, width, height);
|
|
@@ -346,13 +354,13 @@ export class ScaleManager {
|
|
|
346
354
|
* @param {number} maxWidth - TBD.
|
|
347
355
|
* @param {number} maxHeight - TBD.
|
|
348
356
|
*/
|
|
349
|
-
setMinMax(minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) {
|
|
357
|
+
public setMinMax(minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) {
|
|
350
358
|
this.minWidth = minWidth;
|
|
351
359
|
this.minHeight = minHeight;
|
|
352
|
-
if (
|
|
360
|
+
if (maxWidth !== undefined) {
|
|
353
361
|
this.maxWidth = maxWidth;
|
|
354
362
|
}
|
|
355
|
-
if (
|
|
363
|
+
if (maxHeight !== undefined) {
|
|
356
364
|
this.maxHeight = maxHeight;
|
|
357
365
|
}
|
|
358
366
|
}
|
|
@@ -360,7 +368,7 @@ export class ScaleManager {
|
|
|
360
368
|
/**
|
|
361
369
|
* TBD.
|
|
362
370
|
*/
|
|
363
|
-
preUpdate() {
|
|
371
|
+
public preUpdate() {
|
|
364
372
|
if (this.game.time.time < this._lastUpdate + this._updateThrottle) {
|
|
365
373
|
return;
|
|
366
374
|
}
|
|
@@ -393,7 +401,7 @@ export class ScaleManager {
|
|
|
393
401
|
/**
|
|
394
402
|
* TBD.
|
|
395
403
|
*/
|
|
396
|
-
pauseUpdate() {
|
|
404
|
+
public pauseUpdate() {
|
|
397
405
|
this.preUpdate();
|
|
398
406
|
// Updates at slowest.
|
|
399
407
|
this._updateThrottle = this.trackParentInterval;
|
|
@@ -405,7 +413,7 @@ export class ScaleManager {
|
|
|
405
413
|
* @param {number} height - TBD.
|
|
406
414
|
* @param {boolean} resize - TBD.
|
|
407
415
|
*/
|
|
408
|
-
updateDimensions(width: number, height: number, resize: boolean) {
|
|
416
|
+
public updateDimensions(width: number, height: number, resize: boolean) {
|
|
409
417
|
this.width = width * this.parentScaleFactor.x;
|
|
410
418
|
this.height = height * this.parentScaleFactor.y;
|
|
411
419
|
this.game.width = this.width;
|
|
@@ -421,7 +429,7 @@ export class ScaleManager {
|
|
|
421
429
|
/**
|
|
422
430
|
* TBD.
|
|
423
431
|
*/
|
|
424
|
-
updateScalingAndBounds() {
|
|
432
|
+
public updateScalingAndBounds() {
|
|
425
433
|
this.scaleFactor.x = this.game.width / this.width;
|
|
426
434
|
this.scaleFactor.y = this.game.height / this.height;
|
|
427
435
|
this.scaleFactorInversed.x = this.width / this.game.width;
|
|
@@ -443,7 +451,7 @@ export class ScaleManager {
|
|
|
443
451
|
* @param {boolean} forceLandscape - TBD.
|
|
444
452
|
* @param {boolean} forcePortrait - TBD.
|
|
445
453
|
*/
|
|
446
|
-
forceOrientation(forceLandscape
|
|
454
|
+
public forceOrientation(forceLandscape = false, forcePortrait = false) {
|
|
447
455
|
this.forceLandscape = forceLandscape;
|
|
448
456
|
this.forcePortrait = forcePortrait;
|
|
449
457
|
this.queueUpdate(true);
|
|
@@ -454,7 +462,7 @@ export class ScaleManager {
|
|
|
454
462
|
* @param {string} orientation - TBD.
|
|
455
463
|
* @returns {string} TBD.
|
|
456
464
|
*/
|
|
457
|
-
classifyOrientation(orientation: string) {
|
|
465
|
+
public classifyOrientation(orientation: string) {
|
|
458
466
|
if (orientation === 'portrait-primary' || orientation === 'portrait-secondary') {
|
|
459
467
|
return 'portrait';
|
|
460
468
|
} else if (orientation === 'landscape-primary' || orientation === 'landscape-secondary') {
|
|
@@ -467,7 +475,7 @@ export class ScaleManager {
|
|
|
467
475
|
* TBD.
|
|
468
476
|
* @returns {boolean} TBD.
|
|
469
477
|
*/
|
|
470
|
-
updateOrientationState() {
|
|
478
|
+
public updateOrientationState() {
|
|
471
479
|
const previousOrientation = this.screenOrientation;
|
|
472
480
|
const previouslyIncorrect = this.incorrectOrientation;
|
|
473
481
|
this.screenOrientation = this.dom.getScreenOrientation(this.compatibility.orientationFallback);
|
|
@@ -491,7 +499,7 @@ export class ScaleManager {
|
|
|
491
499
|
* TBD.
|
|
492
500
|
* @param {Event} event - TBD.
|
|
493
501
|
*/
|
|
494
|
-
orientationChange(event: Event) {
|
|
502
|
+
public orientationChange(event: Event) {
|
|
495
503
|
this.event = event;
|
|
496
504
|
this.queueUpdate(true);
|
|
497
505
|
}
|
|
@@ -500,7 +508,7 @@ export class ScaleManager {
|
|
|
500
508
|
* TBD.
|
|
501
509
|
* @param {Event} event - TBD.
|
|
502
510
|
*/
|
|
503
|
-
windowResize(event: Event) {
|
|
511
|
+
public windowResize(event: Event) {
|
|
504
512
|
this.event = event;
|
|
505
513
|
this.queueUpdate(true);
|
|
506
514
|
}
|
|
@@ -508,14 +516,14 @@ export class ScaleManager {
|
|
|
508
516
|
/**
|
|
509
517
|
* TBD.
|
|
510
518
|
*/
|
|
511
|
-
refresh() {
|
|
519
|
+
public refresh() {
|
|
512
520
|
this.queueUpdate(true);
|
|
513
521
|
}
|
|
514
522
|
|
|
515
523
|
/**
|
|
516
524
|
* TBD.
|
|
517
525
|
*/
|
|
518
|
-
updateLayout() {
|
|
526
|
+
public updateLayout() {
|
|
519
527
|
const scaleMode = this.currentScaleMode;
|
|
520
528
|
if (scaleMode === SCALE_RESIZE) {
|
|
521
529
|
this.reflowGame();
|
|
@@ -549,8 +557,8 @@ export class ScaleManager {
|
|
|
549
557
|
this.height = Math.min(this.height, bounds.height);
|
|
550
558
|
}
|
|
551
559
|
// Always truncate / force to integer
|
|
552
|
-
this.width
|
|
553
|
-
this.height
|
|
560
|
+
this.width |= 0;
|
|
561
|
+
this.height |= 0;
|
|
554
562
|
this.reflowCanvas();
|
|
555
563
|
}
|
|
556
564
|
|
|
@@ -559,11 +567,11 @@ export class ScaleManager {
|
|
|
559
567
|
* @param {Rectangle} target - TBD.
|
|
560
568
|
* @returns {Rectangle} TBD.
|
|
561
569
|
*/
|
|
562
|
-
getParentBounds(target: Rectangle) {
|
|
570
|
+
public getParentBounds(target: Rectangle) {
|
|
563
571
|
const bounds = target || new Rectangle();
|
|
564
572
|
const parentNode = this.boundingParent;
|
|
565
|
-
const visualBounds = this.dom
|
|
566
|
-
const layoutBounds = this.dom
|
|
573
|
+
const { visualBounds } = this.dom;
|
|
574
|
+
const { layoutBounds } = this.dom;
|
|
567
575
|
if (!parentNode) {
|
|
568
576
|
bounds.setTo(0, 0, visualBounds.width, visualBounds.height);
|
|
569
577
|
} else {
|
|
@@ -597,10 +605,10 @@ export class ScaleManager {
|
|
|
597
605
|
* @param {boolean} horizontal - TBD.
|
|
598
606
|
* @param {boolean} vertical - TBD.
|
|
599
607
|
*/
|
|
600
|
-
alignCanvas(horizontal: boolean, vertical: boolean) {
|
|
608
|
+
public alignCanvas(horizontal: boolean, vertical: boolean) {
|
|
601
609
|
const parentBounds = this.getParentBounds(this._tempBounds);
|
|
602
|
-
const canvas = this.game
|
|
603
|
-
const margin = this
|
|
610
|
+
const { canvas } = this.game;
|
|
611
|
+
const { margin } = this;
|
|
604
612
|
if (horizontal) {
|
|
605
613
|
margin.left = 0;
|
|
606
614
|
margin.right = 0;
|
|
@@ -643,7 +651,7 @@ export class ScaleManager {
|
|
|
643
651
|
/**
|
|
644
652
|
* TBD.
|
|
645
653
|
*/
|
|
646
|
-
reflowGame() {
|
|
654
|
+
public reflowGame() {
|
|
647
655
|
this.resetCanvas('', '');
|
|
648
656
|
const bounds = this.getParentBounds(this._tempBounds);
|
|
649
657
|
this.updateDimensions(bounds.width, bounds.height, true);
|
|
@@ -652,10 +660,10 @@ export class ScaleManager {
|
|
|
652
660
|
/**
|
|
653
661
|
* TBD.
|
|
654
662
|
*/
|
|
655
|
-
reflowCanvas() {
|
|
663
|
+
public reflowCanvas() {
|
|
656
664
|
if (!this.incorrectOrientation) {
|
|
657
|
-
this.width = Math.max(this.minWidth
|
|
658
|
-
this.height = Math.max(this.minHeight
|
|
665
|
+
this.width = Math.max(this.minWidth ?? 0, Math.min(this.maxWidth ?? this.width, this.width));
|
|
666
|
+
this.height = Math.max(this.minHeight ?? 0, Math.min(this.maxHeight ?? this.height, this.height));
|
|
659
667
|
}
|
|
660
668
|
this.resetCanvas();
|
|
661
669
|
if (!this.compatibility.noMargins) {
|
|
@@ -673,8 +681,8 @@ export class ScaleManager {
|
|
|
673
681
|
* @param {string} cssWidth - TBD.
|
|
674
682
|
* @param {string} cssHeight - TBD.
|
|
675
683
|
*/
|
|
676
|
-
resetCanvas(cssWidth
|
|
677
|
-
const canvas = this.game
|
|
684
|
+
public resetCanvas(cssWidth = `${this.width}px`, cssHeight = `${this.height}px`) {
|
|
685
|
+
const { canvas } = this.game;
|
|
678
686
|
if (!this.compatibility.noMargins) {
|
|
679
687
|
canvas.style.marginLeft = '';
|
|
680
688
|
canvas.style.marginTop = '';
|
|
@@ -689,7 +697,7 @@ export class ScaleManager {
|
|
|
689
697
|
* TBD.
|
|
690
698
|
* @param {boolean} force - TBD.
|
|
691
699
|
*/
|
|
692
|
-
queueUpdate(force: boolean) {
|
|
700
|
+
public queueUpdate(force: boolean) {
|
|
693
701
|
if (force) {
|
|
694
702
|
this._parentBounds.width = 0;
|
|
695
703
|
this._parentBounds.height = 0;
|
|
@@ -700,14 +708,14 @@ export class ScaleManager {
|
|
|
700
708
|
/**
|
|
701
709
|
* TBD.
|
|
702
710
|
*/
|
|
703
|
-
reset() {
|
|
711
|
+
public reset() {
|
|
704
712
|
// pass
|
|
705
713
|
}
|
|
706
714
|
|
|
707
715
|
/**
|
|
708
716
|
* TBD.
|
|
709
717
|
*/
|
|
710
|
-
setMaximum() {
|
|
718
|
+
public setMaximum() {
|
|
711
719
|
this.width = this.dom.visualBounds.width;
|
|
712
720
|
this.height = this.dom.visualBounds.height;
|
|
713
721
|
}
|
|
@@ -716,10 +724,10 @@ export class ScaleManager {
|
|
|
716
724
|
* TBD.
|
|
717
725
|
* @param {boolean} expanding - TBD.
|
|
718
726
|
*/
|
|
719
|
-
setShowAll(expanding
|
|
727
|
+
public setShowAll(expanding = false) {
|
|
720
728
|
const bounds = this.getParentBounds(this._tempBounds);
|
|
721
|
-
const width = bounds
|
|
722
|
-
const height = bounds
|
|
729
|
+
const { width } = bounds;
|
|
730
|
+
const { height } = bounds;
|
|
723
731
|
let multiplier;
|
|
724
732
|
if (expanding) {
|
|
725
733
|
multiplier = Math.max(height / this.game.height, width / this.game.width);
|
|
@@ -733,7 +741,7 @@ export class ScaleManager {
|
|
|
733
741
|
/**
|
|
734
742
|
* TBD.
|
|
735
743
|
*/
|
|
736
|
-
setExactFit() {
|
|
744
|
+
public setExactFit() {
|
|
737
745
|
const bounds = this.getParentBounds(this._tempBounds);
|
|
738
746
|
this.width = bounds.width;
|
|
739
747
|
this.height = bounds.height;
|
|
@@ -753,7 +761,7 @@ export class ScaleManager {
|
|
|
753
761
|
* TBD.
|
|
754
762
|
* @returns {HTMLDivElement} TBD.
|
|
755
763
|
*/
|
|
756
|
-
createFullScreenTarget() {
|
|
764
|
+
public createFullScreenTarget() {
|
|
757
765
|
const fsTarget = document.createElement('div');
|
|
758
766
|
fsTarget.style.margin = '0';
|
|
759
767
|
fsTarget.style.padding = '0';
|
|
@@ -767,7 +775,7 @@ export class ScaleManager {
|
|
|
767
775
|
* @param {boolean} allowTrampoline - TBD.
|
|
768
776
|
* @returns {boolean} TBD.
|
|
769
777
|
*/
|
|
770
|
-
startFullScreen(antialias: boolean, allowTrampoline: boolean) {
|
|
778
|
+
public startFullScreen(antialias: boolean, allowTrampoline: boolean) {
|
|
771
779
|
if (this.isFullScreen) {
|
|
772
780
|
return false;
|
|
773
781
|
}
|
|
@@ -780,12 +788,8 @@ export class ScaleManager {
|
|
|
780
788
|
return false;
|
|
781
789
|
}
|
|
782
790
|
if (this.compatibility.clickTrampoline === 'when-not-mouse') {
|
|
783
|
-
const input = this.game
|
|
784
|
-
if (
|
|
785
|
-
input.activePointer &&
|
|
786
|
-
input.activePointer !== input.mousePointer &&
|
|
787
|
-
(allowTrampoline || allowTrampoline !== false)
|
|
788
|
-
) {
|
|
791
|
+
const { input } = this.game;
|
|
792
|
+
if (input.activePointer && input.activePointer !== input.mousePointer && allowTrampoline) {
|
|
789
793
|
input.activePointer.addClickTrampoline('startFullScreen', this.startFullScreen, this, [antialias, false]);
|
|
790
794
|
return false;
|
|
791
795
|
}
|
|
@@ -804,12 +808,12 @@ export class ScaleManager {
|
|
|
804
808
|
if (this._createdFullScreenTarget) {
|
|
805
809
|
// Move the Display canvas inside of the target and add the target to the DOM
|
|
806
810
|
// (The target has to be added for the Fullscreen API to work.)
|
|
807
|
-
const canvas = this.game
|
|
811
|
+
const { canvas } = this.game;
|
|
808
812
|
const parent = canvas.parentNode;
|
|
809
813
|
if (parent) {
|
|
810
|
-
|
|
814
|
+
canvas.before(fsTarget);
|
|
811
815
|
}
|
|
812
|
-
fsTarget.
|
|
816
|
+
fsTarget.append(canvas);
|
|
813
817
|
}
|
|
814
818
|
if (this.game.device.fullscreenKeyboard) {
|
|
815
819
|
fsTarget[this.game.device.requestFullscreen]((Element as any).ALLOW_KEYBOARD_INPUT);
|
|
@@ -823,19 +827,19 @@ export class ScaleManager {
|
|
|
823
827
|
* TBD.
|
|
824
828
|
* @returns {boolean} TBD.
|
|
825
829
|
*/
|
|
826
|
-
stopFullScreen() {
|
|
830
|
+
public stopFullScreen() {
|
|
827
831
|
if (!this.isFullScreen || !this.compatibility.supportsFullScreen) {
|
|
828
832
|
return false;
|
|
829
833
|
}
|
|
830
834
|
this.hasPhaserSetFullScreen = false;
|
|
831
|
-
(document as unknown as Record<string, () => void>)[this.game.device.cancelFullscreen]();
|
|
835
|
+
(document as unknown as Record<string, (() => void) | undefined>)[this.game.device.cancelFullscreen]?.();
|
|
832
836
|
return true;
|
|
833
837
|
}
|
|
834
838
|
|
|
835
839
|
/**
|
|
836
840
|
* TBD.
|
|
837
841
|
*/
|
|
838
|
-
cleanupCreatedTarget() {
|
|
842
|
+
public cleanupCreatedTarget() {
|
|
839
843
|
const fsTarget = this._createdFullScreenTarget;
|
|
840
844
|
if (fsTarget && fsTarget.parentNode) {
|
|
841
845
|
// Make sure to cleanup synthetic target for sure;
|
|
@@ -851,8 +855,8 @@ export class ScaleManager {
|
|
|
851
855
|
* TBD.
|
|
852
856
|
* @param {boolean} enteringFullscreen - TBD.
|
|
853
857
|
*/
|
|
854
|
-
prepScreenMode(enteringFullscreen: boolean) {
|
|
855
|
-
const fsTarget = this._createdFullScreenTarget
|
|
858
|
+
public prepScreenMode(enteringFullscreen: boolean) {
|
|
859
|
+
const fsTarget = this._createdFullScreenTarget ?? this.fullScreenTarget;
|
|
856
860
|
if (!fsTarget) {
|
|
857
861
|
return;
|
|
858
862
|
}
|
|
@@ -885,7 +889,7 @@ export class ScaleManager {
|
|
|
885
889
|
* TBD.
|
|
886
890
|
* @param {Event} event - TBD.
|
|
887
891
|
*/
|
|
888
|
-
fullScreenChange(event: Event) {
|
|
892
|
+
public fullScreenChange(event: Event) {
|
|
889
893
|
this.event = event;
|
|
890
894
|
if (this.isFullScreen) {
|
|
891
895
|
this.prepScreenMode(true);
|
|
@@ -904,7 +908,7 @@ export class ScaleManager {
|
|
|
904
908
|
* TBD.
|
|
905
909
|
* @param {Event} [event] - TBD.
|
|
906
910
|
*/
|
|
907
|
-
fullScreenError(event: Event) {
|
|
911
|
+
public fullScreenError(event: Event) {
|
|
908
912
|
this.event = event;
|
|
909
913
|
this.cleanupCreatedTarget();
|
|
910
914
|
this.onFullScreenError.dispatch(this);
|
|
@@ -913,9 +917,9 @@ export class ScaleManager {
|
|
|
913
917
|
/**
|
|
914
918
|
* TBD.
|
|
915
919
|
*/
|
|
916
|
-
destroy() {
|
|
920
|
+
public destroy() {
|
|
917
921
|
this.game.onResume.remove(this._gameResumed, this);
|
|
918
|
-
|
|
922
|
+
globalThis.removeEventListener('orientationchange', this._orientationChange, false);
|
|
919
923
|
window.removeEventListener('resize', this._windowResize, false);
|
|
920
924
|
if (this.compatibility.supportsFullScreen) {
|
|
921
925
|
document.removeEventListener('webkitfullscreenchange', this._fullScreenChange, false);
|
|
@@ -934,26 +938,26 @@ export class ScaleManager {
|
|
|
934
938
|
* TBD.
|
|
935
939
|
* @returns {ParentNode | null} TBD.
|
|
936
940
|
*/
|
|
937
|
-
get boundingParent() {
|
|
941
|
+
public get boundingParent() {
|
|
938
942
|
if (this.parentIsWindow || (this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)) {
|
|
939
943
|
return null;
|
|
940
944
|
}
|
|
941
945
|
const parentNode = this.game.canvas ? (this.game.canvas.parentNode as HTMLElement | null) : null;
|
|
942
|
-
return parentNode
|
|
946
|
+
return parentNode ?? null;
|
|
943
947
|
}
|
|
944
948
|
|
|
945
949
|
/**
|
|
946
950
|
* TBD.
|
|
947
951
|
* @returns {number} TBD.
|
|
948
952
|
*/
|
|
949
|
-
get scaleMode() {
|
|
953
|
+
public get scaleMode() {
|
|
950
954
|
return this._scaleMode;
|
|
951
955
|
}
|
|
952
956
|
|
|
953
957
|
/**
|
|
954
958
|
* TBD.
|
|
955
959
|
*/
|
|
956
|
-
set scaleMode(value) {
|
|
960
|
+
public set scaleMode(value) {
|
|
957
961
|
if (value !== this._scaleMode) {
|
|
958
962
|
if (!this.isFullScreen) {
|
|
959
963
|
this.updateDimensions(this._gameSize.width, this._gameSize.height, true);
|
|
@@ -968,14 +972,14 @@ export class ScaleManager {
|
|
|
968
972
|
* TBD.
|
|
969
973
|
* @returns {number} TBD.
|
|
970
974
|
*/
|
|
971
|
-
get fullScreenScaleMode() {
|
|
975
|
+
public get fullScreenScaleMode() {
|
|
972
976
|
return this._fullScreenScaleMode;
|
|
973
977
|
}
|
|
974
978
|
|
|
975
979
|
/**
|
|
976
980
|
* TBD.
|
|
977
981
|
*/
|
|
978
|
-
set fullScreenScaleMode(value) {
|
|
982
|
+
public set fullScreenScaleMode(value) {
|
|
979
983
|
if (value !== this._fullScreenScaleMode) {
|
|
980
984
|
// If in fullscreen then need a wee bit more work
|
|
981
985
|
if (this.isFullScreen) {
|
|
@@ -994,7 +998,7 @@ export class ScaleManager {
|
|
|
994
998
|
* TBD.
|
|
995
999
|
* @returns {number} TBD.
|
|
996
1000
|
*/
|
|
997
|
-
get currentScaleMode() {
|
|
1001
|
+
public get currentScaleMode() {
|
|
998
1002
|
return this.isFullScreen ? this._fullScreenScaleMode : this._scaleMode;
|
|
999
1003
|
}
|
|
1000
1004
|
|
|
@@ -1002,7 +1006,7 @@ export class ScaleManager {
|
|
|
1002
1006
|
* TBD.
|
|
1003
1007
|
* @returns {boolean} TBD.
|
|
1004
1008
|
*/
|
|
1005
|
-
get pageAlignHorizontally() {
|
|
1009
|
+
public get pageAlignHorizontally() {
|
|
1006
1010
|
return this._pageAlignHorizontally;
|
|
1007
1011
|
}
|
|
1008
1012
|
|
|
@@ -1010,7 +1014,7 @@ export class ScaleManager {
|
|
|
1010
1014
|
* TBD.
|
|
1011
1015
|
* @returns {boolean} TBD.
|
|
1012
1016
|
*/
|
|
1013
|
-
get pageAlignVertically() {
|
|
1017
|
+
public get pageAlignVertically() {
|
|
1014
1018
|
return this._pageAlignVertically;
|
|
1015
1019
|
}
|
|
1016
1020
|
|
|
@@ -1018,11 +1022,11 @@ export class ScaleManager {
|
|
|
1018
1022
|
* TBD.
|
|
1019
1023
|
* @returns {boolean} TBD.
|
|
1020
1024
|
*/
|
|
1021
|
-
get isFullScreen() {
|
|
1022
|
-
return
|
|
1023
|
-
document.fullscreenElement
|
|
1024
|
-
(document as any).webkitFullscreenElement
|
|
1025
|
-
(document as any).mozFullScreenElement
|
|
1025
|
+
public get isFullScreen() {
|
|
1026
|
+
return Boolean(
|
|
1027
|
+
document.fullscreenElement ??
|
|
1028
|
+
(document as any).webkitFullscreenElement ??
|
|
1029
|
+
(document as any).mozFullScreenElement ??
|
|
1026
1030
|
(document as any).msFullscreenElement
|
|
1027
1031
|
);
|
|
1028
1032
|
}
|
|
@@ -1031,7 +1035,7 @@ export class ScaleManager {
|
|
|
1031
1035
|
* TBD.
|
|
1032
1036
|
* @returns {boolean} TBD.
|
|
1033
1037
|
*/
|
|
1034
|
-
get isPortrait() {
|
|
1038
|
+
public get isPortrait() {
|
|
1035
1039
|
return this.classifyOrientation(this.screenOrientation) === 'portrait';
|
|
1036
1040
|
}
|
|
1037
1041
|
|
|
@@ -1039,7 +1043,7 @@ export class ScaleManager {
|
|
|
1039
1043
|
* TBD.
|
|
1040
1044
|
* @returns {boolean} TBD.
|
|
1041
1045
|
*/
|
|
1042
|
-
get isLandscape() {
|
|
1046
|
+
public get isLandscape() {
|
|
1043
1047
|
return this.classifyOrientation(this.screenOrientation) === 'landscape';
|
|
1044
1048
|
}
|
|
1045
1049
|
|
|
@@ -1047,7 +1051,7 @@ export class ScaleManager {
|
|
|
1047
1051
|
* TBD.
|
|
1048
1052
|
* @returns {boolean} TBD.
|
|
1049
1053
|
*/
|
|
1050
|
-
get isGamePortrait() {
|
|
1054
|
+
public get isGamePortrait() {
|
|
1051
1055
|
return this.height > this.width;
|
|
1052
1056
|
}
|
|
1053
1057
|
|
|
@@ -1055,7 +1059,7 @@ export class ScaleManager {
|
|
|
1055
1059
|
* TBD.
|
|
1056
1060
|
* @returns {boolean} TBD.
|
|
1057
1061
|
*/
|
|
1058
|
-
get isGameLandscape() {
|
|
1062
|
+
public get isGameLandscape() {
|
|
1059
1063
|
return this.width > this.height;
|
|
1060
1064
|
}
|
|
1061
1065
|
}
|