laymur 0.27.1 → 0.29.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/README.md +99 -5
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +14 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +40 -6
- package/dist/core/constraints/UICustomConstraint.js +2 -2
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +3 -2
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +3 -2
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +3 -2
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +3 -2
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +6 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +8 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +3 -2
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +3 -2
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +3 -2
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +3 -2
- package/dist/core/constraints/constraintAsserts.d.ts +41 -0
- package/dist/core/constraints/constraintAsserts.js +171 -0
- package/dist/core/elements/UICanvasElement/UICanvasElement.d.ts +54 -0
- package/dist/core/elements/UICanvasElement/UICanvasElement.js +70 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +2 -0
- package/dist/core/elements/UIDummy/UIDummy.d.ts +8 -5
- package/dist/core/elements/UIDummy/UIDummy.js +24 -11
- package/dist/core/elements/UIElement/UIElement.Internal.d.ts +6 -5
- package/dist/core/elements/UIElement/UIElement.Internal.js +0 -4
- package/dist/core/elements/UIElement/UIElement.d.ts +12 -6
- package/dist/core/elements/UIElement/UIElement.js +14 -7
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +42 -2
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +2 -2
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +48 -34
- package/dist/core/elements/UIGraphics/UIGraphics.js +196 -93
- package/dist/core/elements/UIImage/UIImage.d.ts +11 -1
- package/dist/core/elements/UIImage/UIImage.js +14 -0
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +10 -1
- package/dist/core/elements/UIScene/UIScene.Internal.js +1 -0
- package/dist/core/elements/UIScene/UIScene.d.ts +11 -1
- package/dist/core/elements/UIScene/UIScene.js +29 -5
- package/dist/core/elements/UIText/UIText.Interfaces.d.ts +2 -2
- package/dist/core/elements/UIText/UIText.Internal.d.ts +14 -1
- package/dist/core/elements/UIText/UIText.Internal.js +12 -0
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +9 -4
- package/dist/core/elements/UIText/UIText.Measuring.js +17 -6
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +7 -16
- package/dist/core/elements/UIText/UIText.Rendering.js +212 -46
- package/dist/core/elements/UIText/UIText.d.ts +64 -29
- package/dist/core/elements/UIText/UIText.js +134 -149
- package/dist/core/index.d.ts +10 -4
- package/dist/core/index.js +5 -1
- package/dist/core/layers/UILayer/UILayer.d.ts +17 -3
- package/dist/core/layers/UILayer/UILayer.js +35 -4
- package/dist/core/layers/UIViewportLayer/UIViewportLayer.d.ts +2 -0
- package/dist/core/layers/UIViewportLayer/UIViewportLayer.js +4 -1
- package/dist/core/miscellaneous/UIBlendMode.d.ts +5 -0
- package/dist/core/miscellaneous/UIBlendMode.js +7 -0
- package/dist/core/miscellaneous/asserts.d.ts +0 -41
- package/dist/core/miscellaneous/asserts.js +0 -170
- package/dist/core/miscellaneous/canvas-surface/UICanvasSurface.d.ts +46 -0
- package/dist/core/miscellaneous/canvas-surface/UICanvasSurface.js +86 -0
- package/dist/core/miscellaneous/color/UIColor.d.ts +17 -0
- package/dist/core/miscellaneous/color/UIColor.js +22 -0
- package/dist/core/miscellaneous/color/canvasColor.d.ts +9 -0
- package/dist/core/miscellaneous/color/canvasColor.js +15 -0
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +3 -0
- package/dist/core/miscellaneous/insets/UIInsets.js +15 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +10 -7
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +11 -8
- package/dist/core/miscellaneous/paint/UIGradient.Internal.d.ts +37 -0
- package/dist/core/miscellaneous/paint/UIGradient.Internal.js +14 -0
- package/dist/core/miscellaneous/paint/UIGradient.d.ts +18 -0
- package/dist/core/miscellaneous/paint/UIGradient.js +35 -0
- package/dist/core/miscellaneous/paint/UILinearGradient.d.ts +14 -0
- package/dist/core/miscellaneous/paint/UILinearGradient.js +22 -0
- package/dist/core/miscellaneous/paint/UIPaint.Internal.d.ts +21 -0
- package/dist/core/miscellaneous/paint/UIPaint.Internal.js +1 -0
- package/dist/core/miscellaneous/paint/UIPaint.d.ts +17 -0
- package/dist/core/miscellaneous/paint/UIPaint.js +21 -0
- package/dist/core/miscellaneous/paint/UIRadialGradient.d.ts +18 -0
- package/dist/core/miscellaneous/paint/UIRadialGradient.js +33 -0
- package/dist/core/miscellaneous/shared.d.ts +14 -0
- package/dist/core/miscellaneous/shared.js +11 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.d.ts +91 -30
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +12 -8
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +41 -63
- package/dist/core/miscellaneous/text-style/UITextStyle.js +165 -291
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +2 -1
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +12 -3
- package/dist/core/shaders/UIProgressMaskFunctionCircular.js +1 -2
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +7 -3
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +2 -1
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +19 -10
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +6 -2
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +41 -9
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +97 -35
- package/dist/particles/behaviorModules/UIBehaviorAlignToVelocity.d.ts +44 -0
- package/dist/particles/behaviorModules/UIBehaviorAlignToVelocity.js +75 -0
- package/dist/particles/behaviorModules/UIBehaviorBounce.d.ts +51 -0
- package/dist/particles/behaviorModules/UIBehaviorBounce.js +107 -0
- package/dist/particles/behaviorModules/UIBehaviorOrbit.d.ts +39 -0
- package/dist/particles/behaviorModules/UIBehaviorOrbit.js +73 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +7 -2
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +9 -5
- package/dist/particles/behaviorModules/UIBehaviorSeek.d.ts +38 -0
- package/dist/particles/behaviorModules/UIBehaviorSeek.js +75 -0
- package/dist/particles/elements/UIEmitter.Internal.d.ts +48 -1
- package/dist/particles/elements/UIEmitter.Internal.js +26 -1
- package/dist/particles/elements/UIEmitter.Schedule.d.ts +31 -0
- package/dist/particles/elements/UIEmitter.Schedule.js +81 -0
- package/dist/particles/elements/UIEmitter.d.ts +79 -9
- package/dist/particles/elements/UIEmitter.js +241 -83
- package/dist/particles/index.d.ts +13 -1
- package/dist/particles/index.js +11 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +6 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +27 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +7 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.js +12 -1
- package/dist/particles/miscellaneous/miscellaneous.d.ts +22 -0
- package/dist/particles/miscellaneous/miscellaneous.js +38 -0
- package/dist/particles/renderingModules/UIRenderingFlipbook.d.ts +41 -0
- package/dist/particles/renderingModules/UIRenderingFlipbook.js +70 -0
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +2 -1
- package/dist/particles/renderingModules/UIRenderingModule.js +2 -1
- package/dist/particles/renderingModules/UIRenderingRandomColor.d.ts +19 -0
- package/dist/particles/renderingModules/UIRenderingRandomColor.js +28 -0
- package/dist/particles/renderingModules/UIRenderingShape.d.ts +31 -0
- package/dist/particles/renderingModules/UIRenderingShape.js +54 -0
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +1 -1
- package/dist/particles/renderingModules/UIRenderingTexture.js +4 -28
- package/dist/particles/shaders/UIRenderingFlipbook.d.ts +5 -0
- package/dist/particles/shaders/UIRenderingFlipbook.js +19 -0
- package/dist/particles/shaders/UIRenderingRandomColor.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingRandomColor.js +10 -0
- package/dist/particles/shaders/UIRenderingShape.d.ts +6 -0
- package/dist/particles/shaders/UIRenderingShape.js +15 -0
- package/dist/particles/shaders/UIRenderingTexture.d.ts +4 -2
- package/dist/particles/shaders/UIRenderingTexture.js +27 -2
- package/dist/particles/spawnModules/UISpawnCircle.d.ts +44 -0
- package/dist/particles/spawnModules/UISpawnCircle.js +81 -0
- package/dist/particles/spawnModules/UISpawnRadialVelocity.d.ts +37 -0
- package/dist/particles/spawnModules/UISpawnRadialVelocity.js +75 -0
- package/package.json +1 -1
|
@@ -1,85 +1,123 @@
|
|
|
1
1
|
import { assertValidNonNegativeNumber, assertValidNumber, assertValidPositiveNumber, } from "../asserts.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { toCanvasColor } from "../color/canvasColor.js";
|
|
3
|
+
import { resolvePaint } from "../paint/UIPaint.js";
|
|
4
|
+
import { TEXT_STYLE_DEFAULT_ALIGN, TEXT_STYLE_DEFAULT_COLOR, TEXT_STYLE_DEFAULT_FONT_FAMILY, TEXT_STYLE_DEFAULT_FONT_SIZE, TEXT_STYLE_DEFAULT_FONT_STYLE, TEXT_STYLE_DEFAULT_FONT_WEIGHT, TEXT_STYLE_DEFAULT_LINE_HEIGHT, TEXT_STYLE_DEFAULT_PAINT_BOX, TEXT_STYLE_DEFAULT_SHADOWS, TEXT_STYLE_DEFAULT_STROKE_JOIN, TEXT_STYLE_DEFAULT_STROKES, } from "./UITextStyle.Internal.js";
|
|
5
|
+
/** Value of every property after `setDefaults` */
|
|
6
|
+
const TEXT_STYLE_DEFAULTS = {
|
|
7
|
+
color: TEXT_STYLE_DEFAULT_COLOR,
|
|
8
|
+
paintBox: TEXT_STYLE_DEFAULT_PAINT_BOX,
|
|
9
|
+
align: TEXT_STYLE_DEFAULT_ALIGN,
|
|
10
|
+
fontFamily: TEXT_STYLE_DEFAULT_FONT_FAMILY,
|
|
11
|
+
fontSize: TEXT_STYLE_DEFAULT_FONT_SIZE,
|
|
12
|
+
fontStyle: TEXT_STYLE_DEFAULT_FONT_STYLE,
|
|
13
|
+
fontWeight: TEXT_STYLE_DEFAULT_FONT_WEIGHT,
|
|
14
|
+
lineHeight: TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT,
|
|
15
|
+
strokes: TEXT_STYLE_DEFAULT_STROKES,
|
|
16
|
+
shadows: TEXT_STYLE_DEFAULT_SHADOWS,
|
|
17
|
+
};
|
|
18
|
+
const TEXT_STYLE_KEYS = Object.keys(TEXT_STYLE_DEFAULTS);
|
|
19
|
+
/**
|
|
20
|
+
* Sets a property of a resolved style when the value is defined.
|
|
21
|
+
* @param style Style to change
|
|
22
|
+
* @param key Property
|
|
23
|
+
* @param value Value, or undefined to keep the current one
|
|
24
|
+
*/
|
|
25
|
+
function assignDefined(style, key, value) {
|
|
26
|
+
if (value !== undefined) {
|
|
27
|
+
style[key] = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Converts outline configs to stored outlines.
|
|
32
|
+
* @param strokes Outline configs
|
|
33
|
+
* @returns Frozen outlines with colors as CSS strings
|
|
34
|
+
*/
|
|
35
|
+
function resolveStrokes(strokes) {
|
|
36
|
+
return Object.freeze(strokes.map((stroke) => {
|
|
37
|
+
assertValidNonNegativeNumber(stroke.thickness, "UITextStyle.strokes.thickness");
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
paint: resolvePaint(stroke.paint),
|
|
40
|
+
thickness: stroke.thickness,
|
|
41
|
+
join: stroke.join ?? TEXT_STYLE_DEFAULT_STROKE_JOIN,
|
|
42
|
+
});
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Converts shadow configs to stored shadows.
|
|
47
|
+
* @param shadows Shadow configs
|
|
48
|
+
* @returns Frozen shadows with colors as CSS strings
|
|
49
|
+
*/
|
|
50
|
+
function resolveShadows(shadows) {
|
|
51
|
+
return Object.freeze(shadows.map((shadow) => {
|
|
52
|
+
const offsetX = shadow.offsetX ?? 0;
|
|
53
|
+
const offsetY = shadow.offsetY ?? 0;
|
|
54
|
+
const blur = shadow.blur ?? 0;
|
|
55
|
+
assertValidNumber(offsetX, "UITextStyle.shadows.offsetX");
|
|
56
|
+
assertValidNumber(offsetY, "UITextStyle.shadows.offsetY");
|
|
57
|
+
assertValidNonNegativeNumber(blur, "UITextStyle.shadows.blur");
|
|
58
|
+
return Object.freeze({ color: toCanvasColor(shadow.color), offsetX, offsetY, blur });
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Text style of a span or of a whole text. Properties left undefined are taken from the
|
|
63
|
+
* fallback style, the common style of the text for a span, then from the defaults. Lists of
|
|
64
|
+
* strokes and shadows are taken as a whole.
|
|
65
|
+
*/
|
|
4
66
|
export class UITextStyle {
|
|
5
67
|
/** @param config Partial style configuration. Unspecified properties remain undefined. */
|
|
6
68
|
constructor(config) {
|
|
69
|
+
this.values = {};
|
|
7
70
|
this.dirtyInternal = true;
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.enableStrokeInternal = config?.enableStroke;
|
|
21
|
-
this.strokeColorInternal = config?.strokeColor;
|
|
22
|
-
this.strokeThicknessInternal = config?.strokeThickness;
|
|
23
|
-
}
|
|
24
|
-
/** Text color */
|
|
71
|
+
this.color = config?.color;
|
|
72
|
+
this.paintBox = config?.paintBox;
|
|
73
|
+
this.align = config?.align;
|
|
74
|
+
this.fontFamily = config?.fontFamily;
|
|
75
|
+
this.fontSize = config?.fontSize;
|
|
76
|
+
this.fontStyle = config?.fontStyle;
|
|
77
|
+
this.fontWeight = config?.fontWeight;
|
|
78
|
+
this.lineHeight = config?.lineHeight;
|
|
79
|
+
this.strokes = config?.strokes;
|
|
80
|
+
this.shadows = config?.shadows;
|
|
81
|
+
}
|
|
82
|
+
/** Color or gradient of the glyphs. A color is kept as a CSS string. */
|
|
25
83
|
get color() {
|
|
26
|
-
return this.
|
|
84
|
+
return this.values.color;
|
|
85
|
+
}
|
|
86
|
+
/** Box the gradients of the fill and of the strokes are laid over */
|
|
87
|
+
get paintBox() {
|
|
88
|
+
return this.values.paintBox;
|
|
27
89
|
}
|
|
28
90
|
/** Text alignment */
|
|
29
91
|
get align() {
|
|
30
|
-
return this.
|
|
92
|
+
return this.values.align;
|
|
31
93
|
}
|
|
32
94
|
/** Font family name */
|
|
33
95
|
get fontFamily() {
|
|
34
|
-
return this.
|
|
96
|
+
return this.values.fontFamily;
|
|
35
97
|
}
|
|
36
98
|
/** Font size in pixels */
|
|
37
99
|
get fontSize() {
|
|
38
|
-
return this.
|
|
100
|
+
return this.values.fontSize;
|
|
39
101
|
}
|
|
40
102
|
/** Font style */
|
|
41
103
|
get fontStyle() {
|
|
42
|
-
return this.
|
|
104
|
+
return this.values.fontStyle;
|
|
43
105
|
}
|
|
44
106
|
/** Font weight */
|
|
45
107
|
get fontWeight() {
|
|
46
|
-
return this.
|
|
108
|
+
return this.values.fontWeight;
|
|
47
109
|
}
|
|
48
|
-
/** Line height in pixels */
|
|
110
|
+
/** Line height in pixels, the distance between baselines */
|
|
49
111
|
get lineHeight() {
|
|
50
|
-
return this.
|
|
51
|
-
}
|
|
52
|
-
/** Whether shadow is enabled */
|
|
53
|
-
get enableShadow() {
|
|
54
|
-
return this.enableShadowInternal;
|
|
55
|
-
}
|
|
56
|
-
/** Shadow horizontal offset in pixels */
|
|
57
|
-
get shadowOffsetX() {
|
|
58
|
-
return this.shadowOffsetXInternal;
|
|
59
|
-
}
|
|
60
|
-
/** Shadow vertical offset in pixels */
|
|
61
|
-
get shadowOffsetY() {
|
|
62
|
-
return this.shadowOffsetYInternal;
|
|
63
|
-
}
|
|
64
|
-
/** Shadow blur radius in pixels */
|
|
65
|
-
get shadowBlur() {
|
|
66
|
-
return this.shadowBlurInternal;
|
|
112
|
+
return this.values.lineHeight;
|
|
67
113
|
}
|
|
68
|
-
/**
|
|
69
|
-
get
|
|
70
|
-
return this.
|
|
114
|
+
/** Outlines from the innermost to the outermost */
|
|
115
|
+
get strokes() {
|
|
116
|
+
return this.values.strokes;
|
|
71
117
|
}
|
|
72
|
-
/**
|
|
73
|
-
get
|
|
74
|
-
return this.
|
|
75
|
-
}
|
|
76
|
-
/** Stroke color */
|
|
77
|
-
get strokeColor() {
|
|
78
|
-
return this.strokeColorInternal;
|
|
79
|
-
}
|
|
80
|
-
/** Stroke thickness in pixels */
|
|
81
|
-
get strokeThickness() {
|
|
82
|
-
return this.strokeThicknessInternal;
|
|
118
|
+
/** Shadows and glows, the first one on top */
|
|
119
|
+
get shadows() {
|
|
120
|
+
return this.values.shadows;
|
|
83
121
|
}
|
|
84
122
|
/**
|
|
85
123
|
* Indicates whether any property has been modified.
|
|
@@ -89,181 +127,98 @@ export class UITextStyle {
|
|
|
89
127
|
get dirty() {
|
|
90
128
|
return this.dirtyInternal;
|
|
91
129
|
}
|
|
130
|
+
/** Color or gradient of the glyphs. A string is a `UIColor` name or a CSS color. */
|
|
92
131
|
set color(value) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
132
|
+
this.setValue("color", value === undefined ? undefined : resolvePaint(value));
|
|
133
|
+
}
|
|
134
|
+
/** Box the gradients of the fill and of the strokes are laid over */
|
|
135
|
+
set paintBox(value) {
|
|
136
|
+
this.setValue("paintBox", value);
|
|
97
137
|
}
|
|
138
|
+
/** Text alignment */
|
|
98
139
|
set align(value) {
|
|
99
|
-
|
|
100
|
-
this.alignInternal = value;
|
|
101
|
-
this.dirtyInternal = true;
|
|
102
|
-
}
|
|
140
|
+
this.setValue("align", value);
|
|
103
141
|
}
|
|
142
|
+
/** Font family name */
|
|
104
143
|
set fontFamily(value) {
|
|
105
|
-
|
|
106
|
-
this.fontFamilyInternal = value;
|
|
107
|
-
this.dirtyInternal = true;
|
|
108
|
-
}
|
|
144
|
+
this.setValue("fontFamily", value);
|
|
109
145
|
}
|
|
146
|
+
/** Font size in pixels */
|
|
110
147
|
set fontSize(value) {
|
|
111
148
|
if (value !== undefined) {
|
|
112
149
|
assertValidPositiveNumber(value, "UITextStyle.fontSize");
|
|
113
150
|
}
|
|
114
|
-
|
|
115
|
-
this.fontSizeInternal = value;
|
|
116
|
-
this.dirtyInternal = true;
|
|
117
|
-
}
|
|
151
|
+
this.setValue("fontSize", value);
|
|
118
152
|
}
|
|
153
|
+
/** Font style */
|
|
119
154
|
set fontStyle(value) {
|
|
120
|
-
|
|
121
|
-
this.fontStyleInternal = value;
|
|
122
|
-
this.dirtyInternal = true;
|
|
123
|
-
}
|
|
155
|
+
this.setValue("fontStyle", value);
|
|
124
156
|
}
|
|
157
|
+
/** Font weight */
|
|
125
158
|
set fontWeight(value) {
|
|
126
159
|
if (typeof value === "number") {
|
|
127
160
|
assertValidPositiveNumber(value, "UITextStyle.fontWeight");
|
|
128
161
|
}
|
|
129
|
-
|
|
130
|
-
this.fontWeightInternal = value;
|
|
131
|
-
this.dirtyInternal = true;
|
|
132
|
-
}
|
|
162
|
+
this.setValue("fontWeight", value);
|
|
133
163
|
}
|
|
164
|
+
/** Line height in pixels, the distance between baselines */
|
|
134
165
|
set lineHeight(value) {
|
|
135
166
|
if (value !== undefined) {
|
|
136
167
|
assertValidNumber(value, "UITextStyle.lineHeight");
|
|
137
168
|
}
|
|
138
|
-
|
|
139
|
-
this.lineHeightInternal = value;
|
|
140
|
-
this.dirtyInternal = true;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
set enableShadow(value) {
|
|
144
|
-
if (value !== this.enableShadowInternal) {
|
|
145
|
-
this.enableShadowInternal = value;
|
|
146
|
-
this.dirtyInternal = true;
|
|
147
|
-
}
|
|
169
|
+
this.setValue("lineHeight", value);
|
|
148
170
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.dirtyInternal = true;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
set shadowOffsetY(value) {
|
|
159
|
-
if (value !== undefined) {
|
|
160
|
-
assertValidNumber(value, "UITextStyle.shadowOffsetY");
|
|
161
|
-
}
|
|
162
|
-
if (value !== this.shadowOffsetYInternal) {
|
|
163
|
-
this.shadowOffsetYInternal = value;
|
|
164
|
-
this.dirtyInternal = true;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
set shadowBlur(value) {
|
|
168
|
-
if (value !== undefined) {
|
|
169
|
-
assertValidNonNegativeNumber(value, "UITextStyle.shadowBlur");
|
|
170
|
-
}
|
|
171
|
-
if (value !== this.shadowBlurInternal) {
|
|
172
|
-
this.shadowBlurInternal = value;
|
|
173
|
-
this.dirtyInternal = true;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
set shadowColor(value) {
|
|
177
|
-
if (value !== this.shadowColorInternal) {
|
|
178
|
-
this.shadowColorInternal = value;
|
|
179
|
-
this.dirtyInternal = true;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
set enableStroke(value) {
|
|
183
|
-
if (value !== this.enableStrokeInternal) {
|
|
184
|
-
this.enableStrokeInternal = value;
|
|
185
|
-
this.dirtyInternal = true;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
set strokeColor(value) {
|
|
189
|
-
if (value !== this.strokeColorInternal) {
|
|
190
|
-
this.strokeColorInternal = value;
|
|
191
|
-
this.dirtyInternal = true;
|
|
192
|
-
}
|
|
171
|
+
/**
|
|
172
|
+
* Outlines from the innermost to the outermost. Each one lies outside the previous one. An
|
|
173
|
+
* empty list draws no outline, undefined takes the outlines of the fallback style.
|
|
174
|
+
*/
|
|
175
|
+
set strokes(value) {
|
|
176
|
+
this.setValue("strokes", value === undefined ? undefined : resolveStrokes(value));
|
|
193
177
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
this.dirtyInternal = true;
|
|
201
|
-
}
|
|
178
|
+
/**
|
|
179
|
+
* Shadows and glows, the first one on top. An empty list draws no shadow, undefined takes the
|
|
180
|
+
* shadows of the fallback style.
|
|
181
|
+
*/
|
|
182
|
+
set shadows(value) {
|
|
183
|
+
this.setValue("shadows", value === undefined ? undefined : resolveShadows(value));
|
|
202
184
|
}
|
|
203
185
|
/**
|
|
204
186
|
* Resolves complete style from primary and fallback sources.
|
|
205
187
|
* @param primary First style to check for each property
|
|
206
188
|
* @param fallback Second style to check if primary is undefined
|
|
207
|
-
* @returns Complete style
|
|
189
|
+
* @returns Complete style, with defaults for what neither defines. The default line height
|
|
190
|
+
* follows the resolved font size.
|
|
191
|
+
* @internal
|
|
208
192
|
*/
|
|
209
193
|
static resolve(primary, fallback) {
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
fontStyle: primary?.fontStyleInternal ?? fallback?.fontStyleInternal ?? TEXT_STYLE_DEFAULT_FONT_STYLE,
|
|
219
|
-
fontWeight: primary?.fontWeightInternal ??
|
|
220
|
-
fallback?.fontWeightInternal ??
|
|
221
|
-
TEXT_STYLE_DEFAULT_FONT_WEIGHT,
|
|
222
|
-
lineHeight: primary?.lineHeightInternal ??
|
|
223
|
-
fallback?.lineHeightInternal ??
|
|
224
|
-
fontSize * TEXT_STYLE_DEFAULT_LINE_HEIGHT,
|
|
225
|
-
enableShadow: primary?.enableShadowInternal ??
|
|
226
|
-
fallback?.enableShadowInternal ??
|
|
227
|
-
TEXT_STYLE_DEFAULT_ENABLE_SHADOW,
|
|
228
|
-
shadowOffsetX: primary?.shadowOffsetXInternal ??
|
|
229
|
-
fallback?.shadowOffsetXInternal ??
|
|
230
|
-
TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X,
|
|
231
|
-
shadowOffsetY: primary?.shadowOffsetYInternal ??
|
|
232
|
-
fallback?.shadowOffsetYInternal ??
|
|
233
|
-
TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y,
|
|
234
|
-
shadowBlur: primary?.shadowBlurInternal ??
|
|
235
|
-
fallback?.shadowBlurInternal ??
|
|
236
|
-
TEXT_STYLE_DEFAULT_SHADOW_BLUR,
|
|
237
|
-
shadowColor: primary?.shadowColorInternal ??
|
|
238
|
-
fallback?.shadowColorInternal ??
|
|
239
|
-
TEXT_STYLE_DEFAULT_SHADOW_COLOR,
|
|
240
|
-
enableStroke: primary?.enableStrokeInternal ??
|
|
241
|
-
fallback?.enableStrokeInternal ??
|
|
242
|
-
TEXT_STYLE_DEFAULT_ENABLE_STROKE,
|
|
243
|
-
strokeColor: primary?.strokeColorInternal ??
|
|
244
|
-
fallback?.strokeColorInternal ??
|
|
245
|
-
TEXT_STYLE_DEFAULT_STROKE_COLOR,
|
|
246
|
-
strokeThickness: primary?.strokeThicknessInternal ??
|
|
247
|
-
fallback?.strokeThicknessInternal ??
|
|
248
|
-
TEXT_STYLE_DEFAULT_STROKE_THICKNESS,
|
|
249
|
-
};
|
|
194
|
+
const resolved = { ...TEXT_STYLE_DEFAULTS };
|
|
195
|
+
for (const key of TEXT_STYLE_KEYS) {
|
|
196
|
+
assignDefined(resolved, key, primary?.values[key] ?? fallback?.values[key]);
|
|
197
|
+
}
|
|
198
|
+
if (primary?.values.lineHeight === undefined && fallback?.values.lineHeight === undefined) {
|
|
199
|
+
resolved.lineHeight = resolved.fontSize * TEXT_STYLE_DEFAULT_LINE_HEIGHT;
|
|
200
|
+
}
|
|
201
|
+
return resolved;
|
|
250
202
|
}
|
|
251
203
|
/**
|
|
252
|
-
* Calculates
|
|
253
|
-
* The
|
|
254
|
-
*
|
|
204
|
+
* Calculates the padding a resolved style needs on every side for its outlines and shadows.
|
|
205
|
+
* The outlines add up outside the glyphs. A shadow is cast by the outlined glyphs and spreads
|
|
206
|
+
* by its offset and about twice its blur radius.
|
|
255
207
|
* @param style Resolved style
|
|
256
|
-
* @returns Padding in pixels
|
|
208
|
+
* @returns Padding in pixels
|
|
209
|
+
* @internal
|
|
257
210
|
*/
|
|
258
211
|
static calculatePadding(style) {
|
|
259
|
-
let
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
212
|
+
let outline = 0;
|
|
213
|
+
for (const stroke of style.strokes) {
|
|
214
|
+
outline += stroke.thickness;
|
|
215
|
+
}
|
|
216
|
+
let shadowSpread = 0;
|
|
217
|
+
for (const shadow of style.shadows) {
|
|
218
|
+
const offset = Math.max(Math.abs(shadow.offsetX), Math.abs(shadow.offsetY));
|
|
219
|
+
shadowSpread = Math.max(shadowSpread, offset + shadow.blur * 2);
|
|
265
220
|
}
|
|
266
|
-
return Math.ceil(
|
|
221
|
+
return Math.ceil(outline + shadowSpread);
|
|
267
222
|
}
|
|
268
223
|
/** @internal */
|
|
269
224
|
setDirtyFalse() {
|
|
@@ -271,117 +226,36 @@ export class UITextStyle {
|
|
|
271
226
|
}
|
|
272
227
|
/** Sets all properties to default values */
|
|
273
228
|
setDefaults() {
|
|
274
|
-
|
|
275
|
-
this.
|
|
276
|
-
this.fontFamilyInternal !== TEXT_STYLE_DEFAULT_FONT_FAMILY ||
|
|
277
|
-
this.fontSizeInternal !== TEXT_STYLE_DEFAULT_FONT_SIZE ||
|
|
278
|
-
this.fontStyleInternal !== TEXT_STYLE_DEFAULT_FONT_STYLE ||
|
|
279
|
-
this.fontWeightInternal !== TEXT_STYLE_DEFAULT_FONT_WEIGHT ||
|
|
280
|
-
this.lineHeightInternal !== TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT ||
|
|
281
|
-
this.enableShadowInternal !== TEXT_STYLE_DEFAULT_ENABLE_SHADOW ||
|
|
282
|
-
this.shadowOffsetXInternal !== TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X ||
|
|
283
|
-
this.shadowOffsetYInternal !== TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y ||
|
|
284
|
-
this.shadowBlurInternal !== TEXT_STYLE_DEFAULT_SHADOW_BLUR ||
|
|
285
|
-
this.shadowColorInternal !== TEXT_STYLE_DEFAULT_SHADOW_COLOR ||
|
|
286
|
-
this.enableStrokeInternal !== TEXT_STYLE_DEFAULT_ENABLE_STROKE ||
|
|
287
|
-
this.strokeColorInternal !== TEXT_STYLE_DEFAULT_STROKE_COLOR ||
|
|
288
|
-
this.strokeThicknessInternal !== TEXT_STYLE_DEFAULT_STROKE_THICKNESS) {
|
|
289
|
-
this.colorInternal = TEXT_STYLE_DEFAULT_COLOR;
|
|
290
|
-
this.alignInternal = TEXT_STYLE_DEFAULT_ALIGN;
|
|
291
|
-
this.fontFamilyInternal = TEXT_STYLE_DEFAULT_FONT_FAMILY;
|
|
292
|
-
this.fontSizeInternal = TEXT_STYLE_DEFAULT_FONT_SIZE;
|
|
293
|
-
this.fontStyleInternal = TEXT_STYLE_DEFAULT_FONT_STYLE;
|
|
294
|
-
this.fontWeightInternal = TEXT_STYLE_DEFAULT_FONT_WEIGHT;
|
|
295
|
-
this.lineHeightInternal = TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT;
|
|
296
|
-
this.enableShadowInternal = TEXT_STYLE_DEFAULT_ENABLE_SHADOW;
|
|
297
|
-
this.shadowOffsetXInternal = TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X;
|
|
298
|
-
this.shadowOffsetYInternal = TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y;
|
|
299
|
-
this.shadowBlurInternal = TEXT_STYLE_DEFAULT_SHADOW_BLUR;
|
|
300
|
-
this.shadowColorInternal = TEXT_STYLE_DEFAULT_SHADOW_COLOR;
|
|
301
|
-
this.enableStrokeInternal = TEXT_STYLE_DEFAULT_ENABLE_STROKE;
|
|
302
|
-
this.strokeColorInternal = TEXT_STYLE_DEFAULT_STROKE_COLOR;
|
|
303
|
-
this.strokeThicknessInternal = TEXT_STYLE_DEFAULT_STROKE_THICKNESS;
|
|
304
|
-
this.dirtyInternal = true;
|
|
229
|
+
for (const key of TEXT_STYLE_KEYS) {
|
|
230
|
+
this.setValue(key, TEXT_STYLE_DEFAULTS[key]);
|
|
305
231
|
}
|
|
306
232
|
}
|
|
307
233
|
/** Sets all properties to undefined */
|
|
308
234
|
clear() {
|
|
309
|
-
|
|
310
|
-
this.
|
|
311
|
-
this.fontFamilyInternal !== undefined ||
|
|
312
|
-
this.fontSizeInternal !== undefined ||
|
|
313
|
-
this.fontStyleInternal !== undefined ||
|
|
314
|
-
this.fontWeightInternal !== undefined ||
|
|
315
|
-
this.lineHeightInternal !== undefined ||
|
|
316
|
-
this.enableShadowInternal !== undefined ||
|
|
317
|
-
this.shadowOffsetXInternal !== undefined ||
|
|
318
|
-
this.shadowOffsetYInternal !== undefined ||
|
|
319
|
-
this.shadowBlurInternal !== undefined ||
|
|
320
|
-
this.shadowColorInternal !== undefined ||
|
|
321
|
-
this.enableStrokeInternal !== undefined ||
|
|
322
|
-
this.strokeColorInternal !== undefined ||
|
|
323
|
-
this.strokeThicknessInternal !== undefined) {
|
|
324
|
-
this.colorInternal = undefined;
|
|
325
|
-
this.alignInternal = undefined;
|
|
326
|
-
this.fontFamilyInternal = undefined;
|
|
327
|
-
this.fontSizeInternal = undefined;
|
|
328
|
-
this.fontStyleInternal = undefined;
|
|
329
|
-
this.fontWeightInternal = undefined;
|
|
330
|
-
this.lineHeightInternal = undefined;
|
|
331
|
-
this.enableShadowInternal = undefined;
|
|
332
|
-
this.shadowOffsetXInternal = undefined;
|
|
333
|
-
this.shadowOffsetYInternal = undefined;
|
|
334
|
-
this.shadowBlurInternal = undefined;
|
|
335
|
-
this.shadowColorInternal = undefined;
|
|
336
|
-
this.enableStrokeInternal = undefined;
|
|
337
|
-
this.strokeColorInternal = undefined;
|
|
338
|
-
this.strokeThicknessInternal = undefined;
|
|
339
|
-
this.dirtyInternal = true;
|
|
235
|
+
for (const key of TEXT_STYLE_KEYS) {
|
|
236
|
+
this.setValue(key, undefined);
|
|
340
237
|
}
|
|
341
238
|
}
|
|
342
239
|
/** Copies from another style instance */
|
|
343
240
|
copy(value) {
|
|
344
|
-
|
|
345
|
-
this.
|
|
346
|
-
this.fontFamilyInternal !== value.fontFamilyInternal ||
|
|
347
|
-
this.fontSizeInternal !== value.fontSizeInternal ||
|
|
348
|
-
this.fontStyleInternal !== value.fontStyleInternal ||
|
|
349
|
-
this.fontWeightInternal !== value.fontWeightInternal ||
|
|
350
|
-
this.lineHeightInternal !== value.lineHeightInternal ||
|
|
351
|
-
this.enableShadowInternal !== value.enableShadowInternal ||
|
|
352
|
-
this.shadowOffsetXInternal !== value.shadowOffsetXInternal ||
|
|
353
|
-
this.shadowOffsetYInternal !== value.shadowOffsetYInternal ||
|
|
354
|
-
this.shadowBlurInternal !== value.shadowBlurInternal ||
|
|
355
|
-
this.shadowColorInternal !== value.shadowColorInternal ||
|
|
356
|
-
this.enableStrokeInternal !== value.enableStrokeInternal ||
|
|
357
|
-
this.strokeColorInternal !== value.strokeColorInternal ||
|
|
358
|
-
this.strokeThicknessInternal !== value.strokeThicknessInternal) {
|
|
359
|
-
this.colorInternal = value.colorInternal;
|
|
360
|
-
this.alignInternal = value.alignInternal;
|
|
361
|
-
this.fontFamilyInternal = value.fontFamilyInternal;
|
|
362
|
-
this.fontSizeInternal = value.fontSizeInternal;
|
|
363
|
-
this.fontStyleInternal = value.fontStyleInternal;
|
|
364
|
-
this.fontWeightInternal = value.fontWeightInternal;
|
|
365
|
-
this.lineHeightInternal = value.lineHeightInternal;
|
|
366
|
-
this.enableShadowInternal = value.enableShadowInternal;
|
|
367
|
-
this.shadowOffsetXInternal = value.shadowOffsetXInternal;
|
|
368
|
-
this.shadowOffsetYInternal = value.shadowOffsetYInternal;
|
|
369
|
-
this.shadowBlurInternal = value.shadowBlurInternal;
|
|
370
|
-
this.shadowColorInternal = value.shadowColorInternal;
|
|
371
|
-
this.enableStrokeInternal = value.enableStrokeInternal;
|
|
372
|
-
this.strokeColorInternal = value.strokeColorInternal;
|
|
373
|
-
this.strokeThicknessInternal = value.strokeThicknessInternal;
|
|
374
|
-
this.dirtyInternal = true;
|
|
241
|
+
for (const key of TEXT_STYLE_KEYS) {
|
|
242
|
+
this.setValue(key, value.values[key]);
|
|
375
243
|
}
|
|
376
244
|
}
|
|
377
245
|
/**
|
|
378
|
-
* Calculates
|
|
246
|
+
* Calculates the padding needed on every side for outlines and shadows.
|
|
379
247
|
* Properties left undefined here are taken from `fallback`, then from defaults,
|
|
380
|
-
* so a span style is measured with the
|
|
248
|
+
* so a span style is measured with the outlines and shadows it is drawn with.
|
|
381
249
|
* @param fallback Style that supplies undefined properties (usually the common style)
|
|
382
|
-
* @returns Padding in pixels
|
|
250
|
+
* @returns Padding in pixels
|
|
383
251
|
*/
|
|
384
252
|
calculatePadding(fallback) {
|
|
385
253
|
return UITextStyle.calculatePadding(UITextStyle.resolve(this, fallback));
|
|
386
254
|
}
|
|
255
|
+
setValue(key, value) {
|
|
256
|
+
if (this.values[key] !== value) {
|
|
257
|
+
this.values[key] = value;
|
|
258
|
+
this.dirtyInternal = true;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
387
261
|
}
|
|
@@ -3,7 +3,8 @@ export declare const TEXTURE_DEFAULT_TEXTURE: Texture;
|
|
|
3
3
|
export declare const TEXTURE_DEFAULT_SIZE = 2;
|
|
4
4
|
/**
|
|
5
5
|
* Reads the pixel size of a texture image: an image, a video, a canvas, a bitmap
|
|
6
|
-
* or the data of a DataTexture.
|
|
6
|
+
* or the data of a DataTexture. An image or video that is not loaded yet reports 0, which is
|
|
7
|
+
* taken as unknown.
|
|
7
8
|
* @param texture Texture to measure
|
|
8
9
|
* @returns Width and height in pixels
|
|
9
10
|
*/
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { Texture } from "three";
|
|
2
2
|
export const TEXTURE_DEFAULT_TEXTURE = new Texture();
|
|
3
3
|
export const TEXTURE_DEFAULT_SIZE = 2;
|
|
4
|
+
/**
|
|
5
|
+
* First of the sizes that is known, that is, positive.
|
|
6
|
+
* @param sizes Candidate sizes in order of preference
|
|
7
|
+
* @returns The size, or the default size when none is known
|
|
8
|
+
*/
|
|
9
|
+
function firstKnownSize(...sizes) {
|
|
10
|
+
return sizes.find((size) => size !== undefined && size > 0) ?? TEXTURE_DEFAULT_SIZE;
|
|
11
|
+
}
|
|
4
12
|
/**
|
|
5
13
|
* Reads the pixel size of a texture image: an image, a video, a canvas, a bitmap
|
|
6
|
-
* or the data of a DataTexture.
|
|
14
|
+
* or the data of a DataTexture. An image or video that is not loaded yet reports 0, which is
|
|
15
|
+
* taken as unknown.
|
|
7
16
|
* @param texture Texture to measure
|
|
8
17
|
* @returns Width and height in pixels
|
|
9
18
|
*/
|
|
10
19
|
export function getTextureImageSize(texture) {
|
|
11
20
|
const image = texture.image;
|
|
12
21
|
return {
|
|
13
|
-
w: image?.naturalWidth
|
|
14
|
-
h: image?.naturalHeight
|
|
22
|
+
w: firstKnownSize(image?.naturalWidth, image?.videoWidth, image?.width),
|
|
23
|
+
h: firstKnownSize(image?.naturalHeight, image?.videoHeight, image?.height),
|
|
15
24
|
};
|
|
16
25
|
}
|
|
@@ -3,8 +3,7 @@ float calculateMask() {
|
|
|
3
3
|
float aspect = p_textureResolution.x / p_textureResolution.y;
|
|
4
4
|
vec2 p = (p_uv - 0.5) * vec2(aspect, 1.0);
|
|
5
5
|
|
|
6
|
-
float angle = atan(p.y, p.x);
|
|
7
|
-
angle = (angle + PI) / (2.0 * PI);
|
|
6
|
+
float angle = atan(p.y, p.x) / (2.0 * PI);
|
|
8
7
|
|
|
9
8
|
float adjusted = angle - p_startAngle;
|
|
10
9
|
adjusted = p_direction > 0.0 ? adjusted : -adjusted;
|
|
@@ -10,8 +10,12 @@ export interface UIInputCatcherCallbacks {
|
|
|
10
10
|
catchPointerDown: (x: number, y: number, identifier: number) => boolean;
|
|
11
11
|
/** Returns true to stop the event for catchers below; ignored for a captured pointer */
|
|
12
12
|
catchPointerMove: (x: number, y: number, identifier: number) => boolean;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Returns true to stop the event for catchers below; ignored for a captured pointer.
|
|
15
|
+
* `hovering` is true for a pointer that stays over the page after the release, as a mouse
|
|
16
|
+
* does: its next events come with the same identifier.
|
|
17
|
+
*/
|
|
18
|
+
catchPointerUp: (x: number, y: number, identifier: number, hovering: boolean) => boolean;
|
|
15
19
|
/**
|
|
16
20
|
* The pointer is gone for this catcher: drop what is known of it. Called when a pressed
|
|
17
21
|
* pointer is cancelled (by the browser or by the layer), on the catcher that captured it, or
|
|
@@ -23,7 +27,7 @@ export interface UIInputCatcherCallbacks {
|
|
|
23
27
|
catchPointerCancel: (identifier: number) => void;
|
|
24
28
|
}
|
|
25
29
|
export interface UIInputWrapperView {
|
|
26
|
-
/** Bumped by every change to the draw order
|
|
30
|
+
/** Bumped by every change to the draw order, to compare with a value seen before */
|
|
27
31
|
readonly version: number;
|
|
28
32
|
createInputCatcher(callbacks: UIInputCatcherCallbacks, zIndex: number): number;
|
|
29
33
|
destroyInputCatcher(handler: number): void;
|
|
@@ -8,7 +8,7 @@ export declare class UIInputWrapper implements UIInputWrapperView {
|
|
|
8
8
|
/** Pointers seen moving while not pressed, such as a hovering mouse */
|
|
9
9
|
private readonly hoveringPointers;
|
|
10
10
|
private lastHandler;
|
|
11
|
-
/** Bumped by every change to the draw order
|
|
11
|
+
/** Bumped by every change to the draw order, to compare with a value seen before */
|
|
12
12
|
get version(): number;
|
|
13
13
|
createInputCatcher(callbacks: UIInputCatcherCallbacks, zIndex: number): number;
|
|
14
14
|
destroyInputCatcher(handler: number): void;
|
|
@@ -20,6 +20,7 @@ export declare class UIInputWrapper implements UIInputWrapperView {
|
|
|
20
20
|
/**
|
|
21
21
|
* Passes a pointer event from the top catcher down until one catches it. A handler may
|
|
22
22
|
* destroy elements, so the catchers are walked over a copy and a destroyed one is skipped.
|
|
23
|
+
* @param catchEvent Passes the event to a catcher; true if it caught it
|
|
23
24
|
* @param pointer Pressed pointer the event belongs to: the walk stops once a handler ends it
|
|
24
25
|
* @returns The catcher that caught the event, or null
|
|
25
26
|
*/
|