laymur 0.15.1 → 0.17.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/.claude/settings.local.json +9 -0
- package/.editorconfig +14 -0
- package/CLAUDE.md +181 -0
- package/README.md +84 -208
- package/assets/logotype.png +0 -0
- package/eslint.config.js +111 -0
- package/package.json +20 -36
- package/rollup.config.js +52 -0
- package/{dist/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts → src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +60 -0
- package/src/core/constraints/UIConstraint.ts +20 -0
- package/src/core/constraints/UICustomConstraint.ts +62 -0
- package/{dist/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts → src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +52 -0
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +13 -0
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +139 -0
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +16 -0
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +189 -0
- package/{dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts → src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +68 -0
- package/{dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts → src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts} +9 -8
- package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +94 -0
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +13 -0
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +135 -0
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +16 -0
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +189 -0
- package/{dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts → src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +68 -0
- package/{dist/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts → src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts} +3 -2
- package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +52 -0
- package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +84 -0
- package/src/core/constraints/builders/UIConstraint2DBuilder.ts +168 -0
- package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +15 -0
- package/src/core/constraints/builders/UICoverConstraintBuilder.ts +84 -0
- package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +15 -0
- package/src/core/constraints/builders/UIFitConstraintBuilder.ts +84 -0
- package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +13 -0
- package/src/core/elements/UIAnchor/UIAnchor.ts +70 -0
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +30 -0
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +355 -0
- package/src/core/elements/UIDummy/UIDummy.Internal.ts +33 -0
- package/src/core/elements/UIDummy/UIDummy.ts +244 -0
- package/src/core/elements/UIElement/UIElement.Internal.ts +13 -0
- package/src/core/elements/UIElement/UIElement.ts +127 -0
- package/{dist/elements/UIGraphics/UIGraphics.Internal.d.ts → src/core/elements/UIGraphics/UIGraphics.Internal.ts} +7 -5
- package/src/core/elements/UIGraphics/UIGraphics.ts +168 -0
- package/{dist/elements/UIImage/UIImage.Internal.d.ts → src/core/elements/UIImage/UIImage.Internal.ts} +3 -2
- package/src/core/elements/UIImage/UIImage.ts +138 -0
- package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +26 -0
- package/src/core/elements/UINineSlice/UINineSlice.ts +296 -0
- package/src/core/elements/UIProgress/UIProgress.Internal.ts +24 -0
- package/src/core/elements/UIProgress/UIProgress.ts +259 -0
- package/src/core/elements/UIScene/UIScene.Internal.ts +46 -0
- package/src/core/elements/UIScene/UIScene.ts +259 -0
- package/{dist/elements/UIText/UIText.Interfaces.d.ts → src/core/elements/UIText/UIText.Interfaces.ts} +21 -16
- package/src/core/elements/UIText/UIText.Internal.ts +29 -0
- package/src/core/elements/UIText/UIText.Measuring.ts +183 -0
- package/src/core/elements/UIText/UIText.Rendering.ts +83 -0
- package/src/core/elements/UIText/UIText.ts +376 -0
- package/{dist/index.d.ts → src/core/index.ts} +2 -1
- package/{dist/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts → src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts} +14 -11
- package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +233 -0
- package/{dist/layers/UILayer/UILayer.Internal.d.ts → src/core/layers/UILayer/UILayer.Internal.ts} +15 -11
- package/src/core/layers/UILayer/UILayer.ts +156 -0
- package/src/core/miscellaneous/UIExpression.ts +142 -0
- package/src/core/miscellaneous/UIMode.ts +29 -0
- package/src/core/miscellaneous/UIOrientation.ts +18 -0
- package/src/core/miscellaneous/UIPriority.ts +63 -0
- package/src/core/miscellaneous/UIRelation.ts +39 -0
- package/src/core/miscellaneous/UITransparencyMode.ts +9 -0
- package/src/core/miscellaneous/area/UIArea.ts +5 -0
- package/src/core/miscellaneous/area/UIAreaCircle.ts +32 -0
- package/src/core/miscellaneous/area/UIAreaPolygon.ts +50 -0
- package/src/core/miscellaneous/area/UIAreaRectangle.ts +38 -0
- package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +78 -0
- package/src/core/miscellaneous/asserts.ts +187 -0
- package/src/core/miscellaneous/canvas.ts +73 -0
- package/src/core/miscellaneous/color/UIColor.Internal.ts +89 -0
- package/src/core/miscellaneous/color/UIColor.ts +844 -0
- package/src/core/miscellaneous/computeTransform.ts +127 -0
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +235 -0
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +524 -0
- package/{dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts → src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts} +10 -8
- package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +448 -0
- package/src/core/miscellaneous/generic-plane/shared.ts +323 -0
- package/src/core/miscellaneous/insets/UIInsets.Internal.ts +9 -0
- package/src/core/miscellaneous/insets/UIInsets.ts +248 -0
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +24 -0
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +58 -0
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +52 -0
- package/src/core/miscellaneous/math.ts +16 -0
- package/src/core/miscellaneous/micro/UIMicro.Internal.ts +33 -0
- package/src/core/miscellaneous/micro/UIMicro.ts +222 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +8 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +57 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +65 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +65 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +57 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +65 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +65 -0
- package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +11 -0
- package/src/core/miscellaneous/shared.ts +73 -0
- package/{dist/miscellaneous/text-span/UITextSpan.Internal.d.ts → src/core/miscellaneous/text-span/UITextSpan.Internal.ts} +5 -4
- package/src/core/miscellaneous/text-span/UITextSpan.ts +43 -0
- package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +52 -0
- package/src/core/miscellaneous/text-style/UITextStyle.ts +479 -0
- package/src/core/miscellaneous/texture/UITextureView.Internal.ts +55 -0
- package/src/core/miscellaneous/texture/UITextureView.ts +308 -0
- package/src/core/miscellaneous/webglCapabilities.ts +129 -0
- package/src/core/shaders/UIImage.glsl +10 -0
- package/src/core/shaders/UINineSlice.glsl +53 -0
- package/src/core/shaders/UIProgress.glsl +15 -0
- package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +13 -0
- package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +12 -0
- package/src/core/shaders/glsl.d.ts +27 -0
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +23 -0
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +124 -0
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +22 -0
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +101 -0
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +58 -0
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +605 -0
- package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +70 -0
- package/src/particles/behaviorModules/UIBehaviorModule.ts +20 -0
- package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +173 -0
- package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +104 -0
- package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +75 -0
- package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +115 -0
- package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +77 -0
- package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +118 -0
- package/src/particles/elements/UIEmitter.Internal.ts +22 -0
- package/src/particles/elements/UIEmitter.ts +313 -0
- package/src/particles/index.ts +18 -0
- package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +263 -0
- package/src/particles/instancedParticle/UIInstancedParticle.ts +138 -0
- package/src/particles/miscellaneous/miscellaneous.ts +115 -0
- package/src/particles/renderingModules/UIRenderingColorOverLife.ts +39 -0
- package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +49 -0
- package/src/particles/renderingModules/UIRenderingModule.ts +17 -0
- package/src/particles/renderingModules/UIRenderingTexture.ts +30 -0
- package/src/particles/shaders/UIRenderingColorOverLife.glsl +4 -0
- package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +6 -0
- package/src/particles/shaders/UIRenderingTexture.glsl +4 -0
- package/src/particles/spawnModules/UISpawnModule.ts +22 -0
- package/src/particles/spawnModules/UISpawnOffset.ts +62 -0
- package/src/particles/spawnModules/UISpawnRandomLifetime.ts +68 -0
- package/src/particles/spawnModules/UISpawnRandomRotation.ts +60 -0
- package/src/particles/spawnModules/UISpawnRandomScale.ts +81 -0
- package/src/particles/spawnModules/UISpawnRandomTorque.ts +62 -0
- package/src/particles/spawnModules/UISpawnRandomVelocity.ts +92 -0
- package/src/particles/spawnModules/UISpawnRectangle.ts +81 -0
- package/tsconfig.json +29 -0
- package/dist/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +0 -22
- package/dist/constraints/UIConstraint.d.ts +0 -12
- package/dist/constraints/UICustomConstraint.d.ts +0 -28
- package/dist/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +0 -20
- package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -11
- package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -36
- package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -14
- package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -44
- package/dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -22
- package/dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -43
- package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -11
- package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -32
- package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -14
- package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -44
- package/dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -22
- package/dist/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +0 -20
- package/dist/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +0 -64
- package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +0 -46
- package/dist/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +0 -13
- package/dist/constraints/builders/UICoverConstraintBuilder.d.ts +0 -29
- package/dist/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +0 -13
- package/dist/constraints/builders/UIFitConstraintBuilder.d.ts +0 -29
- package/dist/elements/UIAnchor/UIAnchor.Internal.d.ts +0 -9
- package/dist/elements/UIAnchor/UIAnchor.d.ts +0 -32
- package/dist/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -27
- package/dist/elements/UIAnimatedImage/UIAnimatedImage.d.ts +0 -77
- package/dist/elements/UIElement/UIElement.Internal.d.ts +0 -11
- package/dist/elements/UIElement/UIElement.d.ts +0 -38
- package/dist/elements/UIGraphics/UIGraphics.d.ts +0 -51
- package/dist/elements/UIImage/UIImage.d.ts +0 -32
- package/dist/elements/UIInputDummy/UIInputDummy.Internal.d.ts +0 -30
- package/dist/elements/UIInputDummy/UIInputDummy.d.ts +0 -82
- package/dist/elements/UINineSlice/UINineSlice.Internal.d.ts +0 -23
- package/dist/elements/UINineSlice/UINineSlice.d.ts +0 -60
- package/dist/elements/UIProgress/UIProgress.Internal.d.ts +0 -14
- package/dist/elements/UIProgress/UIProgress.d.ts +0 -45
- package/dist/elements/UIScene/UIScene.Internal.d.ts +0 -43
- package/dist/elements/UIScene/UIScene.d.ts +0 -59
- package/dist/elements/UIText/UIText.Internal.d.ts +0 -26
- package/dist/elements/UIText/UIText.Measuring.d.ts +0 -50
- package/dist/elements/UIText/UIText.Rendering.d.ts +0 -20
- package/dist/elements/UIText/UIText.d.ts +0 -71
- package/dist/index.js +0 -9236
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/dist/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -63
- package/dist/layers/UILayer/UILayer.d.ts +0 -49
- package/dist/miscellaneous/UIExpression.d.ts +0 -69
- package/dist/miscellaneous/UIMode.d.ts +0 -23
- package/dist/miscellaneous/UIOrientation.d.ts +0 -15
- package/dist/miscellaneous/UIPriority.d.ts +0 -32
- package/dist/miscellaneous/UIRelation.d.ts +0 -23
- package/dist/miscellaneous/UITransparencyMode.d.ts +0 -9
- package/dist/miscellaneous/area/UIArea.d.ts +0 -3
- package/dist/miscellaneous/area/UIAreaCircle.d.ts +0 -15
- package/dist/miscellaneous/area/UIAreaPolygon.d.ts +0 -12
- package/dist/miscellaneous/area/UIAreaRectangle.d.ts +0 -17
- package/dist/miscellaneous/area/UIAreaRoundedRectangle.d.ts +0 -21
- package/dist/miscellaneous/asserts.d.ts +0 -43
- package/dist/miscellaneous/canvas.d.ts +0 -31
- package/dist/miscellaneous/color/UIColor.Internal.d.ts +0 -7
- package/dist/miscellaneous/color/UIColor.d.ts +0 -234
- package/dist/miscellaneous/computeTransform.d.ts +0 -18
- package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -19
- package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -1
- package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -1
- package/dist/miscellaneous/generic-plane/shared.d.ts +0 -38
- package/dist/miscellaneous/insets/UIInsets.Internal.d.ts +0 -11
- package/dist/miscellaneous/insets/UIInsets.d.ts +0 -48
- package/dist/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +0 -9
- package/dist/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -21
- package/dist/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -16
- package/dist/miscellaneous/math.d.ts +0 -5
- package/dist/miscellaneous/micro/UIMicro.Internal.d.ts +0 -31
- package/dist/miscellaneous/micro/UIMicro.d.ts +0 -59
- package/dist/miscellaneous/resize-policy/UIResizePolicy.d.ts +0 -3
- package/dist/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -22
- package/dist/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +0 -5
- package/dist/miscellaneous/shared.d.ts +0 -46
- package/dist/miscellaneous/text-span/UITextSpan.d.ts +0 -14
- package/dist/miscellaneous/text-style/UITextStyle.Internal.d.ts +0 -48
- package/dist/miscellaneous/text-style/UITextStyle.d.ts +0 -85
- package/dist/miscellaneous/texture/UITextureView.Internal.d.ts +0 -49
- package/dist/miscellaneous/texture/UITextureView.d.ts +0 -67
- package/dist/miscellaneous/webglCapabilities.d.ts +0 -2
- package/dist/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +0 -17
- package/dist/wrappers/UIInputWrapper/UIInputWrapper.d.ts +0 -13
- package/dist/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +0 -13
- package/dist/wrappers/UISceneWrapper/UISceneWrapper.d.ts +0 -20
- package/dist/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +0 -49
- package/dist/wrappers/UISolverWrapper/UISolverWrapper.d.ts +0 -215
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { UIInputWrapperCatcher, UIInputWrapperView } from "./UIInputWrapper.Internal";
|
|
2
|
+
|
|
3
|
+
export class UIInputWrapper implements UIInputWrapperView {
|
|
4
|
+
/** @internal */
|
|
5
|
+
public dirty = false;
|
|
6
|
+
|
|
7
|
+
private zIndicesDirty = false;
|
|
8
|
+
private readonly catchers: UIInputWrapperCatcher[] = [];
|
|
9
|
+
private lastHandler = 0;
|
|
10
|
+
|
|
11
|
+
public createInputCatcher(
|
|
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
|
+
zIndex: number,
|
|
16
|
+
): number {
|
|
17
|
+
const handler = this.lastHandler++;
|
|
18
|
+
this.catchers.push({
|
|
19
|
+
handler,
|
|
20
|
+
catchPointerDown,
|
|
21
|
+
catchPointerMove,
|
|
22
|
+
catchPointerUp,
|
|
23
|
+
zIndex,
|
|
24
|
+
active: true,
|
|
25
|
+
});
|
|
26
|
+
this.zIndicesDirty = true;
|
|
27
|
+
this.dirty = true;
|
|
28
|
+
return handler;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public destroyInputCatcher(handler: number): void {
|
|
32
|
+
const index = this.catchers.findIndex((item) => item.handler === handler);
|
|
33
|
+
if (index === -1) {
|
|
34
|
+
throw new Error("UIInputWrapper.destroyInputCatcher.handler: handler not found");
|
|
35
|
+
}
|
|
36
|
+
this.catchers.splice(index, 1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public getZIndex(handler: number): number {
|
|
40
|
+
this.ensureSorted();
|
|
41
|
+
const found = this.catchers.find((item) => item.handler === handler);
|
|
42
|
+
if (!found) {
|
|
43
|
+
throw new Error("UIInputWrapper.getZIndex.handler: handler not found");
|
|
44
|
+
}
|
|
45
|
+
return found.zIndex;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public setZIndex(handler: number, zIndex: number): void {
|
|
49
|
+
const found = this.catchers.find((item) => item.handler === handler);
|
|
50
|
+
if (!found) {
|
|
51
|
+
throw new Error("UIInputWrapper.setZIndex.handler: handler not found");
|
|
52
|
+
}
|
|
53
|
+
if (found.zIndex !== zIndex) {
|
|
54
|
+
found.zIndex = zIndex;
|
|
55
|
+
this.zIndicesDirty = true;
|
|
56
|
+
this.dirty = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public getActive(handler: number): boolean {
|
|
61
|
+
const found = this.catchers.find((item) => item.handler === handler);
|
|
62
|
+
if (!found) {
|
|
63
|
+
throw new Error("UIInputWrapper.getActive.handler: handler not found");
|
|
64
|
+
}
|
|
65
|
+
return found.active;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public setActive(handler: number, active: boolean): void {
|
|
69
|
+
const found = this.catchers.find((item) => item.handler === handler);
|
|
70
|
+
if (!found) {
|
|
71
|
+
throw new Error("UIInputWrapper.setActive.handler: handler not found");
|
|
72
|
+
}
|
|
73
|
+
if (found.active !== active) {
|
|
74
|
+
found.active = active;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** @internal */
|
|
79
|
+
public onPointerDown(x: number, y: number, identifier: number): void {
|
|
80
|
+
this.ensureSorted();
|
|
81
|
+
for (let index = this.catchers.length - 1; index >= 0; index--) {
|
|
82
|
+
const item = this.catchers[index];
|
|
83
|
+
if (item.active && item.catchPointerDown(x, y, identifier)) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** @internal */
|
|
90
|
+
public onPointerMove(x: number, y: number, identifier: number): void {
|
|
91
|
+
this.ensureSorted();
|
|
92
|
+
for (let index = this.catchers.length - 1; index >= 0; index--) {
|
|
93
|
+
const item = this.catchers[index];
|
|
94
|
+
if (item.active && item.catchPointerMove(x, y, identifier)) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** @internal */
|
|
101
|
+
public onPointerUp(x: number, y: number, identifier: number): void {
|
|
102
|
+
this.ensureSorted();
|
|
103
|
+
for (let index = this.catchers.length - 1; index >= 0; index--) {
|
|
104
|
+
const item = this.catchers[index];
|
|
105
|
+
if (item.active && item.catchPointerUp(x, y, identifier)) {
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private ensureSorted(): void {
|
|
112
|
+
if (this.zIndicesDirty) {
|
|
113
|
+
this.catchers.sort((a, b) => a.zIndex - b.zIndex);
|
|
114
|
+
|
|
115
|
+
const count = this.catchers.length;
|
|
116
|
+
const step = count < 1024 ? 1 : 1024 / count;
|
|
117
|
+
for (let index = 0; index < count; index++) {
|
|
118
|
+
this.catchers[index].zIndex = index * step;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.zIndicesDirty = false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Matrix4, Object3D } from "three";
|
|
2
|
+
import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode";
|
|
3
|
+
import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
|
|
4
|
+
|
|
5
|
+
export interface UISceneWrapperView {
|
|
6
|
+
createPlane(
|
|
7
|
+
source: string,
|
|
8
|
+
properties: Record<string, UIProperty>,
|
|
9
|
+
transform: Matrix4,
|
|
10
|
+
visibility: boolean,
|
|
11
|
+
transparency: UITransparencyMode,
|
|
12
|
+
): number;
|
|
13
|
+
destroyPlane(handler: number): void;
|
|
14
|
+
|
|
15
|
+
setTransform(handler: number, transform: Matrix4): void;
|
|
16
|
+
setProperties(handler: number, properties: Record<string, UIProperty>): void;
|
|
17
|
+
setVisibility(handler: number, visible: boolean): void;
|
|
18
|
+
setTransparency(handler: number, transparency: UITransparencyMode): void;
|
|
19
|
+
|
|
20
|
+
insertCustomObject(object: Object3D): void;
|
|
21
|
+
removeCustomObject(object: Object3D): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Matrix4, Object3D, WebGLRenderer } from "three";
|
|
2
|
+
import { Color, OrthographicCamera, Scene } from "three";
|
|
3
|
+
import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
|
|
4
|
+
import { UIPlaneRegistry } from "../../miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry";
|
|
5
|
+
import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode";
|
|
6
|
+
import type { UISceneWrapperView } from "./UISceneWrapper.Internal";
|
|
7
|
+
|
|
8
|
+
let originalClearColor = new Color();
|
|
9
|
+
let originalClearAlpha = 0;
|
|
10
|
+
let originalAutoClear = false;
|
|
11
|
+
let originalAutoClearColor = false;
|
|
12
|
+
let originalAutoClearDepth = false;
|
|
13
|
+
let originalAutoClearStencil = false;
|
|
14
|
+
|
|
15
|
+
export class UISceneWrapper implements UISceneWrapperView {
|
|
16
|
+
private readonly scene = new Scene();
|
|
17
|
+
private readonly camera: OrthographicCamera;
|
|
18
|
+
private readonly planeRegistry = new UIPlaneRegistry(this.scene);
|
|
19
|
+
|
|
20
|
+
constructor(width: number, height: number) {
|
|
21
|
+
this.camera = new OrthographicCamera(0, width, height, 0, -1024, 1024);
|
|
22
|
+
this.camera.matrixAutoUpdate = false;
|
|
23
|
+
this.camera.matrixWorldAutoUpdate = false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public createPlane(
|
|
27
|
+
source: string,
|
|
28
|
+
properties: Record<string, UIProperty>,
|
|
29
|
+
transform: Matrix4,
|
|
30
|
+
visibility: boolean,
|
|
31
|
+
transparency: UITransparencyMode,
|
|
32
|
+
): number {
|
|
33
|
+
return this.planeRegistry.createPlane(source, properties, transform, visibility, transparency);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public destroyPlane(handler: number): void {
|
|
37
|
+
this.planeRegistry.destroyPlane(handler);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public setTransform(handler: number, transform: Matrix4): void {
|
|
41
|
+
this.planeRegistry.setTransform(handler, transform);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public setProperties(handler: number, properties: Record<string, UIProperty>): void {
|
|
45
|
+
this.planeRegistry.setProperties(handler, properties);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public setVisibility(handler: number, visible: boolean): void {
|
|
49
|
+
this.planeRegistry.setVisibility(handler, visible);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public setTransparency(handler: number, transparency: UITransparencyMode): void {
|
|
53
|
+
this.planeRegistry.setTransparency(handler, transparency);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public insertCustomObject(object: Object3D): this {
|
|
57
|
+
this.scene.add(object);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public removeCustomObject(object: Object3D): this {
|
|
62
|
+
this.scene.remove(object);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public resize(width: number, height: number): this {
|
|
67
|
+
this.camera.right = width;
|
|
68
|
+
this.camera.top = height;
|
|
69
|
+
this.camera.updateProjectionMatrix();
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public render(renderer: WebGLRenderer): this {
|
|
74
|
+
this.planeRegistry.flush();
|
|
75
|
+
|
|
76
|
+
originalClearColor = renderer.getClearColor(originalClearColor);
|
|
77
|
+
originalClearAlpha = renderer.getClearAlpha();
|
|
78
|
+
originalAutoClear = renderer.autoClear;
|
|
79
|
+
originalAutoClearColor = renderer.autoClearColor;
|
|
80
|
+
originalAutoClearDepth = renderer.autoClearDepth;
|
|
81
|
+
originalAutoClearStencil = renderer.autoClearStencil;
|
|
82
|
+
|
|
83
|
+
renderer.autoClear = false;
|
|
84
|
+
renderer.autoClearColor = false;
|
|
85
|
+
renderer.autoClearDepth = false;
|
|
86
|
+
renderer.autoClearStencil = false;
|
|
87
|
+
renderer.setClearColor(0x000000, 1);
|
|
88
|
+
|
|
89
|
+
renderer.clear(false, true, true);
|
|
90
|
+
renderer.render(this.scene, this.camera);
|
|
91
|
+
|
|
92
|
+
renderer.setClearColor(originalClearColor);
|
|
93
|
+
renderer.setClearAlpha(originalClearAlpha);
|
|
94
|
+
renderer.autoClear = originalAutoClear;
|
|
95
|
+
renderer.autoClearColor = originalAutoClearColor;
|
|
96
|
+
renderer.autoClearDepth = originalAutoClearDepth;
|
|
97
|
+
renderer.autoClearStencil = originalAutoClearStencil;
|
|
98
|
+
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Constraint, Variable } from "@lume/kiwi";
|
|
2
|
+
import type { UIExpression } from "../../miscellaneous/UIExpression";
|
|
3
|
+
import type { UIPriority } from "../../miscellaneous/UIPriority";
|
|
4
|
+
import type { UIRelation } from "../../miscellaneous/UIRelation";
|
|
5
|
+
|
|
6
|
+
export interface UISolverWrapperView {
|
|
7
|
+
get dirty(): boolean;
|
|
8
|
+
createVariable(value: number, priority: UIPriority): number;
|
|
9
|
+
removeVariable(index: number): void;
|
|
10
|
+
suggestVariableValue(index: number, value: number): void;
|
|
11
|
+
setVariablePriority(index: number, priority: UIPriority): void;
|
|
12
|
+
readVariableValue(index: number): number;
|
|
13
|
+
createConstraint(
|
|
14
|
+
lhs: UIExpression,
|
|
15
|
+
rhs: UIExpression,
|
|
16
|
+
relation: UIRelation,
|
|
17
|
+
priority: UIPriority,
|
|
18
|
+
enabled: boolean,
|
|
19
|
+
): number;
|
|
20
|
+
removeConstraint(index: number): void;
|
|
21
|
+
setConstraintLHS(index: number, lhs: UIExpression): void;
|
|
22
|
+
setConstraintRHS(index: number, rhs: UIExpression): void;
|
|
23
|
+
setConstraintRelation(index: number, relation: UIRelation): void;
|
|
24
|
+
setConstraintPriority(index: number, priority: UIPriority): void;
|
|
25
|
+
setConstraintEnabled(index: number, enabled: boolean): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal description of a solver variable with its associated properties.
|
|
30
|
+
*/
|
|
31
|
+
export interface VariableDescription {
|
|
32
|
+
/** The underlying Kiwi variable instance. */
|
|
33
|
+
variable: Variable;
|
|
34
|
+
/** Priority level for constraint solving. */
|
|
35
|
+
priority: UIPriority;
|
|
36
|
+
/** Current suggested value for the variable. */
|
|
37
|
+
value: number;
|
|
38
|
+
/** Optional constraint for P0 priority variables (required variables). */
|
|
39
|
+
constraint?: Constraint;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Internal description of a solver constraint with its configuration.
|
|
44
|
+
*/
|
|
45
|
+
export interface ConstraintDescription {
|
|
46
|
+
/** The underlying Kiwi constraint instance. */
|
|
47
|
+
constraint: Constraint;
|
|
48
|
+
/** Left-hand side expression of the constraint. */
|
|
49
|
+
lhs: UIExpression;
|
|
50
|
+
/** Right-hand side expression of the constraint. */
|
|
51
|
+
rhs: UIExpression;
|
|
52
|
+
/** Priority level for constraint solving. */
|
|
53
|
+
priority: UIPriority;
|
|
54
|
+
/** Relational operator (equal, less than, greater than). */
|
|
55
|
+
relation: UIRelation;
|
|
56
|
+
/** Whether the constraint is currently active. */
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
}
|