laymur 0.26.0 → 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 +79 -35
- 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/UIAnimatedImage/UIAnimatedImage.d.ts +2 -2
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +24 -12
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +10 -0
- package/dist/core/elements/UIDummy/UIDummy.d.ts +42 -5
- package/dist/core/elements/UIDummy/UIDummy.js +119 -25
- package/dist/core/elements/UIElement/UIElement.Internal.d.ts +1 -1
- package/dist/core/elements/UIElement/UIElement.d.ts +14 -0
- package/dist/core/elements/UIElement/UIElement.js +34 -3
- 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 +2 -2
- 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 +15 -10
- 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 +18 -12
- 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 +6 -6
- package/dist/core/index.d.ts +44 -41
- package/dist/core/index.js +12 -9
- package/dist/core/layers/UILayer/UILayer.d.ts +40 -4
- package/dist/core/layers/UILayer/UILayer.js +70 -9
- 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/asserts.d.ts +14 -0
- package/dist/core/miscellaneous/asserts.js +28 -0
- package/dist/core/miscellaneous/canvas.js +7 -2
- package/dist/core/miscellaneous/color/UIColor.js +4 -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.js +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.d.ts +7 -4
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +13 -6
- 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 +4 -1
- package/dist/core/miscellaneous/texture/UITextureView.js +10 -7
- 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/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 +1 -1
- 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 +1 -1
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +5 -1
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +13 -10
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +6 -4
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +4 -3
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +8 -8
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +4 -3
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +8 -5
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +8 -8
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +7 -5
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +12 -8
- package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -2
- package/dist/particles/elements/UIEmitter.Internal.js +6 -0
- package/dist/particles/elements/UIEmitter.d.ts +19 -3
- package/dist/particles/elements/UIEmitter.js +100 -54
- package/dist/particles/index.d.ts +3 -2
- package/dist/particles/index.js +1 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +8 -2
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +16 -11
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +7 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.js +37 -2
- package/dist/particles/miscellaneous/miscellaneous.d.ts +34 -0
- package/dist/particles/miscellaneous/miscellaneous.js +72 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +2 -3
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +3 -2
- package/dist/particles/renderingModules/UIRenderingModule.js +2 -1
- 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 +5 -2
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +5 -5
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +5 -3
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRandomScale.js +4 -3
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +5 -3
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +6 -4
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRectangle.js +6 -4
- 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
|
@@ -22,28 +22,57 @@ export class UIDummy extends UIAnchor {
|
|
|
22
22
|
assertValidPositiveNumber(w, "UIDummy.constructor.width");
|
|
23
23
|
assertValidPositiveNumber(h, "UIDummy.constructor.height");
|
|
24
24
|
super(layer, options);
|
|
25
|
-
this.
|
|
25
|
+
this.pointers = new Map();
|
|
26
26
|
this.maskInternal = null;
|
|
27
27
|
this.signalPointerPressedInternal = new Ferrsign1();
|
|
28
28
|
this.signalPointerMovedInternal = new Ferrsign1();
|
|
29
29
|
this.signalPointerReleasedInternal = new Ferrsign1();
|
|
30
30
|
this.signalPointerEnteredInternal = new Ferrsign1();
|
|
31
31
|
this.signalPointerLeftInternal = new Ferrsign1();
|
|
32
|
+
this.signalPointerCancelledInternal = new Ferrsign1();
|
|
33
|
+
this.signalPointerClickedInternal = new Ferrsign1();
|
|
34
|
+
this.signalPointerDraggedInternal = new Ferrsign1();
|
|
32
35
|
this.catchPointerDown = (x, y, identifier) => {
|
|
33
|
-
|
|
36
|
+
const state = this.trackPointer(x, y, identifier, this.signalPointerPressedInternal);
|
|
37
|
+
const caught = this.catches(state);
|
|
38
|
+
if (caught) {
|
|
39
|
+
state.pressed = true;
|
|
40
|
+
}
|
|
41
|
+
this.forgetIfUntracked(identifier, state);
|
|
42
|
+
return caught;
|
|
34
43
|
};
|
|
35
44
|
this.catchPointerMove = (x, y, identifier) => {
|
|
36
|
-
|
|
45
|
+
const state = this.trackPointer(x, y, identifier, this.signalPointerMovedInternal);
|
|
46
|
+
if (state.pressed) {
|
|
47
|
+
this.emitPointer(this.signalPointerDraggedInternal, state, identifier);
|
|
48
|
+
}
|
|
49
|
+
this.forgetIfUntracked(identifier, state);
|
|
50
|
+
return this.catches(state);
|
|
37
51
|
};
|
|
38
52
|
this.catchPointerUp = (x, y, identifier) => {
|
|
39
|
-
|
|
53
|
+
const state = this.trackPointer(x, y, identifier, this.signalPointerReleasedInternal);
|
|
54
|
+
const caught = this.catches(state);
|
|
55
|
+
this.endPointer(identifier, state, state.inside);
|
|
56
|
+
return caught;
|
|
57
|
+
};
|
|
58
|
+
/** Signals of a cancel carry the last known position */
|
|
59
|
+
this.catchPointerCancel = (identifier) => {
|
|
60
|
+
const state = this.pointers.get(identifier);
|
|
61
|
+
if (state !== undefined) {
|
|
62
|
+
this.endPointer(identifier, state, false);
|
|
63
|
+
}
|
|
40
64
|
};
|
|
41
65
|
this.interactionArea = options?.interactionArea ?? new UIAreaRectangle(0, 0, 1, 1);
|
|
42
66
|
this.modeInternal = options?.mode ?? DUMMY_DEFAULT_MODE;
|
|
43
67
|
this.inputWrapper = this.layer.inputWrapper;
|
|
44
68
|
this.wVariable = this.solverWrapper.createVariable(w, UIPriority.P6);
|
|
45
69
|
this.hVariable = this.solverWrapper.createVariable(h, UIPriority.P6);
|
|
46
|
-
this.catcherHandler = this.inputWrapper.createInputCatcher(
|
|
70
|
+
this.catcherHandler = this.inputWrapper.createInputCatcher({
|
|
71
|
+
catchPointerDown: this.catchPointerDown,
|
|
72
|
+
catchPointerMove: this.catchPointerMove,
|
|
73
|
+
catchPointerUp: this.catchPointerUp,
|
|
74
|
+
catchPointerCancel: this.catchPointerCancel,
|
|
75
|
+
}, DUMMY_DEFAULT_Z_INDEX);
|
|
47
76
|
this.inputWrapper.setActive(this.catcherHandler, isUIModeInteractive(this.modeInternal));
|
|
48
77
|
const mask = options?.mask ?? null;
|
|
49
78
|
if (mask !== null) {
|
|
@@ -91,7 +120,11 @@ export class UIDummy extends UIAnchor {
|
|
|
91
120
|
get mask() {
|
|
92
121
|
return this.maskInternal;
|
|
93
122
|
}
|
|
94
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* Signal fired when pointer is pressed over the element. An element that catches the press
|
|
125
|
+
* (any interactive mode but INTERACTIVE_TRANSPARENT) holds the pointer until it is released:
|
|
126
|
+
* then exactly one of `signalPointerClicked` and `signalPointerCancelled` follows.
|
|
127
|
+
*/
|
|
95
128
|
get signalPointerPressed() {
|
|
96
129
|
return this.signalPointerPressedInternal;
|
|
97
130
|
}
|
|
@@ -107,10 +140,29 @@ export class UIDummy extends UIAnchor {
|
|
|
107
140
|
get signalPointerEntered() {
|
|
108
141
|
return this.signalPointerEnteredInternal;
|
|
109
142
|
}
|
|
110
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* Signal fired when pointer leaves element. A released or cancelled pointer leaves too: a
|
|
145
|
+
* mouse still over the element enters again on its next move.
|
|
146
|
+
*/
|
|
111
147
|
get signalPointerLeft() {
|
|
112
148
|
return this.signalPointerLeftInternal;
|
|
113
149
|
}
|
|
150
|
+
/** Signal fired when a pointer pressed on the element is released over it */
|
|
151
|
+
get signalPointerClicked() {
|
|
152
|
+
return this.signalPointerClickedInternal;
|
|
153
|
+
}
|
|
154
|
+
/** Signal fired when a pointer pressed on the element moves, over the element or not */
|
|
155
|
+
get signalPointerDragged() {
|
|
156
|
+
return this.signalPointerDraggedInternal;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Signal fired when a press on the element ends without a click: released outside the
|
|
160
|
+
* element, cancelled by the browser (a system gesture, scrolling, a popup), or the element
|
|
161
|
+
* stopped taking input. Reset what was started on press. The position is the last known one.
|
|
162
|
+
*/
|
|
163
|
+
get signalPointerCancelled() {
|
|
164
|
+
return this.signalPointerCancelledInternal;
|
|
165
|
+
}
|
|
114
166
|
/** Unique depth of the element among the elements of the layer, derived from `zIndex` */
|
|
115
167
|
get renderDepth() {
|
|
116
168
|
return this.inputWrapper.getDepth(this.catcherHandler);
|
|
@@ -158,6 +210,9 @@ export class UIDummy extends UIAnchor {
|
|
|
158
210
|
const newInteractivity = isUIModeInteractive(value);
|
|
159
211
|
this.inputWrapper.setActive(this.catcherHandler, newInteractivity);
|
|
160
212
|
this.modeInternal = value;
|
|
213
|
+
if (!newInteractivity) {
|
|
214
|
+
this.dropPointers();
|
|
215
|
+
}
|
|
161
216
|
}
|
|
162
217
|
}
|
|
163
218
|
/**
|
|
@@ -221,6 +276,8 @@ export class UIDummy extends UIAnchor {
|
|
|
221
276
|
return [...super.getSolverVariables(), this.wVariable, this.hVariable];
|
|
222
277
|
}
|
|
223
278
|
destroyInternal() {
|
|
279
|
+
// A press held by the element still ends with a cancel, and its pointers leave it
|
|
280
|
+
this.dropPointers();
|
|
224
281
|
this.maskInternal?.detach(this);
|
|
225
282
|
this.maskInternal = null;
|
|
226
283
|
this.solverWrapper.removeVariable(this.hVariable);
|
|
@@ -228,27 +285,64 @@ export class UIDummy extends UIAnchor {
|
|
|
228
285
|
this.inputWrapper.destroyInputCatcher(this.catcherHandler);
|
|
229
286
|
super.destroyInternal();
|
|
230
287
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
288
|
+
/**
|
|
289
|
+
* Updates what the element knows of a pointer: fires the signal of the event if the pointer
|
|
290
|
+
* is over the element, then entered or left if that changed.
|
|
291
|
+
*/
|
|
292
|
+
trackPointer(x, y, identifier, signal) {
|
|
293
|
+
assertValidNumber(x, "UIDummy.trackPointer.x");
|
|
294
|
+
assertValidNumber(y, "UIDummy.trackPointer.y");
|
|
295
|
+
assertValidNumber(identifier, "UIDummy.trackPointer.identifier");
|
|
296
|
+
let state = this.pointers.get(identifier);
|
|
297
|
+
if (state === undefined) {
|
|
298
|
+
state = { x, y, inside: false, pressed: false };
|
|
299
|
+
this.pointers.set(identifier, state);
|
|
238
300
|
}
|
|
239
|
-
|
|
240
|
-
|
|
301
|
+
state.x = x;
|
|
302
|
+
state.y = y;
|
|
303
|
+
const inside = this.isInputPointInside(x, y);
|
|
304
|
+
if (inside) {
|
|
305
|
+
this.emitPointer(signal, state, identifier);
|
|
241
306
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
y,
|
|
246
|
-
identifier,
|
|
247
|
-
element: this,
|
|
248
|
-
});
|
|
307
|
+
if (inside !== state.inside) {
|
|
308
|
+
state.inside = inside;
|
|
309
|
+
this.emitPointer(inside ? this.signalPointerEnteredInternal : this.signalPointerLeftInternal, state, identifier);
|
|
249
310
|
}
|
|
250
|
-
|
|
251
|
-
|
|
311
|
+
return state;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Ends a pointer: a press on the element ends as a click or as cancelled, and the pointer
|
|
315
|
+
* leaves. A released or cancelled pointer is forgotten, so that a touch, which never comes
|
|
316
|
+
* back with the same identifier, does not stay over the element.
|
|
317
|
+
*/
|
|
318
|
+
endPointer(identifier, state, clicked) {
|
|
319
|
+
this.pointers.delete(identifier);
|
|
320
|
+
if (state.pressed) {
|
|
321
|
+
state.pressed = false;
|
|
322
|
+
this.emitPointer(clicked ? this.signalPointerClickedInternal : this.signalPointerCancelledInternal, state, identifier);
|
|
323
|
+
}
|
|
324
|
+
if (state.inside) {
|
|
325
|
+
state.inside = false;
|
|
326
|
+
this.emitPointer(this.signalPointerLeftInternal, state, identifier);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/** Ends every pointer, for an element that stops taking input */
|
|
330
|
+
dropPointers() {
|
|
331
|
+
for (const [identifier, state] of [...this.pointers]) {
|
|
332
|
+
this.endPointer(identifier, state, false);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
forgetIfUntracked(identifier, state) {
|
|
336
|
+
if (!state.inside && !state.pressed) {
|
|
337
|
+
this.pointers.delete(identifier);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/** Whether the event stops at the element: catchers below do not get it */
|
|
341
|
+
catches(state) {
|
|
342
|
+
return state.inside && this.modeInternal !== UIMode.INTERACTIVE_TRANSPARENT;
|
|
343
|
+
}
|
|
344
|
+
emitPointer(signal, state, identifier) {
|
|
345
|
+
signal.emit({ x: state.x, y: state.y, identifier, element: this });
|
|
252
346
|
}
|
|
253
347
|
/**
|
|
254
348
|
* Whether a point in layer coordinates hits the element: it is in the visible part of the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HSLAdjustment } from "../../miscellaneous/generic-plane/shared.js";
|
|
2
|
-
import { UIBlendMode } from "../../miscellaneous/UIBlendMode.js";
|
|
3
2
|
import type { UIMicroConfig } from "../../miscellaneous/micro/UIMicro.Internal.js";
|
|
3
|
+
import { UIBlendMode } from "../../miscellaneous/UIBlendMode.js";
|
|
4
4
|
import { UITransparencyMode } from "../../miscellaneous/UITransparencyMode.js";
|
|
5
5
|
import type { UIDummyOptions } from "../UIDummy/UIDummy.Internal.js";
|
|
6
6
|
/** Configuration options for UIElement */
|
|
@@ -31,6 +31,11 @@ export declare abstract class UIElement extends UIDummy {
|
|
|
31
31
|
private hslDirty;
|
|
32
32
|
private readonly hslValue;
|
|
33
33
|
private visibilityDirty;
|
|
34
|
+
/** Layout and draw-order versions the plane was last placed by */
|
|
35
|
+
private placedSolverVersion;
|
|
36
|
+
private placedInputVersion;
|
|
37
|
+
/** Layout version content sized by the element was last measured at */
|
|
38
|
+
private measuredSolverVersion;
|
|
34
39
|
/** Mask as last applied to the plane; compared every frame, see applyMask */
|
|
35
40
|
private appliedMask;
|
|
36
41
|
private appliedMaskVersion;
|
|
@@ -61,6 +66,8 @@ export declare abstract class UIElement extends UIDummy {
|
|
|
61
66
|
* pair inherited from {@link UIDummy}, making reads return undefined.
|
|
62
67
|
*/
|
|
63
68
|
get mode(): UIMode;
|
|
69
|
+
/** Whether the layout or the draw order changed since the plane was last placed */
|
|
70
|
+
protected get placementDirty(): boolean;
|
|
64
71
|
/** Alpha blending mode */
|
|
65
72
|
set transparencyMode(value: UITransparencyMode);
|
|
66
73
|
/** Color blending mode (only affects BLEND transparency) */
|
|
@@ -77,6 +84,13 @@ export declare abstract class UIElement extends UIDummy {
|
|
|
77
84
|
protected destroyInternal(): void;
|
|
78
85
|
protected getMicro(): UIMicro;
|
|
79
86
|
protected setPlaneTransform(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Whether the layout changed since the last call. Content that depends on the element size,
|
|
89
|
+
* such as text or nine-slice regions, reads the size only then: a read runs the solver.
|
|
90
|
+
*/
|
|
91
|
+
protected consumeLayoutChange(): boolean;
|
|
92
|
+
/** Records the layout and draw order the plane is placed by */
|
|
93
|
+
protected setPlacementDirtyFalse(): void;
|
|
80
94
|
/**
|
|
81
95
|
* Replaces the plane with one drawn by another shader source, keeping the visibility,
|
|
82
96
|
* transparency, blend, color adjustment and mask of the element.
|
|
@@ -27,6 +27,11 @@ export class UIElement extends UIDummy {
|
|
|
27
27
|
this.hslDirty = false;
|
|
28
28
|
this.hslValue = { h: 0, s: 0, l: 0 };
|
|
29
29
|
this.visibilityDirty = false;
|
|
30
|
+
/** Layout and draw-order versions the plane was last placed by */
|
|
31
|
+
this.placedSolverVersion = -1;
|
|
32
|
+
this.placedInputVersion = -1;
|
|
33
|
+
/** Layout version content sized by the element was last measured at */
|
|
34
|
+
this.measuredSolverVersion = -1;
|
|
30
35
|
/** Mask as last applied to the plane; compared every frame, see applyMask */
|
|
31
36
|
this.appliedMask = null;
|
|
32
37
|
this.appliedMaskVersion = -1;
|
|
@@ -41,7 +46,10 @@ export class UIElement extends UIDummy {
|
|
|
41
46
|
this.saturationInternal = options?.saturation ?? ELEMENT_DEFAULT_SATURATION;
|
|
42
47
|
this.lightnessInternal = options?.lightness ?? ELEMENT_DEFAULT_LIGHTNESS;
|
|
43
48
|
this.sceneWrapper = this.layer.sceneWrapper;
|
|
44
|
-
this.planeHandler = this.sceneWrapper.createPlane(source, properties,
|
|
49
|
+
this.planeHandler = this.sceneWrapper.createPlane(source, properties,
|
|
50
|
+
// A plane created during a frame is placed on the next one. Until then it is collapsed to
|
|
51
|
+
// nothing, at its own depth: planes may not share one
|
|
52
|
+
new Matrix4().makeScale(0, 0, 1).setPosition(0, 0, this.renderDepth), isUIModeVisible(options?.mode ?? this.mode), this.transparencyModeInternal, blendModeToFactor(this.blendModeInternal), packHSL(this.hslValue, this.hueInternal, this.saturationInternal, this.lightnessInternal));
|
|
45
53
|
this.layer.signalRendering.on(this.handleWillRender);
|
|
46
54
|
}
|
|
47
55
|
/** Alpha blending mode */
|
|
@@ -73,6 +81,11 @@ export class UIElement extends UIDummy {
|
|
|
73
81
|
get mode() {
|
|
74
82
|
return this.modeInternal;
|
|
75
83
|
}
|
|
84
|
+
/** Whether the layout or the draw order changed since the plane was last placed */
|
|
85
|
+
get placementDirty() {
|
|
86
|
+
return (this.solverWrapper.version !== this.placedSolverVersion ||
|
|
87
|
+
this.inputWrapper.version !== this.placedInputVersion);
|
|
88
|
+
}
|
|
76
89
|
/** Alpha blending mode */
|
|
77
90
|
set transparencyMode(value) {
|
|
78
91
|
if (this.transparencyModeInternal !== value) {
|
|
@@ -111,7 +124,7 @@ export class UIElement extends UIDummy {
|
|
|
111
124
|
/** Controls visibility and interactivity */
|
|
112
125
|
set mode(value) {
|
|
113
126
|
if (this.modeInternal !== value) {
|
|
114
|
-
this.visibilityDirty = isUIModeVisible(this.modeInternal) !== isUIModeVisible(value);
|
|
127
|
+
this.visibilityDirty || (this.visibilityDirty = isUIModeVisible(this.modeInternal) !== isUIModeVisible(value));
|
|
115
128
|
super.mode = value;
|
|
116
129
|
}
|
|
117
130
|
}
|
|
@@ -125,10 +138,28 @@ export class UIElement extends UIDummy {
|
|
|
125
138
|
return this.micro;
|
|
126
139
|
}
|
|
127
140
|
setPlaneTransform() {
|
|
128
|
-
if (this.micro.dirty || this.
|
|
141
|
+
if (this.micro.dirty || this.placementDirty) {
|
|
129
142
|
this.sceneWrapper.setTransform(this.planeHandler, this.computeVisualTransform(true, TEMP_TRANSFORM, this.renderDepth));
|
|
130
143
|
this.micro.setDirtyFalse();
|
|
144
|
+
this.setPlacementDirtyFalse();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Whether the layout changed since the last call. Content that depends on the element size,
|
|
149
|
+
* such as text or nine-slice regions, reads the size only then: a read runs the solver.
|
|
150
|
+
*/
|
|
151
|
+
consumeLayoutChange() {
|
|
152
|
+
const version = this.solverWrapper.version;
|
|
153
|
+
if (version === this.measuredSolverVersion) {
|
|
154
|
+
return false;
|
|
131
155
|
}
|
|
156
|
+
this.measuredSolverVersion = version;
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
/** Records the layout and draw order the plane is placed by */
|
|
160
|
+
setPlacementDirtyFalse() {
|
|
161
|
+
this.placedSolverVersion = this.solverWrapper.version;
|
|
162
|
+
this.placedInputVersion = this.inputWrapper.version;
|
|
132
163
|
}
|
|
133
164
|
/**
|
|
134
165
|
* Replaces the plane with one drawn by another shader source, keeping the visibility,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
2
1
|
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
|
|
2
|
+
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
3
3
|
import type { UIElementOptions } from "../UIElement/UIElement.Internal.js";
|
|
4
4
|
/** Configuration options for UIGraphics */
|
|
5
5
|
export interface UIGraphicsOptions extends UIElementOptions {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WebGLRenderer } from "three";
|
|
2
2
|
import type { UILayer } from "../../layers/UILayer/UILayer.js";
|
|
3
|
-
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
4
3
|
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
|
|
4
|
+
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
5
5
|
import { UIElement } from "../UIElement/UIElement.js";
|
|
6
6
|
import type { UIGraphicsOptions } from "./UIGraphics.Internal.js";
|
|
7
7
|
/** Canvas-based 2D drawing element */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createCanvas, createCanvasTexture } from "../../miscellaneous/canvas.js";
|
|
1
|
+
import { createCanvas, createCanvasTexture, getCanvas2DContext, } from "../../miscellaneous/canvas.js";
|
|
2
2
|
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
3
3
|
import { UIAffineMatrix3 } from "../../miscellaneous/UIAffineMatrix3.js";
|
|
4
4
|
import source from "../../shaders/UIImage.js";
|
|
@@ -17,7 +17,7 @@ export class UIGraphics extends UIElement {
|
|
|
17
17
|
const h = options?.height ?? GRAPHICS_DEFAULT_HEIGHT;
|
|
18
18
|
const color = new UIColor(options?.color);
|
|
19
19
|
const canvas = createCanvas(w, h);
|
|
20
|
-
const context = canvas
|
|
20
|
+
const context = getCanvas2DContext(canvas);
|
|
21
21
|
if (!context) {
|
|
22
22
|
throw new Error("UIGraphics.constructor: failed to get 2D context from canvas");
|
|
23
23
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { UILayer } from "../../layers/UILayer/UILayer.js";
|
|
2
|
-
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
3
2
|
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
|
|
4
|
-
import {
|
|
3
|
+
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
5
4
|
import type { UITextureConfig } from "../../miscellaneous/texture/UITextureView.Internal.js";
|
|
5
|
+
import { UITextureView } from "../../miscellaneous/texture/UITextureView.js";
|
|
6
6
|
import { UIElement } from "../UIElement/UIElement.js";
|
|
7
7
|
import type { UIImageOptions } from "./UIImage.Internal.js";
|
|
8
8
|
/** Textured image element */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
2
|
-
import { computeTrimmedTransformMatrix } from "../../miscellaneous/computeTransform.js";
|
|
2
|
+
import { computeTrimmedTransformMatrix, scaleTrim } from "../../miscellaneous/computeTransform.js";
|
|
3
3
|
import { UITextureView } from "../../miscellaneous/texture/UITextureView.js";
|
|
4
4
|
import source from "../../shaders/UIImage.js";
|
|
5
5
|
import { UIElement } from "../UIElement/UIElement.js";
|
|
@@ -18,8 +18,12 @@ export class UIImage extends UIElement {
|
|
|
18
18
|
const color = new UIColor(options.color);
|
|
19
19
|
const textureView = new UITextureView(texture);
|
|
20
20
|
const textureTransform = textureView.calculateUVTransform();
|
|
21
|
-
|
|
22
|
-
options
|
|
21
|
+
// A copy: the caller may pass the same options to several elements
|
|
22
|
+
options = {
|
|
23
|
+
...options,
|
|
24
|
+
width: options.width ?? textureView.width,
|
|
25
|
+
height: options.height ?? textureView.height,
|
|
26
|
+
};
|
|
23
27
|
super(layer, source, {
|
|
24
28
|
texture: textureView.texture,
|
|
25
29
|
textureTransform: textureTransform,
|
|
@@ -67,16 +71,14 @@ export class UIImage extends UIElement {
|
|
|
67
71
|
if (properties) {
|
|
68
72
|
this.sceneWrapper.setProperties(this.planeHandler, properties);
|
|
69
73
|
}
|
|
70
|
-
const isTransformDirty = this.micro.dirty ||
|
|
71
|
-
this.texture.trimDirty ||
|
|
72
|
-
this.inputWrapper.dirty ||
|
|
73
|
-
this.solverWrapper.dirty;
|
|
74
|
+
const isTransformDirty = this.micro.dirty || this.texture.trimDirty || this.placementDirty;
|
|
74
75
|
if (isTransformDirty) {
|
|
75
76
|
const micro = this.micro;
|
|
76
|
-
const textureTrim = this.texture.trim;
|
|
77
|
+
const textureTrim = scaleTrim(this.texture.trim, this.width, this.height, this.texture.width, this.texture.height);
|
|
77
78
|
this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.renderDepth, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
|
|
78
79
|
this.micro.setDirtyFalse();
|
|
79
80
|
this.texture.setTrimDirtyFalse();
|
|
81
|
+
this.setPlacementDirtyFalse();
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { UILayer } from "../../layers/UILayer/UILayer.js";
|
|
2
|
-
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
3
2
|
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
|
|
4
|
-
import {
|
|
3
|
+
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
5
4
|
import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal.js";
|
|
6
|
-
import {
|
|
5
|
+
import { UIInsets } from "../../miscellaneous/insets/UIInsets.js";
|
|
7
6
|
import type { UITextureConfig } from "../../miscellaneous/texture/UITextureView.Internal.js";
|
|
7
|
+
import { UITextureView } from "../../miscellaneous/texture/UITextureView.js";
|
|
8
8
|
import { UIElement } from "../UIElement/UIElement.js";
|
|
9
9
|
import type { UINineSliceOptions } from "./UINineSlice.Internal.js";
|
|
10
10
|
import { UINineSliceRegionMode } from "./UINineSlice.Internal.js";
|
|
@@ -54,7 +54,7 @@ export declare class UINineSlice extends UIElement {
|
|
|
54
54
|
protected setPlaneTransform(): void;
|
|
55
55
|
private calculateSliceBordersForShader;
|
|
56
56
|
private calculateSliceRegionsForShader;
|
|
57
|
-
private
|
|
57
|
+
private consumeElementDimensionsChange;
|
|
58
58
|
private setElementDimensionsDirtyFalse;
|
|
59
59
|
private readonly onTextureDimensionsChanged;
|
|
60
60
|
}
|
|
@@ -21,8 +21,12 @@ export class UINineSlice extends UIElement {
|
|
|
21
21
|
const color = new UIColor(options.color);
|
|
22
22
|
const textureView = new UITextureView(texture);
|
|
23
23
|
const textureTransform = textureView.calculateUVTransform();
|
|
24
|
-
|
|
25
|
-
options
|
|
24
|
+
// A copy: the caller may pass the same options to several elements
|
|
25
|
+
options = {
|
|
26
|
+
...options,
|
|
27
|
+
width: options.width ?? textureView.width,
|
|
28
|
+
height: options.height ?? textureView.height,
|
|
29
|
+
};
|
|
26
30
|
const sliceBorders = new UIInsets(options.sliceBorders ?? NINE_SLICE_DEFAULT_BORDER);
|
|
27
31
|
const sliceRegions = new UIInsets(options.sliceRegions ?? NINE_SLICE_DEFAULT_BORDER);
|
|
28
32
|
const regionMode = options.regionMode ?? NINE_SLICE_DEFAULT_REGION_MODE;
|
|
@@ -106,7 +110,7 @@ export class UINineSlice extends UIElement {
|
|
|
106
110
|
const sliceRegionsDirty = this.sliceRegionsInternal.dirty ||
|
|
107
111
|
this.regionModeDirty ||
|
|
108
112
|
(this.regionModeInternal === UINineSliceRegionMode.WORLD &&
|
|
109
|
-
this.
|
|
113
|
+
this.consumeElementDimensionsChange());
|
|
110
114
|
if (sliceRegionsDirty) {
|
|
111
115
|
properties ?? (properties = {});
|
|
112
116
|
properties["sliceRegions"] = this.calculateSliceRegionsForShader(this.sliceRegionsVector);
|
|
@@ -132,16 +136,14 @@ export class UINineSlice extends UIElement {
|
|
|
132
136
|
if (properties) {
|
|
133
137
|
this.sceneWrapper.setProperties(this.planeHandler, properties);
|
|
134
138
|
}
|
|
135
|
-
const isTransformDirty = this.micro.dirty ||
|
|
136
|
-
this.texture.trimDirty ||
|
|
137
|
-
this.inputWrapper.dirty ||
|
|
138
|
-
this.solverWrapper.dirty;
|
|
139
|
+
const isTransformDirty = this.micro.dirty || this.texture.trimDirty || this.placementDirty;
|
|
139
140
|
if (isTransformDirty) {
|
|
140
141
|
const micro = this.micro;
|
|
141
142
|
const textureTrim = this.texture.trim;
|
|
142
143
|
this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.renderDepth, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
|
|
143
144
|
this.micro.setDirtyFalse();
|
|
144
145
|
this.texture.setTrimDirtyFalse();
|
|
146
|
+
this.setPlacementDirtyFalse();
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
calculateSliceBordersForShader(result) {
|
|
@@ -174,8 +176,8 @@ export class UINineSlice extends UIElement {
|
|
|
174
176
|
const height = this.height;
|
|
175
177
|
return result.set(this.sliceRegionsInternal.left / width, this.sliceRegionsInternal.right / width, this.sliceRegionsInternal.top / height, this.sliceRegionsInternal.bottom / height);
|
|
176
178
|
}
|
|
177
|
-
|
|
178
|
-
return (this.
|
|
179
|
+
consumeElementDimensionsChange() {
|
|
180
|
+
return (this.consumeLayoutChange() &&
|
|
179
181
|
(this.lastElementWidth !== Math.round(this.width) ||
|
|
180
182
|
this.lastElementHeight !== Math.round(this.height)));
|
|
181
183
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { UILayer } from "../../layers/UILayer/UILayer.js";
|
|
2
|
-
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
3
2
|
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
|
|
3
|
+
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
4
4
|
import type { UIProgressMaskFunction } from "../../miscellaneous/mask-function/UIProgressMaskFunction.js";
|
|
5
|
-
import { UITextureView } from "../../miscellaneous/texture/UITextureView.js";
|
|
6
5
|
import type { UITextureConfig } from "../../miscellaneous/texture/UITextureView.Internal.js";
|
|
6
|
+
import { UITextureView } from "../../miscellaneous/texture/UITextureView.js";
|
|
7
7
|
import { UIElement } from "../UIElement/UIElement.js";
|
|
8
8
|
import type { UIProgressOptions } from "./UIProgress.Internal.js";
|
|
9
9
|
/** Progress bar with customizable fill direction */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MathUtils } from "three";
|
|
2
2
|
import { assertValidNumber } from "../../miscellaneous/asserts.js";
|
|
3
3
|
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
4
|
-
import { computeTrimmedTransformMatrix } from "../../miscellaneous/computeTransform.js";
|
|
4
|
+
import { computeTrimmedTransformMatrix, scaleTrim } from "../../miscellaneous/computeTransform.js";
|
|
5
5
|
import { UIProgressMaskFunctionDirectional } from "../../miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js";
|
|
6
6
|
import { UITextureView } from "../../miscellaneous/texture/UITextureView.js";
|
|
7
7
|
import source from "../../shaders/UIProgress.js";
|
|
@@ -26,8 +26,12 @@ export class UIProgress extends UIElement {
|
|
|
26
26
|
const textureView = new UITextureView(texture);
|
|
27
27
|
const textureTransform = textureView.calculateUVTransform();
|
|
28
28
|
const textureResolution = textureView.getResolution();
|
|
29
|
-
|
|
30
|
-
options
|
|
29
|
+
// A copy: the caller may pass the same options to several elements
|
|
30
|
+
options = {
|
|
31
|
+
...options,
|
|
32
|
+
width: options.width ?? textureView.width,
|
|
33
|
+
height: options.height ?? textureView.height,
|
|
34
|
+
};
|
|
31
35
|
const progress = MathUtils.clamp(options.progress ?? PROGRESS_DEFAULT_VALUE, 0, 1);
|
|
32
36
|
const maskFunction = options.maskFunction ?? new UIProgressMaskFunctionDirectional();
|
|
33
37
|
super(layer, maskFunction.source + source, {
|
|
@@ -41,10 +45,12 @@ export class UIProgress extends UIElement {
|
|
|
41
45
|
this.progressDirty = false;
|
|
42
46
|
this.textureResolutionDirty = false;
|
|
43
47
|
this.onTextureDimensionsChanged = (width, height) => {
|
|
48
|
+
// The resolution follows the texture even when constraints already hold the element at
|
|
49
|
+
// its size
|
|
50
|
+
this.textureResolutionDirty = true;
|
|
44
51
|
if (this.width !== width || this.height !== height) {
|
|
45
52
|
this.width = width;
|
|
46
53
|
this.height = height;
|
|
47
|
-
this.textureResolutionDirty = true;
|
|
48
54
|
}
|
|
49
55
|
};
|
|
50
56
|
this.texture = textureView;
|
|
@@ -130,21 +136,19 @@ export class UIProgress extends UIElement {
|
|
|
130
136
|
if (properties) {
|
|
131
137
|
this.sceneWrapper.setProperties(this.planeHandler, properties);
|
|
132
138
|
}
|
|
133
|
-
const isTransformDirty = this.micro.dirty ||
|
|
134
|
-
this.texture.trimDirty ||
|
|
135
|
-
this.inputWrapper.dirty ||
|
|
136
|
-
this.solverWrapper.dirty;
|
|
139
|
+
const isTransformDirty = this.micro.dirty || this.texture.trimDirty || this.placementDirty;
|
|
137
140
|
if (isTransformDirty) {
|
|
138
141
|
const micro = this.micro;
|
|
139
|
-
const textureTrim = this.texture.trim;
|
|
142
|
+
const textureTrim = scaleTrim(this.texture.trim, this.width, this.height, this.texture.width, this.texture.height);
|
|
140
143
|
this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.renderDepth, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
|
|
141
144
|
this.micro.setDirtyFalse();
|
|
142
145
|
this.texture.setTrimDirtyFalse();
|
|
146
|
+
this.setPlacementDirtyFalse();
|
|
143
147
|
}
|
|
144
148
|
}
|
|
145
149
|
rebuildPlane() {
|
|
146
150
|
const micro = this.micro;
|
|
147
|
-
const textureTrim = this.texture.trim;
|
|
151
|
+
const textureTrim = scaleTrim(this.texture.trim, this.width, this.height, this.texture.width, this.texture.height);
|
|
148
152
|
this.recreatePlane(this.maskFunctionInternal.source + source, {
|
|
149
153
|
texture: this.texture.texture,
|
|
150
154
|
textureTransform: this.texture.calculateUVTransform(this.textureTransform),
|
|
@@ -161,5 +165,6 @@ export class UIProgress extends UIElement {
|
|
|
161
165
|
this.textureResolutionDirty = false;
|
|
162
166
|
this.maskFunctionInternal.setDirtyFalse();
|
|
163
167
|
this.micro.setDirtyFalse();
|
|
168
|
+
this.setPlacementDirtyFalse();
|
|
164
169
|
}
|
|
165
170
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Camera, Scene } from "three";
|
|
2
|
-
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
3
2
|
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
|
|
3
|
+
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
4
4
|
import type { UIElementOptions } from "../UIElement/UIElement.Internal.js";
|
|
5
5
|
/** Controls when scene re-renders */
|
|
6
6
|
export declare enum UISceneUpdateMode {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Camera, WebGLRenderer } from "three";
|
|
2
2
|
import { Scene } from "three";
|
|
3
3
|
import type { UILayer } from "../../layers/UILayer/UILayer.js";
|
|
4
|
-
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
5
4
|
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
|
|
5
|
+
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
6
6
|
import { UIElement } from "../UIElement/UIElement.js";
|
|
7
7
|
import type { UISceneOptions } from "./UIScene.Internal.js";
|
|
8
8
|
import { UISceneUpdateMode } from "./UIScene.Internal.js";
|
|
@@ -17,7 +17,6 @@ export declare class UIScene extends UIElement {
|
|
|
17
17
|
private resolutionFactorInternal;
|
|
18
18
|
private evenFrame;
|
|
19
19
|
private updateRequired;
|
|
20
|
-
private resolutionFactorDirty;
|
|
21
20
|
private propertyDirty;
|
|
22
21
|
/**
|
|
23
22
|
* Creates a new UIScene instance.
|
|
@@ -56,4 +55,6 @@ export declare class UIScene extends UIElement {
|
|
|
56
55
|
/** Frees resources of the scene */
|
|
57
56
|
protected destroyInternal(): void;
|
|
58
57
|
protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
|
|
58
|
+
/** Render target contents live on the GPU only and are gone after a context loss */
|
|
59
|
+
private readonly onContextRestored;
|
|
59
60
|
}
|