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
|
@@ -3,7 +3,7 @@ import { assertValidPositiveNumber } from "../../miscellaneous/asserts.js";
|
|
|
3
3
|
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
4
4
|
import { UIAffineMatrix3 } from "../../miscellaneous/UIAffineMatrix3.js";
|
|
5
5
|
import source from "../../shaders/UIImage.js";
|
|
6
|
-
import { DUMMY_DEFAULT_HEIGHT, DUMMY_DEFAULT_WIDTH
|
|
6
|
+
import { DUMMY_DEFAULT_HEIGHT, DUMMY_DEFAULT_WIDTH } from "../UIDummy/UIDummy.Internal.js";
|
|
7
7
|
import { UIElement } from "../UIElement/UIElement.js";
|
|
8
8
|
import { SCENE_DEFAULT_CAMERA_FAR, SCENE_DEFAULT_CAMERA_FOV, SCENE_DEFAULT_CAMERA_NEAR, SCENE_DEFAULT_CLEAR_COLOR, SCENE_DEFAULT_RESOLUTION_FACTOR, SCENE_DEFAULT_UPDATE_MODE, SCENE_DEFAULT_USE_DEPTH, SCENE_MAX_RESOLUTION_FACTOR, SCENE_MIN_RESOLUTION_FACTOR, UISceneUpdateMode, } from "./UIScene.Internal.js";
|
|
9
9
|
let previousClearColor = new Color();
|
|
@@ -40,8 +40,11 @@ export class UIScene extends UIElement {
|
|
|
40
40
|
}, options);
|
|
41
41
|
this.evenFrame = true;
|
|
42
42
|
this.updateRequired = false;
|
|
43
|
-
this.resolutionFactorDirty = false;
|
|
44
43
|
this.propertyDirty = false;
|
|
44
|
+
/** Render target contents live on the GPU only and are gone after a context loss */
|
|
45
|
+
this.onContextRestored = () => {
|
|
46
|
+
this.requestUpdate();
|
|
47
|
+
};
|
|
45
48
|
this.colorInternal = color;
|
|
46
49
|
this.clearColorInternal = new UIColor(options.clearColor ?? SCENE_DEFAULT_CLEAR_COLOR);
|
|
47
50
|
this.renderTarget = renderTarget;
|
|
@@ -52,6 +55,7 @@ export class UIScene extends UIElement {
|
|
|
52
55
|
this.resolutionFactorInternal = resolutionFactor;
|
|
53
56
|
this.updateModeInternal = options.updateMode ?? SCENE_DEFAULT_UPDATE_MODE;
|
|
54
57
|
this.propertyDirty = options.updateMode !== UISceneUpdateMode.MANUAL;
|
|
58
|
+
this.layer.signalContextRestored.on(this.onContextRestored);
|
|
55
59
|
}
|
|
56
60
|
/** Camera used for rendering */
|
|
57
61
|
get camera() {
|
|
@@ -98,7 +102,6 @@ export class UIScene extends UIElement {
|
|
|
98
102
|
value = MathUtils.clamp(value, SCENE_MIN_RESOLUTION_FACTOR, SCENE_MAX_RESOLUTION_FACTOR);
|
|
99
103
|
if (this.resolutionFactorInternal !== value) {
|
|
100
104
|
this.resolutionFactorInternal = value;
|
|
101
|
-
this.resolutionFactorDirty = true;
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
/** Three.js scene to render */
|
|
@@ -121,25 +124,27 @@ export class UIScene extends UIElement {
|
|
|
121
124
|
}
|
|
122
125
|
/** Frees resources of the scene */
|
|
123
126
|
destroyInternal() {
|
|
127
|
+
this.layer.signalContextRestored.off(this.onContextRestored);
|
|
124
128
|
this.renderTarget.dispose();
|
|
125
129
|
super.destroyInternal();
|
|
126
130
|
}
|
|
127
131
|
onWillRender(renderer, deltaTime) {
|
|
128
132
|
this.evenFrame = !this.evenFrame;
|
|
133
|
+
// Compared every frame rather than on layout changes, so a size change is kept until a frame
|
|
134
|
+
// that renders the scene applies it
|
|
135
|
+
const targetWidth = this.width * this.resolutionFactorInternal;
|
|
136
|
+
const targetHeight = this.height * this.resolutionFactorInternal;
|
|
137
|
+
const isSizeDirty = this.renderTarget.width !== targetWidth || this.renderTarget.height !== targetHeight;
|
|
129
138
|
const isFramebufferDirty = this.updateRequired ||
|
|
130
139
|
this.updateModeInternal === UISceneUpdateMode.EVERY_FRAME ||
|
|
131
|
-
(this.updateModeInternal === UISceneUpdateMode.EVERY_SECOND_FRAME &&
|
|
132
|
-
|
|
133
|
-
(this.updateModeInternal === UISceneUpdateMode.ON_PROPERTIES_CHANGE &&
|
|
134
|
-
this.propertyDirty) ||
|
|
140
|
+
(this.updateModeInternal === UISceneUpdateMode.EVERY_SECOND_FRAME && this.evenFrame) ||
|
|
141
|
+
(this.updateModeInternal === UISceneUpdateMode.ON_PROPERTIES_CHANGE && this.propertyDirty) ||
|
|
135
142
|
this.colorInternal.dirty ||
|
|
136
143
|
this.clearColorInternal.dirty ||
|
|
137
|
-
(this.updateModeInternal === UISceneUpdateMode.ON_DIMENSIONS_CHANGE &&
|
|
138
|
-
(this.resolutionFactorDirty || this.solverWrapper.dirty));
|
|
144
|
+
(this.updateModeInternal === UISceneUpdateMode.ON_DIMENSIONS_CHANGE && isSizeDirty);
|
|
139
145
|
if (isFramebufferDirty) {
|
|
140
|
-
if (
|
|
141
|
-
this.renderTarget.setSize(
|
|
142
|
-
this.resolutionFactorDirty = false;
|
|
146
|
+
if (isSizeDirty) {
|
|
147
|
+
this.renderTarget.setSize(targetWidth, targetHeight);
|
|
143
148
|
}
|
|
144
149
|
if (this.colorInternal.dirty) {
|
|
145
150
|
this.sceneWrapper.setProperties(this.planeHandler, {
|
|
@@ -156,6 +161,7 @@ export class UIScene extends UIElement {
|
|
|
156
161
|
renderer.render(this.sceneInternal, this.cameraInternal);
|
|
157
162
|
renderer.setRenderTarget(previousRenderTarget);
|
|
158
163
|
renderer.setClearColor(previousClearColor, previousClearAlpha);
|
|
164
|
+
this.clearColorInternal.setDirtyFalse();
|
|
159
165
|
this.propertyDirty = false;
|
|
160
166
|
this.updateRequired = false;
|
|
161
167
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UICanvasRenderingContext2D } from "../../miscellaneous/canvas.js";
|
|
2
2
|
import type { UITextSpan } from "../../miscellaneous/text-span/UITextSpan.js";
|
|
3
|
-
import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle.js";
|
|
4
3
|
import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal.js";
|
|
4
|
+
import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle.js";
|
|
5
5
|
import type { UIChunkMetrics, UITextChunk, UITextLine, UITextSize } from "./UIText.Interfaces.js";
|
|
6
6
|
/**
|
|
7
7
|
* Applies font of a resolved style to a canvas context.
|
|
@@ -1,9 +1,9 @@
|
|
|
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";
|
|
5
|
-
import {
|
|
4
|
+
import { UIColor } from "../../miscellaneous/color/UIColor.js";
|
|
6
5
|
import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal.js";
|
|
6
|
+
import { UIInsets } from "../../miscellaneous/insets/UIInsets.js";
|
|
7
7
|
import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan.js";
|
|
8
8
|
import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle.js";
|
|
9
9
|
import { UIElement } from "../UIElement/UIElement.js";
|
|
@@ -84,7 +84,7 @@ export declare class UIText extends UIElement {
|
|
|
84
84
|
private updateProperties;
|
|
85
85
|
private updateAutoPadding;
|
|
86
86
|
private buildTextChunks;
|
|
87
|
-
private
|
|
87
|
+
private consumeDimensionsChange;
|
|
88
88
|
private setDimensionsDirtyFalse;
|
|
89
89
|
private checkContentDirty;
|
|
90
90
|
private setContentDirtyFalse;
|
|
@@ -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 { UIInsets } from "../../miscellaneous/insets/UIInsets.js";
|
|
4
4
|
import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan.js";
|
|
@@ -21,7 +21,7 @@ export class UIText extends UIElement {
|
|
|
21
21
|
*/
|
|
22
22
|
constructor(layer, content, options = {}) {
|
|
23
23
|
const canvas = createCanvas(2, 2);
|
|
24
|
-
const context = canvas
|
|
24
|
+
const context = getCanvas2DContext(canvas);
|
|
25
25
|
if (!context) {
|
|
26
26
|
throw new Error("UIText.constructor: failed to create canvas context");
|
|
27
27
|
}
|
|
@@ -189,7 +189,7 @@ export class UIText extends UIElement {
|
|
|
189
189
|
!this.directionDirty &&
|
|
190
190
|
!this.maxLineWidthDirty &&
|
|
191
191
|
!this.paddingInternal.dirty &&
|
|
192
|
-
!(this.
|
|
192
|
+
!(this.consumeLayoutChange() &&
|
|
193
193
|
this.lastWidth / this.lastHeight !== Math.round(this.width) / Math.round(this.height)) &&
|
|
194
194
|
!this.checkContentDirty()) {
|
|
195
195
|
return;
|
|
@@ -228,7 +228,7 @@ export class UIText extends UIElement {
|
|
|
228
228
|
!this.directionDirty &&
|
|
229
229
|
!this.maxLineWidthDirty &&
|
|
230
230
|
!this.paddingInternal.dirty &&
|
|
231
|
-
!this.
|
|
231
|
+
!this.consumeDimensionsChange() &&
|
|
232
232
|
!this.checkContentDirty()) {
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
@@ -300,8 +300,8 @@ export class UIText extends UIElement {
|
|
|
300
300
|
}
|
|
301
301
|
return this.textChunks;
|
|
302
302
|
}
|
|
303
|
-
|
|
304
|
-
return (this.
|
|
303
|
+
consumeDimensionsChange() {
|
|
304
|
+
return (this.consumeLayoutChange() &&
|
|
305
305
|
(this.lastWidth !== Math.round(this.width) || this.lastHeight !== Math.round(this.height)));
|
|
306
306
|
}
|
|
307
307
|
setDimensionsDirtyFalse() {
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
export { UIConstraint2DBuilder } from "./constraints/builders/UIConstraint2DBuilder.js";
|
|
2
1
|
export type { UIConstraint2DOptions, UIConstraint2DResult, UIConstraintDistance2DOptions, UIConstraintInterpolation2DOptions, UIConstraintProportion2DOptions, UIConstraintSize2DOptions, UIType2D, UIType2DObject, } from "./constraints/builders/UIConstraint2DBuilder.Internal.js";
|
|
3
|
-
export {
|
|
2
|
+
export { UIConstraint2DBuilder } from "./constraints/builders/UIConstraint2DBuilder.js";
|
|
4
3
|
export type { UICoverConstraintBuilderOptions } from "./constraints/builders/UICoverConstraintBuilder.Internal.js";
|
|
5
|
-
export {
|
|
4
|
+
export { UICoverConstraintBuilder } from "./constraints/builders/UICoverConstraintBuilder.js";
|
|
6
5
|
export type { UIFitConstraintBuilderOptions } from "./constraints/builders/UIFitConstraintBuilder.Internal.js";
|
|
7
|
-
export {
|
|
6
|
+
export { UIFitConstraintBuilder } from "./constraints/builders/UIFitConstraintBuilder.js";
|
|
8
7
|
export type { UIAspectConstraintOptions } from "./constraints/UIAspectConstraint/UIAspectConstraint.Internal.js";
|
|
8
|
+
export { UIAspectConstraint } from "./constraints/UIAspectConstraint/UIAspectConstraint.js";
|
|
9
9
|
export { UIConstraint } from "./constraints/UIConstraint.js";
|
|
10
10
|
export { UICustomConstraint } from "./constraints/UICustomConstraint.js";
|
|
11
|
-
export { UIHeightConstraint } from "./constraints/UIHeightConstraint/UIHeightConstraint.js";
|
|
12
11
|
export type { UIHeightConstraintOptions } from "./constraints/UIHeightConstraint/UIHeightConstraint.Internal.js";
|
|
13
|
-
export {
|
|
12
|
+
export { UIHeightConstraint } from "./constraints/UIHeightConstraint/UIHeightConstraint.js";
|
|
14
13
|
export type { UIHorizontalDistanceConstraintOptions } from "./constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js";
|
|
15
|
-
export {
|
|
14
|
+
export { UIHorizontalDistanceConstraint } from "./constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js";
|
|
16
15
|
export type { UIHorizontalInterpolationConstraintOptions } from "./constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js";
|
|
17
|
-
export {
|
|
16
|
+
export { UIHorizontalInterpolationConstraint } from "./constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js";
|
|
18
17
|
export type { UIHorizontalProportionConstraintOptions } from "./constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js";
|
|
19
|
-
export {
|
|
18
|
+
export { UIHorizontalProportionConstraint } from "./constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js";
|
|
20
19
|
export type { UISingleParameterConstraintOptions } from "./constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js";
|
|
21
|
-
export {
|
|
20
|
+
export { UISingleParameterConstraint } from "./constraints/UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
22
21
|
export type { UIVerticalDistanceConstraintOptions } from "./constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js";
|
|
23
|
-
export {
|
|
22
|
+
export { UIVerticalDistanceConstraint } from "./constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js";
|
|
24
23
|
export type { UIVerticalInterpolationConstraintOptions } from "./constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js";
|
|
25
|
-
export {
|
|
24
|
+
export { UIVerticalInterpolationConstraint } from "./constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js";
|
|
26
25
|
export type { UIVerticalProportionConstraintOptions } from "./constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js";
|
|
27
|
-
export {
|
|
26
|
+
export { UIVerticalProportionConstraint } from "./constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js";
|
|
28
27
|
export type { UIWidthConstraintOptions } from "./constraints/UIWidthConstraint/UIWidthConstraint.Internal.js";
|
|
29
|
-
export {
|
|
28
|
+
export { UIWidthConstraint } from "./constraints/UIWidthConstraint/UIWidthConstraint.js";
|
|
30
29
|
export type { UIAnchorOptions } from "./elements/UIAnchor/UIAnchor.Internal.js";
|
|
31
|
-
export {
|
|
32
|
-
export { UIAnimatedImageLoopMode } from "./elements/UIAnimatedImage/UIAnimatedImage.Internal.js";
|
|
30
|
+
export { UIAnchor } from "./elements/UIAnchor/UIAnchor.js";
|
|
33
31
|
export type { UIAnimatedImageOptions } from "./elements/UIAnimatedImage/UIAnimatedImage.Internal.js";
|
|
34
|
-
export {
|
|
32
|
+
export { UIAnimatedImageLoopMode } from "./elements/UIAnimatedImage/UIAnimatedImage.Internal.js";
|
|
33
|
+
export { UIAnimatedImage } from "./elements/UIAnimatedImage/UIAnimatedImage.js";
|
|
35
34
|
export type { UIDummyOptions, UIInputEventData } from "./elements/UIDummy/UIDummy.Internal.js";
|
|
36
|
-
export {
|
|
35
|
+
export { UIDummy } from "./elements/UIDummy/UIDummy.js";
|
|
37
36
|
export type { UIElementOptions } from "./elements/UIElement/UIElement.Internal.js";
|
|
38
|
-
export {
|
|
37
|
+
export { UIElement } from "./elements/UIElement/UIElement.js";
|
|
39
38
|
export type { UIGraphicsOptions } from "./elements/UIGraphics/UIGraphics.Internal.js";
|
|
40
|
-
export {
|
|
39
|
+
export { UIGraphics } from "./elements/UIGraphics/UIGraphics.js";
|
|
41
40
|
export type { UIImageOptions } from "./elements/UIImage/UIImage.Internal.js";
|
|
42
|
-
export {
|
|
43
|
-
export { UINineSliceRegionMode } from "./elements/UINineSlice/UINineSlice.Internal.js";
|
|
41
|
+
export { UIImage } from "./elements/UIImage/UIImage.js";
|
|
44
42
|
export type { UINineSliceOptions } from "./elements/UINineSlice/UINineSlice.Internal.js";
|
|
45
|
-
export {
|
|
43
|
+
export { UINineSliceRegionMode } from "./elements/UINineSlice/UINineSlice.Internal.js";
|
|
44
|
+
export { UINineSlice } from "./elements/UINineSlice/UINineSlice.js";
|
|
46
45
|
export type { UIProgressOptions } from "./elements/UIProgress/UIProgress.Internal.js";
|
|
47
|
-
export {
|
|
48
|
-
export { UISceneUpdateMode } from "./elements/UIScene/UIScene.Internal.js";
|
|
46
|
+
export { UIProgress } from "./elements/UIProgress/UIProgress.js";
|
|
49
47
|
export type { UISceneOptions } from "./elements/UIScene/UIScene.Internal.js";
|
|
50
|
-
export {
|
|
48
|
+
export { UISceneUpdateMode } from "./elements/UIScene/UIScene.Internal.js";
|
|
49
|
+
export { UIScene } from "./elements/UIScene/UIScene.js";
|
|
51
50
|
export type { UITextContent } from "./elements/UIText/UIText.Interfaces.js";
|
|
52
|
-
export { UITextDirection, UITextResizeMode } from "./elements/UIText/UIText.Internal.js";
|
|
53
51
|
export type { UITextOptions } from "./elements/UIText/UIText.Internal.js";
|
|
54
|
-
export {
|
|
55
|
-
export
|
|
56
|
-
export { UILayer } from "./layers/UILayer/UILayer.js";
|
|
52
|
+
export { UITextDirection, UITextResizeMode } from "./elements/UIText/UIText.Internal.js";
|
|
53
|
+
export { UIText } from "./elements/UIText/UIText.js";
|
|
57
54
|
export type { UILayerMode, UILayerOptions, UILayerOrientation, } from "./layers/UILayer/UILayer.Internal.js";
|
|
55
|
+
export { UILayer } from "./layers/UILayer/UILayer.js";
|
|
56
|
+
export type { UIViewportLayerInputEventData, UIViewportLayerOptions, } from "./layers/UIViewportLayer/UIViewportLayer.Internal.js";
|
|
57
|
+
export { UIViewportLayer } from "./layers/UIViewportLayer/UIViewportLayer.js";
|
|
58
58
|
export { UIArea } from "./miscellaneous/area/UIArea.js";
|
|
59
59
|
export { UIAreaCircle } from "./miscellaneous/area/UIAreaCircle.js";
|
|
60
60
|
export { UIAreaPolygon } from "./miscellaneous/area/UIAreaPolygon.js";
|
|
61
61
|
export { UIAreaRectangle } from "./miscellaneous/area/UIAreaRectangle.js";
|
|
62
62
|
export { UIAreaRoundedRectangle } from "./miscellaneous/area/UIAreaRoundedRectangle.js";
|
|
63
63
|
export type { UICanvas, UICanvasRenderingContext2D } from "./miscellaneous/canvas.js";
|
|
64
|
-
export { UIColor } from "./miscellaneous/color/UIColor.js";
|
|
65
64
|
export type { UIColorConfig, UIColorName } from "./miscellaneous/color/UIColor.Internal.js";
|
|
65
|
+
export { UIColor } from "./miscellaneous/color/UIColor.js";
|
|
66
66
|
export { computeTransformMatrix } from "./miscellaneous/computeTransform.js";
|
|
67
67
|
export type { HSLAdjustment, UIProperty, UIPropertyName, } from "./miscellaneous/generic-plane/shared.js";
|
|
68
|
-
export { UIInsets } from "./miscellaneous/insets/UIInsets.js";
|
|
69
68
|
export type { UIInsetsConfig } from "./miscellaneous/insets/UIInsets.Internal.js";
|
|
69
|
+
export { UIInsets } from "./miscellaneous/insets/UIInsets.js";
|
|
70
|
+
export type { UIMaskOptions } from "./miscellaneous/mask/UIMask.Internal.js";
|
|
71
|
+
export { UIMaskShape } from "./miscellaneous/mask/UIMask.Internal.js";
|
|
72
|
+
export { UIMask } from "./miscellaneous/mask/UIMask.js";
|
|
73
|
+
export { UIMaskMaterialPatch } from "./miscellaneous/mask/UIMaskMaterialPatch.js";
|
|
70
74
|
export { UIProgressMaskFunction } from "./miscellaneous/mask-function/UIProgressMaskFunction.js";
|
|
71
75
|
export { UIProgressMaskFunctionCircular } from "./miscellaneous/mask-function/UIProgressMaskFunctionCircular.js";
|
|
72
76
|
export { UIProgressMaskFunctionDirectional } from "./miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js";
|
|
73
|
-
export { UIMask } from "./miscellaneous/mask/UIMask.js";
|
|
74
|
-
export { UIMaskShape } from "./miscellaneous/mask/UIMask.Internal.js";
|
|
75
|
-
export type { UIMaskOptions } from "./miscellaneous/mask/UIMask.Internal.js";
|
|
76
|
-
export { UIMaskMaterialPatch } from "./miscellaneous/mask/UIMaskMaterialPatch.js";
|
|
77
77
|
export type { Vector2Like } from "./miscellaneous/math.js";
|
|
78
|
-
export { UIMicro } from "./miscellaneous/micro/UIMicro.js";
|
|
79
|
-
export { UIMicroAnchorMode } from "./miscellaneous/micro/UIMicro.Internal.js";
|
|
80
78
|
export type { UIMicroConfig } from "./miscellaneous/micro/UIMicro.Internal.js";
|
|
79
|
+
export { UIMicroAnchorMode } from "./miscellaneous/micro/UIMicro.Internal.js";
|
|
80
|
+
export { UIMicro } from "./miscellaneous/micro/UIMicro.js";
|
|
81
81
|
export { UIResizePolicy } from "./miscellaneous/resize-policy/UIResizePolicy.js";
|
|
82
82
|
export { UIResizePolicyCover } from "./miscellaneous/resize-policy/UIResizePolicyCover.js";
|
|
83
83
|
export { UIResizePolicyCross } from "./miscellaneous/resize-policy/UIResizePolicyCross.js";
|
|
@@ -87,12 +87,12 @@ export { UIResizePolicyFixedHeight } from "./miscellaneous/resize-policy/UIResiz
|
|
|
87
87
|
export { UIResizePolicyFixedWidth } from "./miscellaneous/resize-policy/UIResizePolicyFixedWidth.js";
|
|
88
88
|
export { UIResizePolicyNone } from "./miscellaneous/resize-policy/UIResizePolicyNone.js";
|
|
89
89
|
export type { UILayerElement, UIPlaneElement, UIPointElement } from "./miscellaneous/shared.js";
|
|
90
|
-
export { UITextSpan } from "./miscellaneous/text-span/UITextSpan.js";
|
|
91
90
|
export type { UITextSpanConfig } from "./miscellaneous/text-span/UITextSpan.Internal.js";
|
|
92
|
-
export {
|
|
91
|
+
export { UITextSpan } from "./miscellaneous/text-span/UITextSpan.js";
|
|
93
92
|
export type { UITextAlign, UITextStyleConfig, } from "./miscellaneous/text-style/UITextStyle.Internal.js";
|
|
94
|
-
export {
|
|
93
|
+
export { UITextStyle } from "./miscellaneous/text-style/UITextStyle.js";
|
|
95
94
|
export type { UITextureAtlasConfig, UITextureConfig, UITextureRect, UITextureSize, UITextureTrim, } from "./miscellaneous/texture/UITextureView.Internal.js";
|
|
95
|
+
export { UITextureView } from "./miscellaneous/texture/UITextureView.js";
|
|
96
96
|
export { UIAffineMatrix3 } from "./miscellaneous/UIAffineMatrix3.js";
|
|
97
97
|
export { UIBlendMode } from "./miscellaneous/UIBlendMode.js";
|
|
98
98
|
export { UIExpression } from "./miscellaneous/UIExpression.js";
|
|
@@ -101,4 +101,7 @@ export { UIOrientation } from "./miscellaneous/UIOrientation.js";
|
|
|
101
101
|
export { UIPriority } from "./miscellaneous/UIPriority.js";
|
|
102
102
|
export { UIRelation } from "./miscellaneous/UIRelation.js";
|
|
103
103
|
export { UITransparencyMode } from "./miscellaneous/UITransparencyMode.js";
|
|
104
|
+
export { UIElementViewport } from "./miscellaneous/viewport/UIElementViewport.js";
|
|
105
|
+
export { UIViewport } from "./miscellaneous/viewport/UIViewport.js";
|
|
106
|
+
export { UIWindowViewport } from "./miscellaneous/viewport/UIWindowViewport.js";
|
|
104
107
|
export type { UISceneWrapperView } from "./wrappers/UISceneWrapper/UISceneWrapper.Internal.js";
|
package/dist/core/index.js
CHANGED
|
@@ -14,21 +14,21 @@ export { UIVerticalInterpolationConstraint } from "./constraints/UIVerticalInter
|
|
|
14
14
|
export { UIVerticalProportionConstraint } from "./constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js";
|
|
15
15
|
export { UIWidthConstraint } from "./constraints/UIWidthConstraint/UIWidthConstraint.js";
|
|
16
16
|
export { UIAnchor } from "./elements/UIAnchor/UIAnchor.js";
|
|
17
|
-
export { UIAnimatedImage } from "./elements/UIAnimatedImage/UIAnimatedImage.js";
|
|
18
17
|
export { UIAnimatedImageLoopMode } from "./elements/UIAnimatedImage/UIAnimatedImage.Internal.js";
|
|
18
|
+
export { UIAnimatedImage } from "./elements/UIAnimatedImage/UIAnimatedImage.js";
|
|
19
19
|
export { UIDummy } from "./elements/UIDummy/UIDummy.js";
|
|
20
20
|
export { UIElement } from "./elements/UIElement/UIElement.js";
|
|
21
21
|
export { UIGraphics } from "./elements/UIGraphics/UIGraphics.js";
|
|
22
22
|
export { UIImage } from "./elements/UIImage/UIImage.js";
|
|
23
|
-
export { UINineSlice } from "./elements/UINineSlice/UINineSlice.js";
|
|
24
23
|
export { UINineSliceRegionMode } from "./elements/UINineSlice/UINineSlice.Internal.js";
|
|
24
|
+
export { UINineSlice } from "./elements/UINineSlice/UINineSlice.js";
|
|
25
25
|
export { UIProgress } from "./elements/UIProgress/UIProgress.js";
|
|
26
|
-
export { UIScene } from "./elements/UIScene/UIScene.js";
|
|
27
26
|
export { UISceneUpdateMode } from "./elements/UIScene/UIScene.Internal.js";
|
|
28
|
-
export {
|
|
27
|
+
export { UIScene } from "./elements/UIScene/UIScene.js";
|
|
29
28
|
export { UITextDirection, UITextResizeMode } from "./elements/UIText/UIText.Internal.js";
|
|
30
|
-
export {
|
|
29
|
+
export { UIText } from "./elements/UIText/UIText.js";
|
|
31
30
|
export { UILayer } from "./layers/UILayer/UILayer.js";
|
|
31
|
+
export { UIViewportLayer } from "./layers/UIViewportLayer/UIViewportLayer.js";
|
|
32
32
|
export { UIArea } from "./miscellaneous/area/UIArea.js";
|
|
33
33
|
export { UIAreaCircle } from "./miscellaneous/area/UIAreaCircle.js";
|
|
34
34
|
export { UIAreaPolygon } from "./miscellaneous/area/UIAreaPolygon.js";
|
|
@@ -37,14 +37,14 @@ export { UIAreaRoundedRectangle } from "./miscellaneous/area/UIAreaRoundedRectan
|
|
|
37
37
|
export { UIColor } from "./miscellaneous/color/UIColor.js";
|
|
38
38
|
export { computeTransformMatrix } from "./miscellaneous/computeTransform.js";
|
|
39
39
|
export { UIInsets } from "./miscellaneous/insets/UIInsets.js";
|
|
40
|
+
export { UIMaskShape } from "./miscellaneous/mask/UIMask.Internal.js";
|
|
41
|
+
export { UIMask } from "./miscellaneous/mask/UIMask.js";
|
|
42
|
+
export { UIMaskMaterialPatch } from "./miscellaneous/mask/UIMaskMaterialPatch.js";
|
|
40
43
|
export { UIProgressMaskFunction } from "./miscellaneous/mask-function/UIProgressMaskFunction.js";
|
|
41
44
|
export { UIProgressMaskFunctionCircular } from "./miscellaneous/mask-function/UIProgressMaskFunctionCircular.js";
|
|
42
45
|
export { UIProgressMaskFunctionDirectional } from "./miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js";
|
|
43
|
-
export { UIMask } from "./miscellaneous/mask/UIMask.js";
|
|
44
|
-
export { UIMaskShape } from "./miscellaneous/mask/UIMask.Internal.js";
|
|
45
|
-
export { UIMaskMaterialPatch } from "./miscellaneous/mask/UIMaskMaterialPatch.js";
|
|
46
|
-
export { UIMicro } from "./miscellaneous/micro/UIMicro.js";
|
|
47
46
|
export { UIMicroAnchorMode } from "./miscellaneous/micro/UIMicro.Internal.js";
|
|
47
|
+
export { UIMicro } from "./miscellaneous/micro/UIMicro.js";
|
|
48
48
|
export { UIResizePolicy } from "./miscellaneous/resize-policy/UIResizePolicy.js";
|
|
49
49
|
export { UIResizePolicyCover } from "./miscellaneous/resize-policy/UIResizePolicyCover.js";
|
|
50
50
|
export { UIResizePolicyCross } from "./miscellaneous/resize-policy/UIResizePolicyCross.js";
|
|
@@ -64,3 +64,6 @@ export { UIOrientation } from "./miscellaneous/UIOrientation.js";
|
|
|
64
64
|
export { UIPriority } from "./miscellaneous/UIPriority.js";
|
|
65
65
|
export { UIRelation } from "./miscellaneous/UIRelation.js";
|
|
66
66
|
export { UITransparencyMode } from "./miscellaneous/UITransparencyMode.js";
|
|
67
|
+
export { UIElementViewport } from "./miscellaneous/viewport/UIElementViewport.js";
|
|
68
|
+
export { UIViewport } from "./miscellaneous/viewport/UIViewport.js";
|
|
69
|
+
export { UIWindowViewport } from "./miscellaneous/viewport/UIWindowViewport.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { FerrsignView2, FerrsignView3 } from "ferrsign";
|
|
1
|
+
import type { FerrsignView1, FerrsignView2, FerrsignView3 } from "ferrsign";
|
|
2
2
|
import type { WebGLRenderer } from "three";
|
|
3
|
-
import type { UIPlaneElement } from "../../miscellaneous/shared.js";
|
|
4
3
|
import type { UIConstraint } from "../../constraints/UIConstraint.js";
|
|
5
4
|
import type { UIAnchor } from "../../elements/UIAnchor/UIAnchor.js";
|
|
6
5
|
import type { UIMask } from "../../miscellaneous/mask/UIMask.js";
|
|
6
|
+
import type { UIPlaneElement } from "../../miscellaneous/shared.js";
|
|
7
7
|
import { UIInputWrapper } from "../../wrappers/UIInputWrapper/UIInputWrapper.js";
|
|
8
8
|
import type { UISceneWrapperView } from "../../wrappers/UISceneWrapper/UISceneWrapper.Internal.js";
|
|
9
9
|
import type { UILayerMode, UILayerOptions, UILayerOrientation } from "./UILayer.Internal.js";
|
|
@@ -28,11 +28,14 @@ export declare abstract class UILayer implements UIPlaneElement {
|
|
|
28
28
|
private readonly signalModeChangedInternal;
|
|
29
29
|
private readonly signalRenderingInternal;
|
|
30
30
|
private readonly signalResizedInternal;
|
|
31
|
+
private readonly signalContextLostInternal;
|
|
32
|
+
private readonly signalContextRestoredInternal;
|
|
31
33
|
private readonly signalConstraintAddedInternal;
|
|
32
34
|
private readonly signalConstraintRemovedInternal;
|
|
33
35
|
private readonly constraintRegistryInternal;
|
|
34
36
|
private readonly elementRegistryInternal;
|
|
35
37
|
private readonly maskRegistryInternal;
|
|
38
|
+
private contextMonitor;
|
|
36
39
|
private destroyedInternal;
|
|
37
40
|
constructor(options: Partial<UILayerOptions>);
|
|
38
41
|
/**
|
|
@@ -68,7 +71,20 @@ export declare abstract class UILayer implements UIPlaneElement {
|
|
|
68
71
|
get signalRendering(): FerrsignView3<WebGLRenderer, number, UILayer>;
|
|
69
72
|
/** Signal fired when layer resized */
|
|
70
73
|
get signalResized(): FerrsignView3<number, number, UILayer>;
|
|
71
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Signal fired when the WebGL context of the renderer the layer is drawn with is lost. The
|
|
76
|
+
* layer draws nothing until the context is restored; pause what depends on frames being shown.
|
|
77
|
+
*/
|
|
78
|
+
get signalContextLost(): FerrsignView1<UILayer>;
|
|
79
|
+
/**
|
|
80
|
+
* Signal fired when the WebGL context is restored. The renderer has recreated its GL state by
|
|
81
|
+
* then; content that lives on the GPU only, such as render targets, has to be redrawn.
|
|
82
|
+
*/
|
|
83
|
+
get signalContextRestored(): FerrsignView1<UILayer>;
|
|
84
|
+
/**
|
|
85
|
+
* Signal fired when a constraint is added. It fires from the base constructor, before the
|
|
86
|
+
* fields of the subclass are set: read them no sooner than in a microtask or on the next frame.
|
|
87
|
+
*/
|
|
72
88
|
get signalConstraintAdded(): FerrsignView2<UILayer, UIConstraint>;
|
|
73
89
|
/** Signal fired when a constraint is removed */
|
|
74
90
|
get signalConstraintRemoved(): FerrsignView2<UILayer, UIConstraint>;
|
|
@@ -80,7 +96,10 @@ export declare abstract class UILayer implements UIPlaneElement {
|
|
|
80
96
|
get maskRegistry(): readonly UIMask[];
|
|
81
97
|
/** Whether the layer is destroyed */
|
|
82
98
|
get destroyed(): boolean;
|
|
83
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Updates visibility and interactivity mode. A layer that stops taking input cancels the
|
|
101
|
+
* pressed pointers: their releases would never arrive.
|
|
102
|
+
*/
|
|
84
103
|
set mode(value: UILayerMode);
|
|
85
104
|
/**
|
|
86
105
|
* Destroys all elements, constraints and masks of the layer, those tied to the layer itself
|
|
@@ -90,6 +109,23 @@ export declare abstract class UILayer implements UIPlaneElement {
|
|
|
90
109
|
destroy(): void;
|
|
91
110
|
protected resizeInternal(width: number, height: number): void;
|
|
92
111
|
protected renderInternal(renderer: WebGLRenderer, deltaTime: number): void;
|
|
112
|
+
/**
|
|
113
|
+
* Cancels every pressed pointer, for its elements and for the layer: no release of those
|
|
114
|
+
* pointers will be reported.
|
|
115
|
+
*/
|
|
116
|
+
protected cancelPointers(): void;
|
|
117
|
+
/** Follows the context of the renderer the layer is drawn with; null to stop following */
|
|
118
|
+
private bindContextMonitor;
|
|
119
|
+
private readonly onContextLost;
|
|
120
|
+
private readonly onContextRestored;
|
|
93
121
|
/** A removal signal handler may destroy other constraints, so the registry is walked over a copy */
|
|
94
122
|
private destroyConstraints;
|
|
123
|
+
/**
|
|
124
|
+
* Called for each pointer the layer cancels, before its elements are told: the subclass that
|
|
125
|
+
* takes the input reports the cancel to the users of the layer.
|
|
126
|
+
* @param x Last known horizontal position in layer coordinates
|
|
127
|
+
* @param y Last known vertical position in layer coordinates
|
|
128
|
+
* @param identifier Pointer identifier
|
|
129
|
+
*/
|
|
130
|
+
protected abstract reportPointerCancelledByLayer(x: number, y: number, identifier: number): void;
|
|
95
131
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Ferrsign2, Ferrsign3 } from "ferrsign";
|
|
1
|
+
import { Ferrsign1, Ferrsign2, Ferrsign3 } from "ferrsign";
|
|
2
2
|
import { assertValidPositiveNumber } from "../../miscellaneous/asserts.js";
|
|
3
|
-
import {
|
|
3
|
+
import { UIContextMonitor } from "../../miscellaneous/context-monitor/UIContextMonitor.js";
|
|
4
|
+
import { isUIModeInteractive, isUIModeVisible } from "../../miscellaneous/UIMode.js";
|
|
4
5
|
import { UIOrientation } from "../../miscellaneous/UIOrientation.js";
|
|
5
6
|
import { UIPriority } from "../../miscellaneous/UIPriority.js";
|
|
6
7
|
import { UIInputWrapper } from "../../wrappers/UIInputWrapper/UIInputWrapper.js";
|
|
@@ -18,12 +19,21 @@ export class UILayer {
|
|
|
18
19
|
this.signalModeChangedInternal = new Ferrsign2();
|
|
19
20
|
this.signalRenderingInternal = new Ferrsign3();
|
|
20
21
|
this.signalResizedInternal = new Ferrsign3();
|
|
22
|
+
this.signalContextLostInternal = new Ferrsign1();
|
|
23
|
+
this.signalContextRestoredInternal = new Ferrsign1();
|
|
21
24
|
this.signalConstraintAddedInternal = new Ferrsign2();
|
|
22
25
|
this.signalConstraintRemovedInternal = new Ferrsign2();
|
|
23
26
|
this.constraintRegistryInternal = [];
|
|
24
27
|
this.elementRegistryInternal = [];
|
|
25
28
|
this.maskRegistryInternal = [];
|
|
29
|
+
this.contextMonitor = null;
|
|
26
30
|
this.destroyedInternal = false;
|
|
31
|
+
this.onContextLost = () => {
|
|
32
|
+
this.signalContextLostInternal.emit(this);
|
|
33
|
+
};
|
|
34
|
+
this.onContextRestored = () => {
|
|
35
|
+
this.signalContextRestoredInternal.emit(this);
|
|
36
|
+
};
|
|
27
37
|
if (options.width !== undefined) {
|
|
28
38
|
assertValidPositiveNumber(options.width, "UILayer.constructor.options.width");
|
|
29
39
|
}
|
|
@@ -112,7 +122,24 @@ export class UILayer {
|
|
|
112
122
|
get signalResized() {
|
|
113
123
|
return this.signalResizedInternal;
|
|
114
124
|
}
|
|
115
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Signal fired when the WebGL context of the renderer the layer is drawn with is lost. The
|
|
127
|
+
* layer draws nothing until the context is restored; pause what depends on frames being shown.
|
|
128
|
+
*/
|
|
129
|
+
get signalContextLost() {
|
|
130
|
+
return this.signalContextLostInternal;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Signal fired when the WebGL context is restored. The renderer has recreated its GL state by
|
|
134
|
+
* then; content that lives on the GPU only, such as render targets, has to be redrawn.
|
|
135
|
+
*/
|
|
136
|
+
get signalContextRestored() {
|
|
137
|
+
return this.signalContextRestoredInternal;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Signal fired when a constraint is added. It fires from the base constructor, before the
|
|
141
|
+
* fields of the subclass are set: read them no sooner than in a microtask or on the next frame.
|
|
142
|
+
*/
|
|
116
143
|
get signalConstraintAdded() {
|
|
117
144
|
return this.signalConstraintAddedInternal;
|
|
118
145
|
}
|
|
@@ -136,10 +163,16 @@ export class UILayer {
|
|
|
136
163
|
get destroyed() {
|
|
137
164
|
return this.destroyedInternal;
|
|
138
165
|
}
|
|
139
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Updates visibility and interactivity mode. A layer that stops taking input cancels the
|
|
168
|
+
* pressed pointers: their releases would never arrive.
|
|
169
|
+
*/
|
|
140
170
|
set mode(value) {
|
|
141
171
|
if (value !== this.modeInternal) {
|
|
142
172
|
this.modeInternal = value;
|
|
173
|
+
if (!isUIModeInteractive(value)) {
|
|
174
|
+
this.cancelPointers();
|
|
175
|
+
}
|
|
143
176
|
this.signalModeChangedInternal.emit(this.modeInternal, this);
|
|
144
177
|
}
|
|
145
178
|
}
|
|
@@ -153,6 +186,7 @@ export class UILayer {
|
|
|
153
186
|
return;
|
|
154
187
|
}
|
|
155
188
|
this.destroyedInternal = true;
|
|
189
|
+
this.bindContextMonitor(null);
|
|
156
190
|
for (const element of [...this.elementRegistryInternal]) {
|
|
157
191
|
element.destroy();
|
|
158
192
|
}
|
|
@@ -233,10 +267,12 @@ export class UILayer {
|
|
|
233
267
|
this.solverWrapperInternal.suggestVariableValue(this.wVariable, width);
|
|
234
268
|
this.solverWrapperInternal.suggestVariableValue(this.hVariable, height);
|
|
235
269
|
this.sceneWrapperInternal.resize(width, height);
|
|
236
|
-
|
|
270
|
+
// Updated before the signals, so that a resize handler reads the new orientation
|
|
237
271
|
const orientation = width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
|
|
238
|
-
|
|
239
|
-
|
|
272
|
+
const orientationChanged = orientation !== this.orientationInternal;
|
|
273
|
+
this.orientationInternal = orientation;
|
|
274
|
+
this.signalResizedInternal.emit(width, height, this);
|
|
275
|
+
if (orientationChanged) {
|
|
240
276
|
this.signalOrientationChangedInternal.emit(this.orientationInternal, this);
|
|
241
277
|
}
|
|
242
278
|
}
|
|
@@ -244,6 +280,13 @@ export class UILayer {
|
|
|
244
280
|
if (this.destroyedInternal) {
|
|
245
281
|
return;
|
|
246
282
|
}
|
|
283
|
+
// While the context is lost the frame is skipped as a whole: elements compare versions, so
|
|
284
|
+
// nothing changed meanwhile is lost once drawing resumes
|
|
285
|
+
const contextMonitor = UIContextMonitor.for(renderer);
|
|
286
|
+
this.bindContextMonitor(contextMonitor);
|
|
287
|
+
if (contextMonitor.lost) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
247
290
|
if (isUIModeVisible(this.mode)) {
|
|
248
291
|
this.signalRenderingInternal.emit(renderer, deltaTime, this);
|
|
249
292
|
if (this.destroyed) {
|
|
@@ -251,8 +294,26 @@ export class UILayer {
|
|
|
251
294
|
}
|
|
252
295
|
this.sceneWrapperInternal.render(renderer);
|
|
253
296
|
}
|
|
254
|
-
|
|
255
|
-
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Cancels every pressed pointer, for its elements and for the layer: no release of those
|
|
300
|
+
* pointers will be reported.
|
|
301
|
+
*/
|
|
302
|
+
cancelPointers() {
|
|
303
|
+
this.inputWrapperInternal.cancelPointers((x, y, identifier) => {
|
|
304
|
+
this.reportPointerCancelledByLayer(x, y, identifier);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/** Follows the context of the renderer the layer is drawn with; null to stop following */
|
|
308
|
+
bindContextMonitor(monitor) {
|
|
309
|
+
if (monitor === this.contextMonitor) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this.contextMonitor?.signalLost.off(this.onContextLost);
|
|
313
|
+
this.contextMonitor?.signalRestored.off(this.onContextRestored);
|
|
314
|
+
this.contextMonitor = monitor;
|
|
315
|
+
monitor?.signalLost.on(this.onContextLost);
|
|
316
|
+
monitor?.signalRestored.on(this.onContextRestored);
|
|
256
317
|
}
|
|
257
318
|
/** A removal signal handler may destroy other constraints, so the registry is walked over a copy */
|
|
258
319
|
destroyConstraints(predicate) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { UIResizePolicy } from "../../miscellaneous/resize-policy/UIResizePolicy.js";
|
|
2
|
+
import { UIResizePolicyNone } from "../../miscellaneous/resize-policy/UIResizePolicyNone.js";
|
|
3
|
+
import type { UIViewport } from "../../miscellaneous/viewport/UIViewport.js";
|
|
4
|
+
import type { UILayerOptions } from "../UILayer/UILayer.Internal.js";
|
|
5
|
+
import type { UIViewportLayer } from "./UIViewportLayer.js";
|
|
6
|
+
/** Viewport layer input event data */
|
|
7
|
+
export interface UIViewportLayerInputEventData {
|
|
8
|
+
/** X coordinate */
|
|
9
|
+
x: number;
|
|
10
|
+
/** Y coordinate */
|
|
11
|
+
y: number;
|
|
12
|
+
/** Pointer identifier */
|
|
13
|
+
identifier: number;
|
|
14
|
+
/** Layer that emitted the event */
|
|
15
|
+
layer: UIViewportLayer;
|
|
16
|
+
}
|
|
17
|
+
/** Configuration for viewport layer */
|
|
18
|
+
export interface UIViewportLayerOptions extends Omit<UILayerOptions, "width" | "height"> {
|
|
19
|
+
/** Strategy for scaling the viewport size to the layer size */
|
|
20
|
+
resizePolicy: UIResizePolicy;
|
|
21
|
+
/**
|
|
22
|
+
* Part of the page the layer covers; the whole window by default. A viewport passed here
|
|
23
|
+
* belongs to the caller and is not destroyed with the layer.
|
|
24
|
+
*/
|
|
25
|
+
viewport: UIViewport;
|
|
26
|
+
}
|
|
27
|
+
export declare const VIEWPORT_LAYER_DEFAULT_RESIZE_POLICY: UIResizePolicyNone;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UIResizePolicyNone } from "../../miscellaneous/resize-policy/UIResizePolicyNone.js";
|
|
2
|
-
export const
|
|
2
|
+
export const VIEWPORT_LAYER_DEFAULT_RESIZE_POLICY = new UIResizePolicyNone();
|