laymur 0.26.0 → 0.27.1
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 +80 -36
- 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 +10 -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.Internal.js +2 -1
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +1 -1
- package/dist/core/miscellaneous/mask/UIMaskMaterialPatch.js +2 -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.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +3 -3
- 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.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +3 -3
- 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 +8 -7
- package/dist/debug/UIHeightDebug.js +8 -4
- package/dist/debug/UIHorizontalDistanceDebug.js +9 -7
- package/dist/debug/UIHorizontalInterpolationDebug.js +16 -10
- package/dist/debug/UILayerDebug.d.ts +7 -0
- package/dist/debug/UILayerDebug.js +21 -0
- package/dist/debug/UIVerticalDistanceDebug.js +9 -7
- package/dist/debug/UIVerticalInterpolationDebug.js +16 -10
- package/dist/debug/UIWidthDebug.js +8 -4
- package/dist/debug/index.d.ts +1 -1
- package/dist/debug/miscellaneous.d.ts +7 -0
- package/dist/debug/miscellaneous.js +11 -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 +34 -22
- 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,6 +1,6 @@
|
|
|
1
1
|
import { assertValidPositiveNumber } from "../asserts.js";
|
|
2
2
|
import { UIResizePolicy } from "./UIResizePolicy.js";
|
|
3
|
-
/** Scales area
|
|
3
|
+
/** Scales area so the rect covers it preserving proportions (like CSS object-fit: cover) */
|
|
4
4
|
export class UIResizePolicyCover extends UIResizePolicy {
|
|
5
5
|
/**
|
|
6
6
|
* Creates cover resize policy.
|
|
@@ -28,7 +28,7 @@ export class UIResizePolicyCover extends UIResizePolicy {
|
|
|
28
28
|
assertValidPositiveNumber(value, "UIResizePolicyCover.rectWidth");
|
|
29
29
|
if (value !== this.rectWidthInternal) {
|
|
30
30
|
this.rectWidthInternal = value;
|
|
31
|
-
this.
|
|
31
|
+
this.markChanged();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/** Target rect height */
|
|
@@ -36,7 +36,7 @@ export class UIResizePolicyCover extends UIResizePolicy {
|
|
|
36
36
|
assertValidPositiveNumber(value, "UIResizePolicyCover.rectHeight");
|
|
37
37
|
if (value !== this.rectHeightInternal) {
|
|
38
38
|
this.rectHeightInternal = value;
|
|
39
|
-
this.
|
|
39
|
+
this.markChanged();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
calculateScale(width, height) {
|
|
@@ -28,7 +28,7 @@ export class UIResizePolicyCross extends UIResizePolicy {
|
|
|
28
28
|
assertValidPositiveNumber(value, "UIResizePolicyCross.fixedWidthLandscape");
|
|
29
29
|
if (value !== this.fixedWidthLandscapeInternal) {
|
|
30
30
|
this.fixedWidthLandscapeInternal = value;
|
|
31
|
-
this.
|
|
31
|
+
this.markChanged();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/** Target height when portrait */
|
|
@@ -36,7 +36,7 @@ export class UIResizePolicyCross extends UIResizePolicy {
|
|
|
36
36
|
assertValidPositiveNumber(value, "UIResizePolicyCross.fixedHeightPortrait");
|
|
37
37
|
if (value !== this.fixedHeightPortraitInternal) {
|
|
38
38
|
this.fixedHeightPortraitInternal = value;
|
|
39
|
-
this.
|
|
39
|
+
this.markChanged();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
calculateScale(width, height) {
|
|
@@ -28,7 +28,7 @@ export class UIResizePolicyCrossInverted extends UIResizePolicy {
|
|
|
28
28
|
assertValidPositiveNumber(value, "UIResizePolicyCrossInverted.fixedHeightLandscape");
|
|
29
29
|
if (value !== this.fixedHeightLandscapeInternal) {
|
|
30
30
|
this.fixedHeightLandscapeInternal = value;
|
|
31
|
-
this.
|
|
31
|
+
this.markChanged();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/** Target width when portrait */
|
|
@@ -36,7 +36,7 @@ export class UIResizePolicyCrossInverted extends UIResizePolicy {
|
|
|
36
36
|
assertValidPositiveNumber(value, "UIResizePolicyCrossInverted.fixedWidthPortrait");
|
|
37
37
|
if (value !== this.fixedWidthPortraitInternal) {
|
|
38
38
|
this.fixedWidthPortraitInternal = value;
|
|
39
|
-
this.
|
|
39
|
+
this.markChanged();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
calculateScale(width, height) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UIResizePolicy } from "./UIResizePolicy.js";
|
|
2
|
-
/** Scales area
|
|
2
|
+
/** Scales area so the rect fits inside it preserving proportions (like CSS object-fit: contain) */
|
|
3
3
|
export declare class UIResizePolicyFit extends UIResizePolicy {
|
|
4
4
|
private rectWidthInternal;
|
|
5
5
|
private rectHeightInternal;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertValidPositiveNumber } from "../asserts.js";
|
|
2
2
|
import { UIResizePolicy } from "./UIResizePolicy.js";
|
|
3
|
-
/** Scales area
|
|
3
|
+
/** Scales area so the rect fits inside it preserving proportions (like CSS object-fit: contain) */
|
|
4
4
|
export class UIResizePolicyFit extends UIResizePolicy {
|
|
5
5
|
/**
|
|
6
6
|
* Creates fit resize policy.
|
|
@@ -28,7 +28,7 @@ export class UIResizePolicyFit extends UIResizePolicy {
|
|
|
28
28
|
assertValidPositiveNumber(value, "UIResizePolicyFit.rectWidth");
|
|
29
29
|
if (value !== this.rectWidthInternal) {
|
|
30
30
|
this.rectWidthInternal = value;
|
|
31
|
-
this.
|
|
31
|
+
this.markChanged();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/** Target rect height */
|
|
@@ -36,7 +36,7 @@ export class UIResizePolicyFit extends UIResizePolicy {
|
|
|
36
36
|
assertValidPositiveNumber(value, "UIResizePolicyFit.rectHeight");
|
|
37
37
|
if (value !== this.rectHeightInternal) {
|
|
38
38
|
this.rectHeightInternal = value;
|
|
39
|
-
this.
|
|
39
|
+
this.markChanged();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
calculateScale(width, height) {
|
|
@@ -28,7 +28,7 @@ export class UIResizePolicyFixedHeight extends UIResizePolicy {
|
|
|
28
28
|
assertValidPositiveNumber(value, "UIResizePolicyFixedHeight.fixedHeightLandscape");
|
|
29
29
|
if (value !== this.fixedHeightLandscapeInternal) {
|
|
30
30
|
this.fixedHeightLandscapeInternal = value;
|
|
31
|
-
this.
|
|
31
|
+
this.markChanged();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/** Target height when portrait */
|
|
@@ -36,7 +36,7 @@ export class UIResizePolicyFixedHeight extends UIResizePolicy {
|
|
|
36
36
|
assertValidPositiveNumber(value, "UIResizePolicyFixedHeight.fixedHeightPortrait");
|
|
37
37
|
if (value !== this.fixedHeightPortraitInternal) {
|
|
38
38
|
this.fixedHeightPortraitInternal = value;
|
|
39
|
-
this.
|
|
39
|
+
this.markChanged();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
calculateScale(width, height) {
|
|
@@ -28,7 +28,7 @@ export class UIResizePolicyFixedWidth extends UIResizePolicy {
|
|
|
28
28
|
assertValidPositiveNumber(value, "UIResizePolicyFixedWidth.fixedWidthLandscape");
|
|
29
29
|
if (value !== this.fixedWidthLandscapeInternal) {
|
|
30
30
|
this.fixedWidthLandscapeInternal = value;
|
|
31
|
-
this.
|
|
31
|
+
this.markChanged();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/** Target width when portrait */
|
|
@@ -36,7 +36,7 @@ export class UIResizePolicyFixedWidth extends UIResizePolicy {
|
|
|
36
36
|
assertValidPositiveNumber(value, "UIResizePolicyFixedWidth.fixedWidthPortrait");
|
|
37
37
|
if (value !== this.fixedWidthPortraitInternal) {
|
|
38
38
|
this.fixedWidthPortraitInternal = value;
|
|
39
|
-
this.
|
|
39
|
+
this.markChanged();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
calculateScale(width, height) {
|
|
@@ -148,7 +148,7 @@ export class UITextStyle {
|
|
|
148
148
|
}
|
|
149
149
|
set shadowOffsetX(value) {
|
|
150
150
|
if (value !== undefined) {
|
|
151
|
-
|
|
151
|
+
assertValidNumber(value, "UITextStyle.shadowOffsetX");
|
|
152
152
|
}
|
|
153
153
|
if (value !== this.shadowOffsetXInternal) {
|
|
154
154
|
this.shadowOffsetXInternal = value;
|
|
@@ -157,7 +157,7 @@ export class UITextStyle {
|
|
|
157
157
|
}
|
|
158
158
|
set shadowOffsetY(value) {
|
|
159
159
|
if (value !== undefined) {
|
|
160
|
-
|
|
160
|
+
assertValidNumber(value, "UITextStyle.shadowOffsetY");
|
|
161
161
|
}
|
|
162
162
|
if (value !== this.shadowOffsetYInternal) {
|
|
163
163
|
this.shadowOffsetYInternal = value;
|
|
@@ -27,7 +27,10 @@ export declare class UITextureView {
|
|
|
27
27
|
get width(): number;
|
|
28
28
|
/** Original height before trimming in world units */
|
|
29
29
|
get height(): number;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Visible width after trimming in world units. The frame size is the unrotated sprite size,
|
|
32
|
+
* also for a rotated frame, as in the UV transform
|
|
33
|
+
*/
|
|
31
34
|
get trimmedWidth(): number;
|
|
32
35
|
/** Visible height after trimming in world units */
|
|
33
36
|
get trimmedHeight(): number;
|
|
@@ -36,15 +36,16 @@ export class UITextureView {
|
|
|
36
36
|
get height() {
|
|
37
37
|
return this.sourceHeight / this.scaleInternal;
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Visible width after trimming in world units. The frame size is the unrotated sprite size,
|
|
41
|
+
* also for a rotated frame, as in the UV transform
|
|
42
|
+
*/
|
|
40
43
|
get trimmedWidth() {
|
|
41
|
-
|
|
42
|
-
return frameSize / this.scaleInternal;
|
|
44
|
+
return this.frameWidth / this.scaleInternal;
|
|
43
45
|
}
|
|
44
46
|
/** Visible height after trimming in world units */
|
|
45
47
|
get trimmedHeight() {
|
|
46
|
-
|
|
47
|
-
return frameSize / this.scaleInternal;
|
|
48
|
+
return this.frameHeight / this.scaleInternal;
|
|
48
49
|
}
|
|
49
50
|
/** Underlying Three.js texture */
|
|
50
51
|
get texture() {
|
|
@@ -195,11 +196,13 @@ export class UITextureView {
|
|
|
195
196
|
if (this.texture !== config.texture) {
|
|
196
197
|
this.textureInternal = config.texture;
|
|
197
198
|
this.textureDirtyInternal = true;
|
|
199
|
+
// The UV transform divides by the atlas size, so a new atlas can change it under the same frame.
|
|
200
|
+
this.uvTransformDirtyInternal = true;
|
|
198
201
|
}
|
|
199
202
|
const scale = config.scale ?? 1;
|
|
200
203
|
const rotated = config.rotated ?? false;
|
|
201
|
-
if (this.frameX !==
|
|
202
|
-
this.frameY !==
|
|
204
|
+
if (this.frameX !== config.frame.x ||
|
|
205
|
+
this.frameY !== config.frame.y ||
|
|
203
206
|
this.frameWidth !== config.frame.w ||
|
|
204
207
|
this.frameHeight !== config.frame.h ||
|
|
205
208
|
this.scaleInternal !== scale ||
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { UIViewport } from "./UIViewport.js";
|
|
2
|
+
/**
|
|
3
|
+
* An element of the page, usually the canvas of the renderer: for a canvas that does not fill
|
|
4
|
+
* the window, such as an editor preview or a canvas with page margins. The size follows the
|
|
5
|
+
* element's box as laid out, including CSS transforms.
|
|
6
|
+
*/
|
|
7
|
+
export declare class UIElementViewport extends UIViewport {
|
|
8
|
+
private readonly elementInternal;
|
|
9
|
+
private readonly observer;
|
|
10
|
+
private widthInternal;
|
|
11
|
+
private heightInternal;
|
|
12
|
+
/**
|
|
13
|
+
* @param element Element whose box the viewport follows
|
|
14
|
+
*/
|
|
15
|
+
constructor(element: Element);
|
|
16
|
+
/** Element the viewport follows */
|
|
17
|
+
get element(): Element;
|
|
18
|
+
get width(): number;
|
|
19
|
+
get height(): number;
|
|
20
|
+
/**
|
|
21
|
+
* The box is read on every call: the element may move without resizing, as on scroll, or
|
|
22
|
+
* change size through a CSS transform, which the resize observer does not report
|
|
23
|
+
*/
|
|
24
|
+
toLocal<T extends {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
}>(clientX: number, clientY: number, result: T): T;
|
|
28
|
+
protected destroyInternal(): void;
|
|
29
|
+
private readonly onResize;
|
|
30
|
+
private applySize;
|
|
31
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { UIViewport } from "./UIViewport.js";
|
|
2
|
+
/**
|
|
3
|
+
* An element of the page, usually the canvas of the renderer: for a canvas that does not fill
|
|
4
|
+
* the window, such as an editor preview or a canvas with page margins. The size follows the
|
|
5
|
+
* element's box as laid out, including CSS transforms.
|
|
6
|
+
*/
|
|
7
|
+
export class UIElementViewport extends UIViewport {
|
|
8
|
+
/**
|
|
9
|
+
* @param element Element whose box the viewport follows
|
|
10
|
+
*/
|
|
11
|
+
constructor(element) {
|
|
12
|
+
super();
|
|
13
|
+
this.onResize = () => {
|
|
14
|
+
this.applySize(this.elementInternal.getBoundingClientRect());
|
|
15
|
+
};
|
|
16
|
+
this.elementInternal = element;
|
|
17
|
+
const rect = element.getBoundingClientRect();
|
|
18
|
+
this.widthInternal = rect.width;
|
|
19
|
+
this.heightInternal = rect.height;
|
|
20
|
+
this.observer = new ResizeObserver(this.onResize);
|
|
21
|
+
this.observer.observe(element);
|
|
22
|
+
}
|
|
23
|
+
/** Element the viewport follows */
|
|
24
|
+
get element() {
|
|
25
|
+
return this.elementInternal;
|
|
26
|
+
}
|
|
27
|
+
get width() {
|
|
28
|
+
return this.widthInternal;
|
|
29
|
+
}
|
|
30
|
+
get height() {
|
|
31
|
+
return this.heightInternal;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The box is read on every call: the element may move without resizing, as on scroll, or
|
|
35
|
+
* change size through a CSS transform, which the resize observer does not report
|
|
36
|
+
*/
|
|
37
|
+
toLocal(clientX, clientY, result) {
|
|
38
|
+
const rect = this.elementInternal.getBoundingClientRect();
|
|
39
|
+
this.applySize(rect);
|
|
40
|
+
result.x = clientX - rect.left;
|
|
41
|
+
result.y = rect.bottom - clientY;
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
destroyInternal() {
|
|
45
|
+
this.observer.disconnect();
|
|
46
|
+
}
|
|
47
|
+
applySize(rect) {
|
|
48
|
+
if (rect.width !== this.widthInternal || rect.height !== this.heightInternal) {
|
|
49
|
+
this.widthInternal = rect.width;
|
|
50
|
+
this.heightInternal = rect.height;
|
|
51
|
+
this.signalResizedInternal.emit();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { FerrsignView0 } from "ferrsign";
|
|
2
|
+
import { Ferrsign0 } from "ferrsign";
|
|
3
|
+
/**
|
|
4
|
+
* Part of the page a layer covers: gives the layer its size and the origin of input positions.
|
|
5
|
+
* Sizes and positions are in CSS pixels. Subclass it for a custom area and pass it to
|
|
6
|
+
* `UIViewportLayer`.
|
|
7
|
+
*
|
|
8
|
+
* A viewport passed to a layer belongs to the caller, who destroys it after the layers using it;
|
|
9
|
+
* one viewport may serve several layers.
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class UIViewport {
|
|
12
|
+
protected readonly signalResizedInternal: Ferrsign0;
|
|
13
|
+
private destroyedInternal;
|
|
14
|
+
/** Signal fired when the size changes */
|
|
15
|
+
get signalResized(): FerrsignView0;
|
|
16
|
+
/** Whether the viewport is destroyed */
|
|
17
|
+
get destroyed(): boolean;
|
|
18
|
+
/** Width in CSS pixels; 0 while the area is not laid out */
|
|
19
|
+
abstract get width(): number;
|
|
20
|
+
/** Height in CSS pixels; 0 while the area is not laid out */
|
|
21
|
+
abstract get height(): number;
|
|
22
|
+
/** Stops tracking the size. Does nothing if the viewport is already destroyed. */
|
|
23
|
+
destroy(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Converts a position on the page to the viewport: origin at the bottom-left corner, y up.
|
|
26
|
+
* @param clientX Horizontal position relative to the browser viewport, as in `PointerEvent`
|
|
27
|
+
* @param clientY Vertical position relative to the browser viewport, as in `PointerEvent`
|
|
28
|
+
* @param result Vector to write into
|
|
29
|
+
* @returns The result vector
|
|
30
|
+
*/
|
|
31
|
+
abstract toLocal<T extends {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}>(clientX: number, clientY: number, result: T): T;
|
|
35
|
+
/** Releases what the viewport listens to */
|
|
36
|
+
protected abstract destroyInternal(): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Ferrsign0 } from "ferrsign";
|
|
2
|
+
/**
|
|
3
|
+
* Part of the page a layer covers: gives the layer its size and the origin of input positions.
|
|
4
|
+
* Sizes and positions are in CSS pixels. Subclass it for a custom area and pass it to
|
|
5
|
+
* `UIViewportLayer`.
|
|
6
|
+
*
|
|
7
|
+
* A viewport passed to a layer belongs to the caller, who destroys it after the layers using it;
|
|
8
|
+
* one viewport may serve several layers.
|
|
9
|
+
*/
|
|
10
|
+
export class UIViewport {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.signalResizedInternal = new Ferrsign0();
|
|
13
|
+
this.destroyedInternal = false;
|
|
14
|
+
}
|
|
15
|
+
/** Signal fired when the size changes */
|
|
16
|
+
get signalResized() {
|
|
17
|
+
return this.signalResizedInternal;
|
|
18
|
+
}
|
|
19
|
+
/** Whether the viewport is destroyed */
|
|
20
|
+
get destroyed() {
|
|
21
|
+
return this.destroyedInternal;
|
|
22
|
+
}
|
|
23
|
+
/** Stops tracking the size. Does nothing if the viewport is already destroyed. */
|
|
24
|
+
destroy() {
|
|
25
|
+
if (this.destroyedInternal) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.destroyedInternal = true;
|
|
29
|
+
this.destroyInternal();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UIViewport } from "./UIViewport.js";
|
|
2
|
+
/** The whole browser window */
|
|
3
|
+
export declare class UIWindowViewport extends UIViewport {
|
|
4
|
+
constructor();
|
|
5
|
+
get width(): number;
|
|
6
|
+
get height(): number;
|
|
7
|
+
toLocal<T extends {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}>(clientX: number, clientY: number, result: T): T;
|
|
11
|
+
protected destroyInternal(): void;
|
|
12
|
+
private readonly onResize;
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UIViewport } from "./UIViewport.js";
|
|
2
|
+
/** The whole browser window */
|
|
3
|
+
export class UIWindowViewport extends UIViewport {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.onResize = () => {
|
|
7
|
+
this.signalResizedInternal.emit();
|
|
8
|
+
};
|
|
9
|
+
window.addEventListener("resize", this.onResize);
|
|
10
|
+
}
|
|
11
|
+
get width() {
|
|
12
|
+
return window.innerWidth;
|
|
13
|
+
}
|
|
14
|
+
get height() {
|
|
15
|
+
return window.innerHeight;
|
|
16
|
+
}
|
|
17
|
+
toLocal(clientX, clientY, result) {
|
|
18
|
+
result.x = clientX;
|
|
19
|
+
result.y = window.innerHeight - clientY;
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
destroyInternal() {
|
|
23
|
+
window.removeEventListener("resize", this.onResize);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
/** Discards errors left by earlier calls, so that the next getError reports only the next call */
|
|
2
|
+
function clearErrors(gl) {
|
|
3
|
+
while (gl.getError() !== gl.NO_ERROR) {
|
|
4
|
+
// Drain the error queue
|
|
5
|
+
}
|
|
6
|
+
}
|
|
1
7
|
/**
|
|
2
8
|
* Checks real OffscreenCanvas support as a texture source
|
|
3
9
|
*/
|
|
4
|
-
function
|
|
10
|
+
function probeOffscreenCanvas(gl) {
|
|
5
11
|
if (typeof OffscreenCanvas === "undefined") {
|
|
6
12
|
return false;
|
|
7
13
|
}
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
testCanvasElement.height = 4;
|
|
11
|
-
const gl = testCanvasElement.getContext("webgl") ?? testCanvasElement.getContext("webgl2");
|
|
12
|
-
if (!gl) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
14
|
+
const texture = gl.createTexture();
|
|
15
|
+
const framebuffer = gl.createFramebuffer();
|
|
15
16
|
try {
|
|
16
17
|
const offscreenCanvas = new OffscreenCanvas(4, 4);
|
|
17
18
|
const offscreenContext = offscreenCanvas.getContext("2d");
|
|
@@ -20,82 +21,87 @@ function checkOffscreenCanvasSupportInternal() {
|
|
|
20
21
|
}
|
|
21
22
|
offscreenContext.fillStyle = "#ff0000";
|
|
22
23
|
offscreenContext.fillRect(0, 0, 4, 4);
|
|
23
|
-
|
|
24
|
+
clearErrors(gl);
|
|
24
25
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
25
26
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, offscreenCanvas);
|
|
26
27
|
if (gl.getError() !== gl.NO_ERROR) {
|
|
27
|
-
gl.deleteTexture(texture);
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
|
-
const framebuffer = gl.createFramebuffer();
|
|
31
30
|
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
32
31
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
|
|
33
32
|
if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) !== gl.FRAMEBUFFER_COMPLETE) {
|
|
34
|
-
gl.deleteFramebuffer(framebuffer);
|
|
35
|
-
gl.deleteTexture(texture);
|
|
36
33
|
return false;
|
|
37
34
|
}
|
|
38
35
|
const pixelData = new Uint8Array(4);
|
|
39
36
|
gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixelData);
|
|
37
|
+
return pixelData[0] > 200 && pixelData[1] < 50 && pixelData[2] < 50 && pixelData[3] > 200;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
40
43
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
44
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
41
45
|
gl.deleteFramebuffer(framebuffer);
|
|
42
46
|
gl.deleteTexture(texture);
|
|
43
|
-
const isRedPixel = pixelData[0] > 200 && pixelData[1] < 50 && pixelData[2] < 50 && pixelData[3] > 200;
|
|
44
|
-
if (!isRedPixel) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
void error;
|
|
51
|
-
return false;
|
|
52
47
|
}
|
|
53
48
|
}
|
|
54
49
|
/**
|
|
55
50
|
* Checks sRGB support
|
|
56
51
|
*/
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
52
|
+
function probeSRGB(gl) {
|
|
53
|
+
const isWebGL2 = typeof WebGL2RenderingContext !== "undefined" && gl instanceof WebGL2RenderingContext;
|
|
54
|
+
const extension = isWebGL2 ? null : gl.getExtension("EXT_sRGB");
|
|
55
|
+
if (!isWebGL2 && !extension) {
|
|
61
56
|
return false;
|
|
62
57
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
const texture = gl.createTexture();
|
|
59
|
+
try {
|
|
60
|
+
clearErrors(gl);
|
|
61
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
62
|
+
if (isWebGL2) {
|
|
67
63
|
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.SRGB8_ALPHA8, 2, 2);
|
|
68
|
-
const errorCode = gl.getError();
|
|
69
|
-
gl.deleteTexture(texture);
|
|
70
|
-
return errorCode === gl.NO_ERROR;
|
|
71
64
|
}
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
else if (extension) {
|
|
66
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, extension.SRGB_ALPHA_EXT, 2, 2, 0, extension.SRGB_ALPHA_EXT, gl.UNSIGNED_BYTE, null);
|
|
74
67
|
}
|
|
68
|
+
return gl.getError() === gl.NO_ERROR;
|
|
75
69
|
}
|
|
76
|
-
|
|
77
|
-
if (!extension) {
|
|
70
|
+
catch {
|
|
78
71
|
return false;
|
|
79
72
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
83
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, extension.SRGB_ALPHA_EXT, 2, 2, 0, extension.SRGB_ALPHA_EXT, gl.UNSIGNED_BYTE, null);
|
|
84
|
-
const errorCode = gl.getError();
|
|
73
|
+
finally {
|
|
74
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
85
75
|
gl.deleteTexture(texture);
|
|
86
|
-
return errorCode === gl.NO_ERROR;
|
|
87
76
|
}
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Runs all checks on one temporary context and releases it right away. Browsers keep a limited
|
|
80
|
+
* number of live WebGL contexts and lose the oldest one when the limit is exceeded, so a probe
|
|
81
|
+
* context left for the garbage collector can cost the application its own context.
|
|
82
|
+
*/
|
|
83
|
+
function probeCapabilities() {
|
|
84
|
+
const canvasElement = document.createElement("canvas");
|
|
85
|
+
canvasElement.width = 4;
|
|
86
|
+
canvasElement.height = 4;
|
|
87
|
+
const gl = canvasElement.getContext("webgl2") ?? canvasElement.getContext("webgl");
|
|
88
|
+
if (!gl) {
|
|
89
|
+
return { offscreenCanvas: false, srgb: false };
|
|
90
90
|
}
|
|
91
|
+
try {
|
|
92
|
+
return {
|
|
93
|
+
offscreenCanvas: probeOffscreenCanvas(gl),
|
|
94
|
+
srgb: probeSRGB(gl),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
gl.getExtension("WEBGL_lose_context")?.loseContext();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
let CAPABILITIES_INTERNAL;
|
|
102
|
+
function getCapabilities() {
|
|
103
|
+
CAPABILITIES_INTERNAL ?? (CAPABILITIES_INTERNAL = probeCapabilities());
|
|
104
|
+
return CAPABILITIES_INTERNAL;
|
|
91
105
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export const checkOffscreenCanvasSupport = () => {
|
|
95
|
-
OFFSCREEN_CANVAS_SUPPORTED_INTERNAL ?? (OFFSCREEN_CANVAS_SUPPORTED_INTERNAL = checkOffscreenCanvasSupportInternal());
|
|
96
|
-
return OFFSCREEN_CANVAS_SUPPORTED_INTERNAL;
|
|
97
|
-
};
|
|
98
|
-
export const checkSRGBSupport = () => {
|
|
99
|
-
SRGB_SUPPORTED_INTERNAL ?? (SRGB_SUPPORTED_INTERNAL = checkSRGBSupportInternal());
|
|
100
|
-
return SRGB_SUPPORTED_INTERNAL;
|
|
101
|
-
};
|
|
106
|
+
export const checkOffscreenCanvasSupport = () => getCapabilities().offscreenCanvas;
|
|
107
|
+
export const checkSRGBSupport = () => getCapabilities().srgb;
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pointer callbacks of an input catcher. Positions are in layer coordinates.
|
|
3
|
+
*
|
|
4
|
+
* A catcher that catches a press captures the pointer: until it is released or cancelled, the
|
|
5
|
+
* moves, the release and the cancel of that pointer go to this catcher only, wherever they are,
|
|
6
|
+
* and exactly one release or cancel ends the capture.
|
|
7
|
+
*/
|
|
8
|
+
export interface UIInputCatcherCallbacks {
|
|
9
|
+
/** Returns true to catch the press: catchers below do not get it, and the pointer is captured */
|
|
10
|
+
catchPointerDown: (x: number, y: number, identifier: number) => boolean;
|
|
11
|
+
/** Returns true to stop the event for catchers below; ignored for a captured pointer */
|
|
12
|
+
catchPointerMove: (x: number, y: number, identifier: number) => boolean;
|
|
13
|
+
/** Returns true to stop the event for catchers below; ignored for a captured pointer */
|
|
14
|
+
catchPointerUp: (x: number, y: number, identifier: number) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The pointer is gone for this catcher: drop what is known of it. Called when a pressed
|
|
17
|
+
* pointer is cancelled (by the browser or by the layer), on the catcher that captured it, or
|
|
18
|
+
* on every active catcher if nobody did, since a cancel is not hit-tested; on every other
|
|
19
|
+
* active catcher when one captures the pointer; and on the catchers below one that catches a
|
|
20
|
+
* move or release of a pointer nobody captured. No position: the browser reports none worth
|
|
21
|
+
* using, and the catcher knows the last one it saw.
|
|
22
|
+
*/
|
|
23
|
+
catchPointerCancel: (identifier: number) => void;
|
|
24
|
+
}
|
|
1
25
|
export interface UIInputWrapperView {
|
|
2
|
-
|
|
26
|
+
/** Bumped by every change to the draw order; compare with the last seen value */
|
|
27
|
+
readonly version: number;
|
|
28
|
+
createInputCatcher(callbacks: UIInputCatcherCallbacks, zIndex: number): number;
|
|
3
29
|
destroyInputCatcher(handler: number): void;
|
|
4
30
|
getZIndex(handler: number): number;
|
|
5
31
|
getDepth(handler: number): number;
|
|
@@ -7,14 +33,19 @@ export interface UIInputWrapperView {
|
|
|
7
33
|
getActive(handler: number): boolean;
|
|
8
34
|
setActive(handler: number, active: boolean): void;
|
|
9
35
|
}
|
|
10
|
-
export interface UIInputWrapperCatcher {
|
|
36
|
+
export interface UIInputWrapperCatcher extends UIInputCatcherCallbacks {
|
|
11
37
|
handler: number;
|
|
12
|
-
catchPointerDown: (x: number, y: number, identifier: number) => boolean;
|
|
13
|
-
catchPointerMove: (x: number, y: number, identifier: number) => boolean;
|
|
14
|
-
catchPointerUp: (x: number, y: number, identifier: number) => boolean;
|
|
15
38
|
/** Order requested by the user; equal values keep the order of creation */
|
|
16
39
|
zIndex: number;
|
|
17
40
|
/** Unique position in the sorted order, used as the rendering depth */
|
|
18
41
|
depth: number;
|
|
19
42
|
active: boolean;
|
|
20
43
|
}
|
|
44
|
+
/** A pressed pointer, not released or cancelled yet */
|
|
45
|
+
export interface UIInputWrapperPointer {
|
|
46
|
+
/** Catcher that caught the press and holds the pointer; null if none did */
|
|
47
|
+
catcher: UIInputWrapperCatcher | null;
|
|
48
|
+
/** Last known position, reported when the layer cancels the pointer */
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import type { UIInputWrapperView } from "./UIInputWrapper.Internal.js";
|
|
1
|
+
import type { UIInputCatcherCallbacks, UIInputWrapperView } from "./UIInputWrapper.Internal.js";
|
|
2
2
|
export declare class UIInputWrapper implements UIInputWrapperView {
|
|
3
|
+
private versionInternal;
|
|
3
4
|
private zIndicesDirty;
|
|
4
5
|
private readonly catchers;
|
|
6
|
+
/** Pressed pointers: the input wrapper is the one place that knows of them */
|
|
7
|
+
private readonly pointers;
|
|
8
|
+
/** Pointers seen moving while not pressed, such as a hovering mouse */
|
|
9
|
+
private readonly hoveringPointers;
|
|
5
10
|
private lastHandler;
|
|
6
|
-
|
|
11
|
+
/** Bumped by every change to the draw order; compare with the last seen value */
|
|
12
|
+
get version(): number;
|
|
13
|
+
createInputCatcher(callbacks: UIInputCatcherCallbacks, zIndex: number): number;
|
|
7
14
|
destroyInputCatcher(handler: number): void;
|
|
8
15
|
getZIndex(handler: number): number;
|
|
9
16
|
getDepth(handler: number): number;
|
|
@@ -13,7 +20,21 @@ export declare class UIInputWrapper implements UIInputWrapperView {
|
|
|
13
20
|
/**
|
|
14
21
|
* Passes a pointer event from the top catcher down until one catches it. A handler may
|
|
15
22
|
* destroy elements, so the catchers are walked over a copy and a destroyed one is skipped.
|
|
23
|
+
* @param pointer Pressed pointer the event belongs to: the walk stops once a handler ends it
|
|
24
|
+
* @returns The catcher that caught the event, or null
|
|
16
25
|
*/
|
|
17
26
|
private dispatch;
|
|
27
|
+
/**
|
|
28
|
+
* Passes a cancel to the active catchers below one that caught an event: they did not see it,
|
|
29
|
+
* and the pointer is over the catcher above them now, or released
|
|
30
|
+
*/
|
|
31
|
+
private cancelBelow;
|
|
32
|
+
/** Passes a cancel to every active catcher but one, top one first */
|
|
33
|
+
private broadcastCancel;
|
|
34
|
+
/**
|
|
35
|
+
* Frees the pointers held by a catcher that stops taking input; it resets its own state. The
|
|
36
|
+
* pointers stay pressed, for the layer, with no catcher.
|
|
37
|
+
*/
|
|
38
|
+
private releaseCaptures;
|
|
18
39
|
private ensureSorted;
|
|
19
40
|
}
|