laymur 0.25.2 → 0.27.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 +114 -34
- package/dist/core/constraints/UICustomConstraint.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +1 -1
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +1 -1
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +2 -3
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +2 -2
- package/dist/core/elements/UIAnchor/UIAnchor.js +3 -2
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +2 -2
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +24 -12
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +13 -0
- package/dist/core/elements/UIDummy/UIDummy.d.ts +74 -5
- package/dist/core/elements/UIDummy/UIDummy.js +222 -29
- package/dist/core/elements/UIElement/UIElement.Internal.d.ts +1 -1
- package/dist/core/elements/UIElement/UIElement.d.ts +37 -1
- package/dist/core/elements/UIElement/UIElement.js +84 -6
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +1 -1
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +1 -1
- package/dist/core/elements/UIGraphics/UIGraphics.js +4 -4
- package/dist/core/elements/UIImage/UIImage.d.ts +2 -2
- package/dist/core/elements/UIImage/UIImage.js +10 -8
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +4 -4
- package/dist/core/elements/UINineSlice/UINineSlice.js +11 -9
- package/dist/core/elements/UIProgress/UIProgress.d.ts +2 -2
- package/dist/core/elements/UIProgress/UIProgress.js +17 -15
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +1 -1
- package/dist/core/elements/UIScene/UIScene.d.ts +3 -2
- package/dist/core/elements/UIScene/UIScene.js +21 -14
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +1 -1
- package/dist/core/elements/UIText/UIText.d.ts +3 -3
- package/dist/core/elements/UIText/UIText.js +8 -8
- package/dist/core/index.d.ts +60 -11
- package/dist/core/index.js +22 -7
- package/dist/core/layers/UILayer/UILayer.d.ts +45 -5
- package/dist/core/layers/UILayer/UILayer.js +103 -10
- package/dist/core/layers/UIViewportLayer/UIViewportLayer.Internal.d.ts +27 -0
- package/dist/core/layers/{UIFullscreenLayer/UIFullscreenLayer.Internal.js → UIViewportLayer/UIViewportLayer.Internal.js} +1 -1
- package/dist/core/layers/UIViewportLayer/UIViewportLayer.d.ts +98 -0
- package/dist/core/layers/UIViewportLayer/UIViewportLayer.js +251 -0
- package/dist/core/miscellaneous/UIAffineMatrix3.d.ts +13 -0
- package/dist/core/miscellaneous/UIAffineMatrix3.js +13 -0
- package/dist/core/miscellaneous/area/UIArea.d.ts +10 -1
- package/dist/core/miscellaneous/area/UIArea.js +4 -1
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.js +0 -1
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +1 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +0 -1
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +0 -1
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +0 -1
- package/dist/core/miscellaneous/asserts.d.ts +23 -0
- package/dist/core/miscellaneous/asserts.js +44 -0
- package/dist/core/miscellaneous/canvas.js +7 -2
- package/dist/core/miscellaneous/color/UIColor.js +5 -2
- package/dist/core/miscellaneous/computeTransform.d.ts +12 -0
- package/dist/core/miscellaneous/computeTransform.js +20 -0
- package/dist/core/miscellaneous/context-monitor/UIContextMonitor.d.ts +1 -0
- package/dist/core/miscellaneous/context-monitor/UIContextMonitor.js +60 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +17 -3
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +88 -26
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.d.ts +9 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.js +29 -6
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +51 -11
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +2 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +47 -6
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +15 -3
- package/dist/core/miscellaneous/generic-plane/shared.js +38 -7
- package/dist/core/miscellaneous/generic-plane/varyingPacking.d.ts +46 -0
- package/dist/core/miscellaneous/generic-plane/varyingPacking.js +170 -0
- package/dist/core/miscellaneous/mask/UIMask.Internal.d.ts +61 -0
- package/dist/core/miscellaneous/mask/UIMask.Internal.js +56 -0
- package/dist/core/miscellaneous/mask/UIMask.d.ts +84 -0
- package/dist/core/miscellaneous/mask/UIMask.js +265 -0
- package/dist/core/miscellaneous/mask/UIMaskMaterialPatch.d.ts +50 -0
- package/dist/core/miscellaneous/mask/UIMaskMaterialPatch.js +233 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +10 -1
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +7 -1
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +2 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +0 -1
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +0 -1
- package/dist/core/miscellaneous/micro/UIMicro.Internal.d.ts +3 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +1 -0
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +18 -1
- package/dist/core/miscellaneous/micro/UIMicro.js +23 -2
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.d.ts +19 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +16 -3
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +2 -2
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +2 -2
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +2 -2
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +2 -2
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +2 -2
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +2 -2
- package/dist/core/miscellaneous/text-style/UITextStyle.js +2 -2
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +6 -2
- package/dist/core/miscellaneous/texture/UITextureView.js +13 -9
- package/dist/core/miscellaneous/viewport/UIElementViewport.d.ts +31 -0
- package/dist/core/miscellaneous/viewport/UIElementViewport.js +54 -0
- package/dist/core/miscellaneous/viewport/UIViewport.d.ts +37 -0
- package/dist/core/miscellaneous/viewport/UIViewport.js +31 -0
- package/dist/core/miscellaneous/viewport/UIWindowViewport.d.ts +13 -0
- package/dist/core/miscellaneous/viewport/UIWindowViewport.js +25 -0
- package/dist/core/miscellaneous/webglCapabilities.js +61 -55
- package/dist/core/shaders/UIMask.d.ts +15 -0
- package/dist/core/shaders/UIMask.js +45 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +36 -5
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +23 -2
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +153 -15
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +3 -1
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +1 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +3 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +2 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +3 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +36 -16
- package/dist/debug/UIAspectDebug.js +4 -0
- package/dist/debug/UIHeightDebug.js +4 -0
- package/dist/debug/UIHorizontalDistanceDebug.js +5 -0
- package/dist/debug/UIHorizontalInterpolationDebug.js +5 -0
- package/dist/debug/UILayerDebug.d.ts +7 -0
- package/dist/debug/UILayerDebug.js +21 -0
- package/dist/debug/UIVerticalDistanceDebug.js +5 -0
- package/dist/debug/UIVerticalInterpolationDebug.js +5 -0
- package/dist/debug/UIWidthDebug.js +4 -0
- package/dist/debug/index.d.ts +2 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +8 -1
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +0 -2
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +12 -2
- package/dist/particles/behaviorModules/UIBehaviorModule.js +2 -1
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +8 -1
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +13 -12
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +7 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +6 -6
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +7 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +4 -5
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +8 -1
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +8 -10
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +10 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +8 -7
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +7 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +8 -10
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +13 -4
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +12 -10
- package/dist/particles/elements/UIEmitter.Internal.d.ts +21 -1
- package/dist/particles/elements/UIEmitter.Internal.js +6 -0
- package/dist/particles/elements/UIEmitter.d.ts +20 -11
- package/dist/particles/elements/UIEmitter.js +100 -54
- package/dist/particles/index.d.ts +7 -1
- package/dist/particles/index.js +4 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +19 -4
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +117 -83
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +8 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.js +41 -4
- package/dist/particles/miscellaneous/miscellaneous.d.ts +34 -0
- package/dist/particles/miscellaneous/miscellaneous.js +72 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +4 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +2 -4
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +4 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +2 -5
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +11 -1
- package/dist/particles/renderingModules/UIRenderingModule.js +4 -1
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +4 -0
- package/dist/particles/renderingModules/UIRenderingTexture.js +2 -1
- package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +1 -2
- package/dist/particles/shaders/UIRenderingColorOverLife.js +5 -3
- package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +1 -9
- package/dist/particles/shaders/UIRenderingColorOverVelocity.js +6 -13
- package/dist/particles/spawnModules/UISpawnModule.d.ts +16 -1
- package/dist/particles/spawnModules/UISpawnModule.js +3 -1
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +7 -0
- package/dist/particles/spawnModules/UISpawnOffset.js +0 -2
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +8 -1
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +5 -7
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +7 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +5 -5
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +7 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.js +4 -5
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +7 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +5 -5
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +7 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +6 -6
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +7 -0
- package/dist/particles/spawnModules/UISpawnRectangle.js +6 -6
- package/package.json +13 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +0 -21
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -63
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +0 -144
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
export class UIInputWrapper {
|
|
2
2
|
constructor() {
|
|
3
|
-
|
|
4
|
-
this.dirty = false;
|
|
3
|
+
this.versionInternal = 0;
|
|
5
4
|
this.zIndicesDirty = false;
|
|
6
5
|
this.catchers = [];
|
|
6
|
+
/** Pressed pointers: the input wrapper is the one place that knows of them */
|
|
7
|
+
this.pointers = new Map();
|
|
8
|
+
/** Pointers seen moving while not pressed, such as a hovering mouse */
|
|
9
|
+
this.hoveringPointers = new Set();
|
|
7
10
|
this.lastHandler = 0;
|
|
8
11
|
}
|
|
9
|
-
|
|
12
|
+
/** Bumped by every change to the draw order; compare with the last seen value */
|
|
13
|
+
get version() {
|
|
14
|
+
return this.versionInternal;
|
|
15
|
+
}
|
|
16
|
+
createInputCatcher(callbacks, zIndex) {
|
|
10
17
|
const handler = this.lastHandler++;
|
|
11
18
|
this.catchers.push({
|
|
12
19
|
handler,
|
|
13
|
-
catchPointerDown,
|
|
14
|
-
catchPointerMove,
|
|
15
|
-
catchPointerUp,
|
|
20
|
+
catchPointerDown: callbacks.catchPointerDown,
|
|
21
|
+
catchPointerMove: callbacks.catchPointerMove,
|
|
22
|
+
catchPointerUp: callbacks.catchPointerUp,
|
|
23
|
+
catchPointerCancel: callbacks.catchPointerCancel,
|
|
16
24
|
zIndex,
|
|
17
25
|
depth: 0,
|
|
18
26
|
active: true,
|
|
19
27
|
});
|
|
20
28
|
this.zIndicesDirty = true;
|
|
21
|
-
this.
|
|
29
|
+
this.versionInternal++;
|
|
22
30
|
return handler;
|
|
23
31
|
}
|
|
24
32
|
destroyInputCatcher(handler) {
|
|
@@ -27,9 +35,10 @@ export class UIInputWrapper {
|
|
|
27
35
|
throw new Error(`UIInputWrapper.destroyInputCatcher.handler: handler ${handler} not found; its element may be destroyed`);
|
|
28
36
|
}
|
|
29
37
|
this.catchers[index].active = false;
|
|
38
|
+
this.releaseCaptures(this.catchers[index]);
|
|
30
39
|
this.catchers.splice(index, 1);
|
|
31
40
|
this.zIndicesDirty = true;
|
|
32
|
-
this.
|
|
41
|
+
this.versionInternal++;
|
|
33
42
|
}
|
|
34
43
|
getZIndex(handler) {
|
|
35
44
|
const found = this.catchers.find((item) => item.handler === handler);
|
|
@@ -54,7 +63,7 @@ export class UIInputWrapper {
|
|
|
54
63
|
if (found.zIndex !== zIndex) {
|
|
55
64
|
found.zIndex = zIndex;
|
|
56
65
|
this.zIndicesDirty = true;
|
|
57
|
-
this.
|
|
66
|
+
this.versionInternal++;
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
getActive(handler) {
|
|
@@ -71,37 +80,162 @@ export class UIInputWrapper {
|
|
|
71
80
|
}
|
|
72
81
|
if (found.active !== active) {
|
|
73
82
|
found.active = active;
|
|
83
|
+
if (!active) {
|
|
84
|
+
this.releaseCaptures(found);
|
|
85
|
+
}
|
|
74
86
|
}
|
|
75
87
|
}
|
|
76
88
|
/** @internal */
|
|
77
89
|
onPointerDown(x, y, identifier) {
|
|
78
|
-
|
|
90
|
+
// Pressed again without a release seen, as when released outside the page: the old press
|
|
91
|
+
// ends as cancelled
|
|
92
|
+
if (this.pointers.get(identifier)?.catcher) {
|
|
93
|
+
this.onPointerCancel(identifier);
|
|
94
|
+
}
|
|
95
|
+
// Known before the dispatch, so that a handler cancelling the pointers of the layer cancels
|
|
96
|
+
// this one too
|
|
97
|
+
this.hoveringPointers.delete(identifier);
|
|
98
|
+
const pointer = { catcher: null, x, y };
|
|
99
|
+
this.pointers.set(identifier, pointer);
|
|
100
|
+
const caught = this.dispatch(x, y, identifier, "catchPointerDown", pointer);
|
|
101
|
+
if (this.pointers.get(identifier) !== pointer) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// A handler may have deactivated or destroyed the catcher
|
|
105
|
+
const catcher = caught?.active === true ? caught : null;
|
|
106
|
+
pointer.catcher = catcher;
|
|
107
|
+
if (catcher !== null) {
|
|
108
|
+
// Catchers above that saw the press without catching it would never see the pointer
|
|
109
|
+
// again: for them it is gone
|
|
110
|
+
this.broadcastCancel(identifier, catcher);
|
|
111
|
+
}
|
|
79
112
|
}
|
|
80
113
|
/** @internal */
|
|
81
114
|
onPointerMove(x, y, identifier) {
|
|
82
|
-
this.
|
|
115
|
+
const pointer = this.pointers.get(identifier);
|
|
116
|
+
if (pointer !== undefined) {
|
|
117
|
+
pointer.x = x;
|
|
118
|
+
pointer.y = y;
|
|
119
|
+
}
|
|
120
|
+
if (pointer?.catcher) {
|
|
121
|
+
pointer.catcher.catchPointerMove(x, y, identifier);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (pointer === undefined) {
|
|
125
|
+
this.hoveringPointers.add(identifier);
|
|
126
|
+
}
|
|
127
|
+
this.cancelBelow(identifier, this.dispatch(x, y, identifier, "catchPointerMove"));
|
|
83
128
|
}
|
|
84
129
|
/** @internal */
|
|
85
130
|
onPointerUp(x, y, identifier) {
|
|
86
|
-
this.
|
|
131
|
+
const pointer = this.pointers.get(identifier);
|
|
132
|
+
this.pointers.delete(identifier);
|
|
133
|
+
this.hoveringPointers.delete(identifier);
|
|
134
|
+
if (pointer?.catcher) {
|
|
135
|
+
pointer.catcher.catchPointerUp(x, y, identifier);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this.cancelBelow(identifier, this.dispatch(x, y, identifier, "catchPointerUp"));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A captured pointer is cancelled at its catcher. Any other one goes to every active catcher,
|
|
142
|
+
* top one first: the browser cancels a pointer for its own reasons (a system gesture,
|
|
143
|
+
* scrolling, a popup) and reports no useful position, so there is no hit test, and each
|
|
144
|
+
* catcher that tracks the pointer has to drop it.
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
onPointerCancel(identifier) {
|
|
148
|
+
const pointer = this.pointers.get(identifier);
|
|
149
|
+
this.pointers.delete(identifier);
|
|
150
|
+
this.hoveringPointers.delete(identifier);
|
|
151
|
+
if (pointer?.catcher) {
|
|
152
|
+
pointer.catcher.catchPointerCancel(identifier);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.broadcastCancel(identifier, null);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Cancels every pressed pointer, for a layer that will not see their releases: it stops
|
|
159
|
+
* taking input, or the page is hidden. Hovering pointers leave the catchers too.
|
|
160
|
+
* @param onCancel Called for each pressed pointer before the catchers are, with its last
|
|
161
|
+
* position
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
cancelPointers(onCancel) {
|
|
165
|
+
for (const [identifier, pointer] of [...this.pointers]) {
|
|
166
|
+
// A handler may have ended the pointer already
|
|
167
|
+
if (this.pointers.get(identifier) === pointer) {
|
|
168
|
+
onCancel(pointer.x, pointer.y, identifier);
|
|
169
|
+
this.onPointerCancel(identifier);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
for (const identifier of [...this.hoveringPointers]) {
|
|
173
|
+
this.onPointerCancel(identifier);
|
|
174
|
+
}
|
|
87
175
|
}
|
|
88
176
|
/**
|
|
89
177
|
* Passes a pointer event from the top catcher down until one catches it. A handler may
|
|
90
178
|
* destroy elements, so the catchers are walked over a copy and a destroyed one is skipped.
|
|
179
|
+
* @param pointer Pressed pointer the event belongs to: the walk stops once a handler ends it
|
|
180
|
+
* @returns The catcher that caught the event, or null
|
|
91
181
|
*/
|
|
92
|
-
dispatch(x, y, identifier, name) {
|
|
182
|
+
dispatch(x, y, identifier, name, pointer) {
|
|
93
183
|
this.ensureSorted();
|
|
94
184
|
const catchers = this.catchers.slice();
|
|
95
185
|
for (let index = catchers.length - 1; index >= 0; index--) {
|
|
186
|
+
if (pointer !== undefined && this.pointers.get(identifier) !== pointer) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
96
189
|
const item = catchers[index];
|
|
97
190
|
if (item.active && item[name](x, y, identifier)) {
|
|
98
|
-
|
|
191
|
+
return item;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Passes a cancel to the active catchers below one that caught an event: they did not see it,
|
|
198
|
+
* and the pointer is over the catcher above them now, or released
|
|
199
|
+
*/
|
|
200
|
+
cancelBelow(identifier, caught) {
|
|
201
|
+
if (caught === null) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
// By draw order rather than by position in the list: a handler may have destroyed the
|
|
205
|
+
// catcher that caught the event
|
|
206
|
+
const catchers = this.catchers.slice();
|
|
207
|
+
for (let index = catchers.length - 1; index >= 0; index--) {
|
|
208
|
+
const item = catchers[index];
|
|
209
|
+
if (item.active && compareCatchers(item, caught) < 0) {
|
|
210
|
+
item.catchPointerCancel(identifier);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/** Passes a cancel to every active catcher but one, top one first */
|
|
215
|
+
broadcastCancel(identifier, except) {
|
|
216
|
+
this.ensureSorted();
|
|
217
|
+
const catchers = this.catchers.slice();
|
|
218
|
+
for (let index = catchers.length - 1; index >= 0; index--) {
|
|
219
|
+
const item = catchers[index];
|
|
220
|
+
if (item.active && item !== except) {
|
|
221
|
+
item.catchPointerCancel(identifier);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Frees the pointers held by a catcher that stops taking input; it resets its own state. The
|
|
227
|
+
* pointers stay pressed, for the layer, with no catcher.
|
|
228
|
+
*/
|
|
229
|
+
releaseCaptures(catcher) {
|
|
230
|
+
for (const pointer of this.pointers.values()) {
|
|
231
|
+
if (pointer.catcher === catcher) {
|
|
232
|
+
pointer.catcher = null;
|
|
99
233
|
}
|
|
100
234
|
}
|
|
101
235
|
}
|
|
102
236
|
ensureSorted() {
|
|
103
237
|
if (this.zIndicesDirty) {
|
|
104
|
-
this.catchers.sort(
|
|
238
|
+
this.catchers.sort(compareCatchers);
|
|
105
239
|
const count = this.catchers.length;
|
|
106
240
|
const step = count < 1024 ? 1 : 1024 / count;
|
|
107
241
|
for (let index = 0; index < count; index++) {
|
|
@@ -111,3 +245,7 @@ export class UIInputWrapper {
|
|
|
111
245
|
}
|
|
112
246
|
}
|
|
113
247
|
}
|
|
248
|
+
/** Draw order of catchers, bottom first: by zIndex, then by creation */
|
|
249
|
+
function compareCatchers(a, b) {
|
|
250
|
+
return a.zIndex - b.zIndex || a.handler - b.handler;
|
|
251
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Matrix4, Object3D } from "three";
|
|
2
|
-
import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode.js";
|
|
3
2
|
import type { HSLAdjustment, UIProperty } from "../../miscellaneous/generic-plane/shared.js";
|
|
3
|
+
import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode.js";
|
|
4
4
|
export interface UISceneWrapperView {
|
|
5
5
|
createPlane(source: string, properties: Record<string, UIProperty>, transform: Matrix4, visibility: boolean, transparency: UITransparencyMode, blend: number, hsl: HSLAdjustment): number;
|
|
6
6
|
destroyPlane(handler: number): void;
|
|
@@ -10,6 +10,8 @@ export interface UISceneWrapperView {
|
|
|
10
10
|
setTransparency(handler: number, transparency: UITransparencyMode): void;
|
|
11
11
|
setBlend(handler: number, blend: number): void;
|
|
12
12
|
setHSL(handler: number, hsl: HSLAdjustment): void;
|
|
13
|
+
/** Packed mask data (see UIMask.Internal.ts) or null to remove the mask */
|
|
14
|
+
setMask(handler: number, mask: Readonly<Float32Array> | null): void;
|
|
13
15
|
insertOrderedObject(object: Object3D, depth: number): void;
|
|
14
16
|
setOrderedObjectDepth(object: Object3D, depth: number): void;
|
|
15
17
|
removeOrderedObject(object: Object3D): void;
|
|
@@ -15,6 +15,7 @@ export declare class UISceneWrapper implements UISceneWrapperView {
|
|
|
15
15
|
setTransparency(handler: number, transparency: UITransparencyMode): void;
|
|
16
16
|
setBlend(handler: number, blend: number): void;
|
|
17
17
|
setHSL(handler: number, hsl: HSLAdjustment): void;
|
|
18
|
+
setMask(handler: number, mask: Readonly<Float32Array> | null): void;
|
|
18
19
|
/** Adds an object drawn between planes by depth, on the same scale as plane zIndex */
|
|
19
20
|
insertOrderedObject(object: Object3D, depth: number): this;
|
|
20
21
|
/** Moves an ordered object to the given depth */
|
|
@@ -38,6 +38,9 @@ export class UISceneWrapper {
|
|
|
38
38
|
setHSL(handler, hsl) {
|
|
39
39
|
this.planeRegistry.setHSL(handler, hsl);
|
|
40
40
|
}
|
|
41
|
+
setMask(handler, mask) {
|
|
42
|
+
this.planeRegistry.setMask(handler, mask);
|
|
43
|
+
}
|
|
41
44
|
/** Adds an object drawn between planes by depth, on the same scale as plane zIndex */
|
|
42
45
|
insertOrderedObject(object, depth) {
|
|
43
46
|
this.planeRegistry.insertOrderedObject(object, depth);
|
|
@@ -3,6 +3,8 @@ import type { UIExpression } from "../../miscellaneous/UIExpression.js";
|
|
|
3
3
|
import type { UIPriority } from "../../miscellaneous/UIPriority.js";
|
|
4
4
|
import type { UIRelation } from "../../miscellaneous/UIRelation.js";
|
|
5
5
|
export interface UISolverWrapperView {
|
|
6
|
+
/** Bumped by every change to the variables or constraints; compare with the last seen value */
|
|
7
|
+
readonly version: number;
|
|
6
8
|
createVariable(value: number, priority: UIPriority): number;
|
|
7
9
|
removeVariable(index: number): void;
|
|
8
10
|
hasVariable(index: number): boolean;
|
|
@@ -23,6 +23,7 @@ import type { UISolverWrapperView } from "./UISolverWrapper.Internal.js";
|
|
|
23
23
|
* @see {@link UIRelation} - Relational operators for constraints
|
|
24
24
|
*/
|
|
25
25
|
export declare class UISolverWrapper implements UISolverWrapperView {
|
|
26
|
+
private versionInternal;
|
|
26
27
|
/** The underlying Kiwi solver instance, undefined when solver needs rebuilding. */
|
|
27
28
|
private solver?;
|
|
28
29
|
/** Flag indicating whether variable values need recalculation. */
|
|
@@ -35,6 +36,8 @@ export declare class UISolverWrapper implements UISolverWrapperView {
|
|
|
35
36
|
private readonly constraints;
|
|
36
37
|
/** Counter for generating unique constraint indices. */
|
|
37
38
|
private lastConstraintIndex;
|
|
39
|
+
/** Bumped by every change to the variables or constraints; compare with the last seen value */
|
|
40
|
+
get version(): number;
|
|
38
41
|
/**
|
|
39
42
|
* Creates a new solver variable with the specified value and priority.
|
|
40
43
|
*
|
|
@@ -24,8 +24,7 @@ import { convertRelation, UIRelation } from "../../miscellaneous/UIRelation.js";
|
|
|
24
24
|
*/
|
|
25
25
|
export class UISolverWrapper {
|
|
26
26
|
constructor() {
|
|
27
|
-
|
|
28
|
-
this.dirty = false;
|
|
27
|
+
this.versionInternal = 0;
|
|
29
28
|
/** The underlying Kiwi solver instance, undefined when solver needs rebuilding. */
|
|
30
29
|
this.solver = new Solver();
|
|
31
30
|
/** Flag indicating whether variable values need recalculation. */
|
|
@@ -39,6 +38,10 @@ export class UISolverWrapper {
|
|
|
39
38
|
/** Counter for generating unique constraint indices. */
|
|
40
39
|
this.lastConstraintIndex = 0;
|
|
41
40
|
}
|
|
41
|
+
/** Bumped by every change to the variables or constraints; compare with the last seen value */
|
|
42
|
+
get version() {
|
|
43
|
+
return this.versionInternal;
|
|
44
|
+
}
|
|
42
45
|
/**
|
|
43
46
|
* Creates a new solver variable with the specified value and priority.
|
|
44
47
|
*
|
|
@@ -75,7 +78,7 @@ export class UISolverWrapper {
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
this.recalculationRequired = true;
|
|
78
|
-
this.
|
|
81
|
+
this.versionInternal++;
|
|
79
82
|
return index;
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
@@ -107,7 +110,7 @@ export class UISolverWrapper {
|
|
|
107
110
|
}
|
|
108
111
|
this.variables.delete(index);
|
|
109
112
|
this.recalculationRequired = true;
|
|
110
|
-
this.
|
|
113
|
+
this.versionInternal++;
|
|
111
114
|
}
|
|
112
115
|
/**
|
|
113
116
|
* Checks whether a variable exists.
|
|
@@ -143,7 +146,7 @@ export class UISolverWrapper {
|
|
|
143
146
|
this.solver?.suggestValue(description.variable, value);
|
|
144
147
|
}
|
|
145
148
|
this.recalculationRequired = true;
|
|
146
|
-
this.
|
|
149
|
+
this.versionInternal++;
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
/**
|
|
@@ -165,6 +168,14 @@ export class UISolverWrapper {
|
|
|
165
168
|
if (priority !== description.priority) {
|
|
166
169
|
description.priority = priority;
|
|
167
170
|
if (description.priority === UIPriority.P0) {
|
|
171
|
+
try {
|
|
172
|
+
if (this.solver?.hasEditVariable(description.variable) === true) {
|
|
173
|
+
this.solver.removeEditVariable(description.variable);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
this.solver = undefined;
|
|
178
|
+
}
|
|
168
179
|
const lhs = new UIExpression().plus(index, 1);
|
|
169
180
|
const rhs = new UIExpression(description.value);
|
|
170
181
|
description.constraint = this.buildConstraint(lhs, rhs, UIRelation.EQUAL, description.priority);
|
|
@@ -188,7 +199,7 @@ export class UISolverWrapper {
|
|
|
188
199
|
this.rebuildVariable(index, description);
|
|
189
200
|
}
|
|
190
201
|
this.recalculationRequired = true;
|
|
191
|
-
this.
|
|
202
|
+
this.versionInternal++;
|
|
192
203
|
}
|
|
193
204
|
}
|
|
194
205
|
/**
|
|
@@ -247,7 +258,7 @@ export class UISolverWrapper {
|
|
|
247
258
|
this.solver = undefined;
|
|
248
259
|
}
|
|
249
260
|
this.recalculationRequired = true;
|
|
250
|
-
this.
|
|
261
|
+
this.versionInternal++;
|
|
251
262
|
}
|
|
252
263
|
return index;
|
|
253
264
|
}
|
|
@@ -275,7 +286,7 @@ export class UISolverWrapper {
|
|
|
275
286
|
}
|
|
276
287
|
this.constraints.delete(index);
|
|
277
288
|
this.recalculationRequired = true;
|
|
278
|
-
this.
|
|
289
|
+
this.versionInternal++;
|
|
279
290
|
}
|
|
280
291
|
/**
|
|
281
292
|
* Checks whether a constraint references a variable in either of its expressions.
|
|
@@ -310,7 +321,7 @@ export class UISolverWrapper {
|
|
|
310
321
|
description.lhs.copy(lhs);
|
|
311
322
|
this.rebuildConstraintByDescription(description);
|
|
312
323
|
this.recalculationRequired = true;
|
|
313
|
-
this.
|
|
324
|
+
this.versionInternal++;
|
|
314
325
|
}
|
|
315
326
|
/**
|
|
316
327
|
* Updates the right-hand side expression of an existing constraint.
|
|
@@ -330,7 +341,7 @@ export class UISolverWrapper {
|
|
|
330
341
|
description.rhs.copy(rhs);
|
|
331
342
|
this.rebuildConstraintByDescription(description);
|
|
332
343
|
this.recalculationRequired = true;
|
|
333
|
-
this.
|
|
344
|
+
this.versionInternal++;
|
|
334
345
|
}
|
|
335
346
|
/**
|
|
336
347
|
* Updates the relational operator of an existing constraint.
|
|
@@ -351,7 +362,7 @@ export class UISolverWrapper {
|
|
|
351
362
|
description.relation = relation;
|
|
352
363
|
this.rebuildConstraintByDescription(description);
|
|
353
364
|
this.recalculationRequired = true;
|
|
354
|
-
this.
|
|
365
|
+
this.versionInternal++;
|
|
355
366
|
}
|
|
356
367
|
}
|
|
357
368
|
/**
|
|
@@ -373,7 +384,7 @@ export class UISolverWrapper {
|
|
|
373
384
|
description.priority = priority;
|
|
374
385
|
this.rebuildConstraintByDescription(description);
|
|
375
386
|
this.recalculationRequired = true;
|
|
376
|
-
this.
|
|
387
|
+
this.versionInternal++;
|
|
377
388
|
}
|
|
378
389
|
}
|
|
379
390
|
/**
|
|
@@ -402,7 +413,7 @@ export class UISolverWrapper {
|
|
|
402
413
|
this.solver = undefined;
|
|
403
414
|
}
|
|
404
415
|
this.recalculationRequired = true;
|
|
405
|
-
this.
|
|
416
|
+
this.versionInternal++;
|
|
406
417
|
}
|
|
407
418
|
}
|
|
408
419
|
/**
|
|
@@ -425,8 +436,17 @@ export class UISolverWrapper {
|
|
|
425
436
|
dependConstraints.push(cDescription);
|
|
426
437
|
}
|
|
427
438
|
}
|
|
428
|
-
|
|
429
|
-
|
|
439
|
+
// A variable that was required (P0) has no edit variable yet
|
|
440
|
+
try {
|
|
441
|
+
if (this.solver?.hasEditVariable(description.variable) === true) {
|
|
442
|
+
this.solver.removeEditVariable(description.variable);
|
|
443
|
+
}
|
|
444
|
+
this.solver?.addEditVariable(description.variable, convertPriority(description.priority));
|
|
445
|
+
this.solver?.suggestValue(description.variable, description.value);
|
|
446
|
+
}
|
|
447
|
+
catch {
|
|
448
|
+
this.solver = undefined;
|
|
449
|
+
}
|
|
430
450
|
for (const cDescription of dependConstraints) {
|
|
431
451
|
cDescription.constraint = this.buildConstraint(cDescription.lhs, cDescription.rhs, cDescription.relation, cDescription.priority);
|
|
432
452
|
}
|
|
@@ -539,6 +559,6 @@ export class UISolverWrapper {
|
|
|
539
559
|
}
|
|
540
560
|
this.solver = solver;
|
|
541
561
|
this.recalculationRequired = true;
|
|
542
|
-
this.
|
|
562
|
+
this.versionInternal++;
|
|
543
563
|
}
|
|
544
564
|
}
|
|
@@ -23,6 +23,8 @@ export class UIAspectDebug {
|
|
|
23
23
|
this.updateContainerVisibility();
|
|
24
24
|
};
|
|
25
25
|
this.onRendering = (renderer) => {
|
|
26
|
+
// Also on creation: a constraint is announced before its orientation is set
|
|
27
|
+
this.updateContainerVisibility();
|
|
26
28
|
const tintDirty = this.tint.dirty;
|
|
27
29
|
if (tintDirty) {
|
|
28
30
|
this.tint.toThreeColor(this.diagonalMaterial.color);
|
|
@@ -95,6 +97,8 @@ export class UIAspectDebug {
|
|
|
95
97
|
this.constraint.layer.sceneWrapper.removeCustomObject(this.container);
|
|
96
98
|
this.diagonalGeometry.dispose();
|
|
97
99
|
this.textTexture.dispose();
|
|
100
|
+
this.diagonalMaterial.dispose();
|
|
101
|
+
this.spriteMaterial.dispose();
|
|
98
102
|
}
|
|
99
103
|
updateContainerVisibility() {
|
|
100
104
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
@@ -23,6 +23,8 @@ export class UIHeightDebug {
|
|
|
23
23
|
this.updateContainerVisibility();
|
|
24
24
|
};
|
|
25
25
|
this.onRendering = (renderer) => {
|
|
26
|
+
// Also on creation: a constraint is announced before its orientation is set
|
|
27
|
+
this.updateContainerVisibility();
|
|
26
28
|
const tintDirty = this.tint.dirty;
|
|
27
29
|
if (tintDirty) {
|
|
28
30
|
this.tint.toThreeColor(this.lineMaterial.color);
|
|
@@ -88,6 +90,8 @@ export class UIHeightDebug {
|
|
|
88
90
|
this.constraint.layer.sceneWrapper.removeCustomObject(this.container);
|
|
89
91
|
this.lineGeometry.dispose();
|
|
90
92
|
this.textTexture.dispose();
|
|
93
|
+
this.lineMaterial.dispose();
|
|
94
|
+
this.spriteMaterial.dispose();
|
|
91
95
|
}
|
|
92
96
|
updateContainerVisibility() {
|
|
93
97
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
@@ -34,6 +34,8 @@ export class UIHorizontalDistanceDebug {
|
|
|
34
34
|
this.updateContainerVisibility();
|
|
35
35
|
};
|
|
36
36
|
this.onRendering = (renderer) => {
|
|
37
|
+
// Also on creation: a constraint is announced before its orientation is set
|
|
38
|
+
this.updateContainerVisibility();
|
|
37
39
|
const tintDirty = this.tint.dirty;
|
|
38
40
|
if (tintDirty) {
|
|
39
41
|
this.tint.toThreeColor(this.lineMaterial.color);
|
|
@@ -134,6 +136,9 @@ export class UIHorizontalDistanceDebug {
|
|
|
134
136
|
this.lineGeometry.dispose();
|
|
135
137
|
this.tickGeometry.dispose();
|
|
136
138
|
this.textTexture.dispose();
|
|
139
|
+
this.lineMaterial.dispose();
|
|
140
|
+
this.tickMaterial.dispose();
|
|
141
|
+
this.spriteMaterial.dispose();
|
|
137
142
|
}
|
|
138
143
|
updateContainerVisibility() {
|
|
139
144
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
@@ -32,6 +32,8 @@ export class UIHorizontalInterpolationDebug {
|
|
|
32
32
|
this.updateContainerVisibility();
|
|
33
33
|
};
|
|
34
34
|
this.onRendering = (renderer) => {
|
|
35
|
+
// Also on creation: a constraint is announced before its orientation is set
|
|
36
|
+
this.updateContainerVisibility();
|
|
35
37
|
const tintDirty = this.tint.dirty;
|
|
36
38
|
if (tintDirty) {
|
|
37
39
|
this.tint.toThreeColor(this.baseLineMaterial.color);
|
|
@@ -122,6 +124,9 @@ export class UIHorizontalInterpolationDebug {
|
|
|
122
124
|
this.baseLineGeometry.dispose();
|
|
123
125
|
this.markerGeometry.dispose();
|
|
124
126
|
this.textTexture.dispose();
|
|
127
|
+
this.baseLineMaterial.dispose();
|
|
128
|
+
this.markerMaterial.dispose();
|
|
129
|
+
this.spriteMaterial.dispose();
|
|
125
130
|
}
|
|
126
131
|
updateContainerVisibility() {
|
|
127
132
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
@@ -19,6 +19,13 @@ export declare class UILayerDebug {
|
|
|
19
19
|
private showVerticalDistanceInternal;
|
|
20
20
|
private showVerticalInterpolationInternal;
|
|
21
21
|
constructor(layer: UILayer, options?: Partial<UILayerDebugOptions>);
|
|
22
|
+
get showAspect(): boolean;
|
|
23
|
+
get showHeight(): boolean;
|
|
24
|
+
get showWidth(): boolean;
|
|
25
|
+
get showHorizontalDistance(): boolean;
|
|
26
|
+
get showHorizontalInterpolation(): boolean;
|
|
27
|
+
get showVerticalDistance(): boolean;
|
|
28
|
+
get showVerticalInterpolation(): boolean;
|
|
22
29
|
set showAspect(value: boolean);
|
|
23
30
|
set showHeight(value: boolean);
|
|
24
31
|
set showWidth(value: boolean);
|
|
@@ -33,6 +33,27 @@ export class UILayerDebug {
|
|
|
33
33
|
this.layer.signalConstraintAdded.on(this.onConstraintAdded);
|
|
34
34
|
this.layer.signalConstraintRemoved.on(this.onConstraintRemoved);
|
|
35
35
|
}
|
|
36
|
+
get showAspect() {
|
|
37
|
+
return this.showAspectInternal;
|
|
38
|
+
}
|
|
39
|
+
get showHeight() {
|
|
40
|
+
return this.showHeightInternal;
|
|
41
|
+
}
|
|
42
|
+
get showWidth() {
|
|
43
|
+
return this.showWidthInternal;
|
|
44
|
+
}
|
|
45
|
+
get showHorizontalDistance() {
|
|
46
|
+
return this.showHorizontalDistanceInternal;
|
|
47
|
+
}
|
|
48
|
+
get showHorizontalInterpolation() {
|
|
49
|
+
return this.showHorizontalInterpolationInternal;
|
|
50
|
+
}
|
|
51
|
+
get showVerticalDistance() {
|
|
52
|
+
return this.showVerticalDistanceInternal;
|
|
53
|
+
}
|
|
54
|
+
get showVerticalInterpolation() {
|
|
55
|
+
return this.showVerticalInterpolationInternal;
|
|
56
|
+
}
|
|
36
57
|
set showAspect(value) {
|
|
37
58
|
this.showAspectInternal = value;
|
|
38
59
|
this.setVisibility(UIAspectConstraint, value);
|
|
@@ -34,6 +34,8 @@ export class UIVerticalDistanceDebug {
|
|
|
34
34
|
this.updateContainerVisibility();
|
|
35
35
|
};
|
|
36
36
|
this.onRendering = (renderer) => {
|
|
37
|
+
// Also on creation: a constraint is announced before its orientation is set
|
|
38
|
+
this.updateContainerVisibility();
|
|
37
39
|
const tintDirty = this.tint.dirty;
|
|
38
40
|
if (tintDirty) {
|
|
39
41
|
this.tint.toThreeColor(this.lineMaterial.color);
|
|
@@ -134,6 +136,9 @@ export class UIVerticalDistanceDebug {
|
|
|
134
136
|
this.lineGeometry.dispose();
|
|
135
137
|
this.tickGeometry.dispose();
|
|
136
138
|
this.textTexture.dispose();
|
|
139
|
+
this.lineMaterial.dispose();
|
|
140
|
+
this.tickMaterial.dispose();
|
|
141
|
+
this.spriteMaterial.dispose();
|
|
137
142
|
}
|
|
138
143
|
updateContainerVisibility() {
|
|
139
144
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
@@ -32,6 +32,8 @@ export class UIVerticalInterpolationDebug {
|
|
|
32
32
|
this.updateContainerVisibility();
|
|
33
33
|
};
|
|
34
34
|
this.onRendering = (renderer) => {
|
|
35
|
+
// Also on creation: a constraint is announced before its orientation is set
|
|
36
|
+
this.updateContainerVisibility();
|
|
35
37
|
const tintDirty = this.tint.dirty;
|
|
36
38
|
if (tintDirty) {
|
|
37
39
|
this.tint.toThreeColor(this.baseLineMaterial.color);
|
|
@@ -122,6 +124,9 @@ export class UIVerticalInterpolationDebug {
|
|
|
122
124
|
this.baseLineGeometry.dispose();
|
|
123
125
|
this.markerGeometry.dispose();
|
|
124
126
|
this.textTexture.dispose();
|
|
127
|
+
this.baseLineMaterial.dispose();
|
|
128
|
+
this.markerMaterial.dispose();
|
|
129
|
+
this.spriteMaterial.dispose();
|
|
125
130
|
}
|
|
126
131
|
updateContainerVisibility() {
|
|
127
132
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
@@ -23,6 +23,8 @@ export class UIWidthDebug {
|
|
|
23
23
|
this.updateContainerVisibility();
|
|
24
24
|
};
|
|
25
25
|
this.onRendering = (renderer) => {
|
|
26
|
+
// Also on creation: a constraint is announced before its orientation is set
|
|
27
|
+
this.updateContainerVisibility();
|
|
26
28
|
const tintDirty = this.tint.dirty;
|
|
27
29
|
if (tintDirty) {
|
|
28
30
|
this.tint.toThreeColor(this.lineMaterial.color);
|
|
@@ -88,6 +90,8 @@ export class UIWidthDebug {
|
|
|
88
90
|
this.constraint.layer.sceneWrapper.removeCustomObject(this.container);
|
|
89
91
|
this.lineGeometry.dispose();
|
|
90
92
|
this.textTexture.dispose();
|
|
93
|
+
this.lineMaterial.dispose();
|
|
94
|
+
this.spriteMaterial.dispose();
|
|
91
95
|
}
|
|
92
96
|
updateContainerVisibility() {
|
|
93
97
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
package/dist/debug/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { UIAspectDebug } from "./UIAspectDebug.js";
|
|
2
|
+
export type { UIConstraintDebug } from "./UIConstraintDebug.js";
|
|
2
3
|
export { UIHeightDebug } from "./UIHeightDebug.js";
|
|
3
4
|
export { UIHorizontalDistanceDebug } from "./UIHorizontalDistanceDebug.js";
|
|
4
5
|
export { UIHorizontalInterpolationDebug } from "./UIHorizontalInterpolationDebug.js";
|
|
6
|
+
export type { UILayerDebugOptions } from "./UILayerDebug.js";
|
|
5
7
|
export { UILayerDebug } from "./UILayerDebug.js";
|
|
6
8
|
export { UIVerticalDistanceDebug } from "./UIVerticalDistanceDebug.js";
|
|
7
9
|
export { UIVerticalInterpolationDebug } from "./UIVerticalInterpolationDebug.js";
|