laymur 0.16.0 → 0.17.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 +84 -208
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
- package/dist/{constraints → core/constraints}/UIConstraint.d.ts +2 -2
- package/dist/core/constraints/UIConstraint.js +11 -0
- package/dist/core/constraints/UICustomConstraint.js +37 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
- package/dist/{elements → core/elements}/UIAnchor/UIAnchor.Internal.d.ts +3 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
- package/dist/{elements → core/elements}/UIAnchor/UIAnchor.d.ts +3 -3
- package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
- package/dist/{elements → core/elements}/UIDummy/UIDummy.d.ts +2 -2
- package/dist/core/elements/UIDummy/UIDummy.js +173 -0
- package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
- package/dist/{elements → core/elements}/UIElement/UIElement.d.ts +2 -2
- package/dist/core/elements/UIElement/UIElement.js +74 -0
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
- package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
- package/dist/core/elements/UIImage/UIImage.js +85 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
- package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
- package/dist/core/elements/UIProgress/UIProgress.js +165 -0
- package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
- package/dist/core/elements/UIScene/UIScene.js +157 -0
- package/dist/core/elements/UIText/UIText.Internal.js +12 -0
- package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
- package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
- package/dist/core/elements/UIText/UIText.js +265 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
- package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
- package/dist/core/layers/UILayer/UILayer.js +113 -0
- package/dist/core/miscellaneous/UIExpression.js +128 -0
- package/dist/core/miscellaneous/UIMode.js +30 -0
- package/dist/core/miscellaneous/UIOrientation.js +20 -0
- package/dist/core/miscellaneous/UIPriority.js +63 -0
- package/dist/core/miscellaneous/UIRelation.js +40 -0
- package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
- package/dist/core/miscellaneous/area/UIArea.js +5 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
- package/dist/core/miscellaneous/asserts.js +163 -0
- package/dist/core/miscellaneous/canvas.js +37 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
- package/dist/core/miscellaneous/color/UIColor.js +636 -0
- package/dist/core/miscellaneous/computeTransform.js +82 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
- package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
- package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
- package/dist/{miscellaneous → core/miscellaneous}/math.d.ts +2 -0
- package/dist/core/miscellaneous/math.js +11 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
- package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
- package/dist/core/miscellaneous/shared.js +37 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
- package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
- package/dist/core/miscellaneous/webglCapabilities.js +103 -0
- package/dist/core/shaders/UIImage.glsl.js +3 -0
- package/dist/core/shaders/UINineSlice.glsl.js +3 -0
- package/dist/core/shaders/UIProgress.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
- package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.d.ts +2 -2
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
- package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.d.ts +2 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
- package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.d.ts +2 -2
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
- package/dist/index.js +51 -9246
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
- package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
- package/dist/particles/elements/UIEmitter.Internal.js +11 -0
- package/dist/particles/elements/UIEmitter.d.ts +68 -0
- package/dist/particles/elements/UIEmitter.js +203 -0
- package/dist/particles/index.d.ts +18 -0
- package/dist/particles/index.js +18 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
- package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
- package/dist/particles/miscellaneous/miscellaneous.js +67 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
- package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
- package/dist/particles/spawnModules/UISpawnModule.js +9 -0
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
- package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
- package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
- package/package.json +27 -36
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UICustomConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIDummy/UIDummy.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIElement/UIElement.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIImage/UIImage.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIImage/UIImage.d.ts +0 -0
- /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIProgress/UIProgress.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIProgress/UIProgress.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIScene/UIScene.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIScene/UIScene.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Interfaces.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Measuring.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Rendering.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.d.ts +0 -0
- /package/dist/{index.d.ts → core/index.d.ts} +0 -0
- /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +0 -0
- /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -0
- /package/dist/{layers → core/layers}/UILayer/UILayer.Internal.d.ts +0 -0
- /package/dist/{layers → core/layers}/UILayer/UILayer.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIExpression.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIMode.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIOrientation.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIPriority.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIRelation.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UITransparencyMode.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIArea.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaCircle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaPolygon.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRectangle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRoundedRectangle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/asserts.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/canvas.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/computeTransform.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/shared.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunction.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicy.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCover.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCross.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFit.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyNone.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/shared.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/webglCapabilities.d.ts +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Ferrsign2, Ferrsign3 } from 'ferrsign';
|
|
2
|
+
import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
|
|
3
|
+
import { isUIModeVisible } from '../../miscellaneous/UIMode.js';
|
|
4
|
+
import { UIOrientation } from '../../miscellaneous/UIOrientation.js';
|
|
5
|
+
import { UIPriority } from '../../miscellaneous/UIPriority.js';
|
|
6
|
+
import { UIInputWrapper } from '../../wrappers/UIInputWrapper/UIInputWrapper.js';
|
|
7
|
+
import { UISceneWrapper } from '../../wrappers/UISceneWrapper/UISceneWrapper.js';
|
|
8
|
+
import { UISolverWrapper } from '../../wrappers/UISolverWrapper/UISolverWrapper.js';
|
|
9
|
+
import { LAYER_DEFAULT_SIZE, LAYER_DEFAULT_NAME, LAYER_DEFAULT_MODE } from './UILayer.Internal.js';
|
|
10
|
+
|
|
11
|
+
/** Base layer for UI rendering and layout management */
|
|
12
|
+
class UILayer {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
/** Optional layer name */
|
|
15
|
+
this.name = "";
|
|
16
|
+
this.inputWrapperInternal = new UIInputWrapper();
|
|
17
|
+
this._private_solverWrapperInternal = new UISolverWrapper();
|
|
18
|
+
this._private_signalOrientationChangedInternal = new Ferrsign2();
|
|
19
|
+
this._private_signalModeChangedInternal = new Ferrsign2();
|
|
20
|
+
this._private_signalRenderingInternal = new Ferrsign3();
|
|
21
|
+
if (options.width !== undefined) {
|
|
22
|
+
assertValidPositiveNumber(options.width, "UILayer.constructor.options.width");
|
|
23
|
+
}
|
|
24
|
+
if (options.height !== undefined) {
|
|
25
|
+
assertValidPositiveNumber(options.height, "UILayer.constructor.options.height");
|
|
26
|
+
}
|
|
27
|
+
const width = options.width ?? LAYER_DEFAULT_SIZE;
|
|
28
|
+
const height = options.height ?? LAYER_DEFAULT_SIZE;
|
|
29
|
+
this._private_sceneWrapperInternal = new UISceneWrapper(width, height);
|
|
30
|
+
this.name = options.name ?? LAYER_DEFAULT_NAME;
|
|
31
|
+
this._private_modeInternal = options.mode ?? LAYER_DEFAULT_MODE;
|
|
32
|
+
this._private_orientationInternal = width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
|
|
33
|
+
this.xVariable = this._private_solverWrapperInternal.createVariable(0, UIPriority.P0);
|
|
34
|
+
this.yVariable = this._private_solverWrapperInternal.createVariable(0, UIPriority.P0);
|
|
35
|
+
this.wVariable = this._private_solverWrapperInternal.createVariable(width, UIPriority.P0);
|
|
36
|
+
this.hVariable = this._private_solverWrapperInternal.createVariable(height, UIPriority.P0);
|
|
37
|
+
}
|
|
38
|
+
/** @internal */
|
|
39
|
+
get sceneWrapper() {
|
|
40
|
+
return this._private_sceneWrapperInternal;
|
|
41
|
+
}
|
|
42
|
+
/** @internal */
|
|
43
|
+
get solverWrapper() {
|
|
44
|
+
return this._private_solverWrapperInternal;
|
|
45
|
+
}
|
|
46
|
+
/** @internal */
|
|
47
|
+
get inputWrapper() {
|
|
48
|
+
return this.inputWrapperInternal;
|
|
49
|
+
}
|
|
50
|
+
/** X coordinate in world units (always 0 for layers) */
|
|
51
|
+
get x() {
|
|
52
|
+
return this._private_solverWrapperInternal.readVariableValue(this.xVariable);
|
|
53
|
+
}
|
|
54
|
+
/** Y coordinate in world units (always 0 for layers) */
|
|
55
|
+
get y() {
|
|
56
|
+
return this._private_solverWrapperInternal.readVariableValue(this.yVariable);
|
|
57
|
+
}
|
|
58
|
+
/** Layer width in world units */
|
|
59
|
+
get width() {
|
|
60
|
+
return this._private_solverWrapperInternal.readVariableValue(this.wVariable);
|
|
61
|
+
}
|
|
62
|
+
/** Layer height in world units */
|
|
63
|
+
get height() {
|
|
64
|
+
return this._private_solverWrapperInternal.readVariableValue(this.hVariable);
|
|
65
|
+
}
|
|
66
|
+
/** Current visibility and interactivity mode */
|
|
67
|
+
get mode() {
|
|
68
|
+
return this._private_modeInternal;
|
|
69
|
+
}
|
|
70
|
+
/** Current orientation based on aspect ratio */
|
|
71
|
+
get orientation() {
|
|
72
|
+
return this._private_orientationInternal;
|
|
73
|
+
}
|
|
74
|
+
/** Signal fired when orientation changes */
|
|
75
|
+
get signalOrientationChanged() {
|
|
76
|
+
return this._private_signalOrientationChangedInternal;
|
|
77
|
+
}
|
|
78
|
+
/** Signal fired when mode changes */
|
|
79
|
+
get signalModeChanged() {
|
|
80
|
+
return this._private_signalModeChangedInternal;
|
|
81
|
+
}
|
|
82
|
+
/** Signal fired during rendering */
|
|
83
|
+
get signalRendering() {
|
|
84
|
+
return this._private_signalRenderingInternal;
|
|
85
|
+
}
|
|
86
|
+
/** Updates visibility and interactivity mode */
|
|
87
|
+
set mode(value) {
|
|
88
|
+
if (value !== this._private_modeInternal) {
|
|
89
|
+
this._private_modeInternal = value;
|
|
90
|
+
this._private_signalModeChangedInternal.emit(this._private_modeInternal, this);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
resizeInternal(width, height) {
|
|
94
|
+
this._private_solverWrapperInternal.suggestVariableValue(this.wVariable, width);
|
|
95
|
+
this._private_solverWrapperInternal.suggestVariableValue(this.hVariable, height);
|
|
96
|
+
this._private_sceneWrapperInternal.resize(width, height);
|
|
97
|
+
const orientation = width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
|
|
98
|
+
if (orientation !== this._private_orientationInternal) {
|
|
99
|
+
this._private_orientationInternal = orientation;
|
|
100
|
+
this._private_signalOrientationChangedInternal.emit(this._private_orientationInternal, this);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
renderInternal(renderer, deltaTime) {
|
|
104
|
+
if (isUIModeVisible(this.mode)) {
|
|
105
|
+
this._private_signalRenderingInternal.emit(renderer, deltaTime, this);
|
|
106
|
+
this._private_sceneWrapperInternal.render(renderer);
|
|
107
|
+
}
|
|
108
|
+
this._private_solverWrapperInternal.dirty = false;
|
|
109
|
+
this.inputWrapperInternal.dirty = false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { UILayer };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { assertValidNumber } from './asserts.js';
|
|
2
|
+
|
|
3
|
+
/** Linear expression for constraint equations */
|
|
4
|
+
class UIExpression {
|
|
5
|
+
/**
|
|
6
|
+
* @param constant Constant term
|
|
7
|
+
* @param terms Variable-coefficient pairs
|
|
8
|
+
*/
|
|
9
|
+
constructor(constant = 0, terms) {
|
|
10
|
+
assertValidNumber(constant, "UIExpression.constructor.constant");
|
|
11
|
+
this.constant = constant;
|
|
12
|
+
this._private_terms = terms ? new Map(terms) : new Map();
|
|
13
|
+
if (terms) {
|
|
14
|
+
for (let i = 0; i < terms.length; i++) {
|
|
15
|
+
assertValidNumber(terms[i][1], `UIExpression.constructor.terms[${i}][1]`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates expression representing a + b.
|
|
21
|
+
* @param a First expression
|
|
22
|
+
* @param b Second expression
|
|
23
|
+
* @returns Sum of expressions
|
|
24
|
+
*/
|
|
25
|
+
static plus(a, b) {
|
|
26
|
+
const result = new UIExpression(a.constant + b.constant, Array.from(a._private_terms.entries()));
|
|
27
|
+
for (const [variableIndex, coefficient] of b._private_terms) {
|
|
28
|
+
result.plus(variableIndex, coefficient);
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates expression representing a - b.
|
|
34
|
+
* @param a First expression
|
|
35
|
+
* @param b Second expression
|
|
36
|
+
* @returns Difference of expressions
|
|
37
|
+
*/
|
|
38
|
+
static minus(a, b) {
|
|
39
|
+
const result = new UIExpression(a.constant - b.constant, Array.from(a._private_terms.entries()));
|
|
40
|
+
for (const [variableIndex, coefficient] of b._private_terms) {
|
|
41
|
+
result.minus(variableIndex, coefficient);
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Adds variable term to expression.
|
|
47
|
+
* @param variableIndex Variable descriptor
|
|
48
|
+
* @param coefficient Coefficient to add
|
|
49
|
+
* @returns This instance for chaining
|
|
50
|
+
*/
|
|
51
|
+
plus(variableIndex, coefficient) {
|
|
52
|
+
assertValidNumber(coefficient, "UIExpression.plus.coefficient");
|
|
53
|
+
this._private_terms.set(variableIndex, (this._private_terms.get(variableIndex) ?? 0) + coefficient);
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Subtracts variable term from expression.
|
|
58
|
+
* @param variableIndex Variable descriptor
|
|
59
|
+
* @param coefficient Coefficient to subtract
|
|
60
|
+
* @returns This instance for chaining
|
|
61
|
+
*/
|
|
62
|
+
minus(variableIndex, coefficient) {
|
|
63
|
+
return this.plus(variableIndex, -coefficient);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Multiplies all terms by scalar.
|
|
67
|
+
* @param value Scalar multiplier
|
|
68
|
+
* @returns This instance for chaining
|
|
69
|
+
*/
|
|
70
|
+
multiply(value) {
|
|
71
|
+
assertValidNumber(value, "UIExpression.multiply.value");
|
|
72
|
+
this.constant *= value;
|
|
73
|
+
for (const [variableIndex, coefficient] of this._private_terms) {
|
|
74
|
+
this._private_terms.set(variableIndex, coefficient * value);
|
|
75
|
+
}
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Divides all terms by scalar.
|
|
80
|
+
* @param value Scalar divisor
|
|
81
|
+
* @returns This instance for chaining
|
|
82
|
+
*/
|
|
83
|
+
divide(value) {
|
|
84
|
+
assertValidNumber(value, "UIExpression.divide.value");
|
|
85
|
+
if (value === 0) {
|
|
86
|
+
throw new Error("UIExpression.divide.value: cannot divide by zero");
|
|
87
|
+
}
|
|
88
|
+
return this.multiply(1 / value);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks if expression contains variable term.
|
|
92
|
+
* @param variableIndex Variable descriptor
|
|
93
|
+
* @returns True if variable has term
|
|
94
|
+
*/
|
|
95
|
+
hasTerm(variableIndex) {
|
|
96
|
+
return this._private_terms.has(variableIndex);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Copies from another expression.
|
|
100
|
+
* @param expression Source expression
|
|
101
|
+
* @returns This instance for chaining
|
|
102
|
+
*/
|
|
103
|
+
copy(expression) {
|
|
104
|
+
this.constant = expression.constant;
|
|
105
|
+
this._private_terms.clear();
|
|
106
|
+
for (const [variableIndex, coefficient] of expression._private_terms) {
|
|
107
|
+
this._private_terms.set(variableIndex, coefficient);
|
|
108
|
+
}
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Creates independent copy.
|
|
113
|
+
* @returns New expression with same content
|
|
114
|
+
*/
|
|
115
|
+
clone() {
|
|
116
|
+
return new UIExpression(this.constant, Array.from(this._private_terms.entries()));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Prepares terms for solver.
|
|
120
|
+
* @returns Variable-coefficient pairs
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
prepareTerms() {
|
|
124
|
+
return Array.from(this._private_terms.entries());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { UIExpression };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Visibility and interactivity state */
|
|
2
|
+
var UIMode;
|
|
3
|
+
(function (UIMode) {
|
|
4
|
+
/** Not rendered, no input */
|
|
5
|
+
UIMode[UIMode["HIDDEN"] = 0] = "HIDDEN";
|
|
6
|
+
/** Rendered, no input */
|
|
7
|
+
UIMode[UIMode["VISIBLE"] = 1] = "VISIBLE";
|
|
8
|
+
/** Rendered, receives input, blocks input to elements behind */
|
|
9
|
+
UIMode[UIMode["INTERACTIVE"] = 2] = "INTERACTIVE";
|
|
10
|
+
/** Rendered, receives input, passes input to elements behind */
|
|
11
|
+
UIMode[UIMode["INTERACTIVE_TRANSPARENT"] = 3] = "INTERACTIVE_TRANSPARENT";
|
|
12
|
+
})(UIMode || (UIMode = {}));
|
|
13
|
+
/**
|
|
14
|
+
* Checks if mode allows input events.
|
|
15
|
+
* @param mode Mode to check
|
|
16
|
+
* @returns True if interactive
|
|
17
|
+
*/
|
|
18
|
+
function isUIModeInteractive(mode) {
|
|
19
|
+
return mode === UIMode.INTERACTIVE || mode === UIMode.INTERACTIVE_TRANSPARENT;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Checks if mode is rendered.
|
|
23
|
+
* @param mode Mode to check
|
|
24
|
+
* @returns True if visible
|
|
25
|
+
*/
|
|
26
|
+
function isUIModeVisible(mode) {
|
|
27
|
+
return mode !== UIMode.HIDDEN;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { UIMode, isUIModeInteractive, isUIModeVisible };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Screen orientation for conditional constraints */
|
|
2
|
+
var UIOrientation;
|
|
3
|
+
(function (UIOrientation) {
|
|
4
|
+
/** Landscape (width > height) */
|
|
5
|
+
UIOrientation[UIOrientation["HORIZONTAL"] = 0] = "HORIZONTAL";
|
|
6
|
+
/** Portrait (height > width) */
|
|
7
|
+
UIOrientation[UIOrientation["VERTICAL"] = 1] = "VERTICAL";
|
|
8
|
+
/** Active in any orientation */
|
|
9
|
+
UIOrientation[UIOrientation["ALWAYS"] = 2] = "ALWAYS";
|
|
10
|
+
})(UIOrientation || (UIOrientation = {}));
|
|
11
|
+
/**
|
|
12
|
+
* Resolves optional orientation.
|
|
13
|
+
* @param orientation Orientation to resolve
|
|
14
|
+
* @returns Orientation or ALWAYS if undefined
|
|
15
|
+
*/
|
|
16
|
+
function resolveOrientation(orientation) {
|
|
17
|
+
return orientation ?? UIOrientation.ALWAYS;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { UIOrientation, resolveOrientation };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Strength } from '@lume/kiwi';
|
|
2
|
+
|
|
3
|
+
const HIGH_PRIORITY = 1000;
|
|
4
|
+
const MEDIUM_PRIORITY = 100;
|
|
5
|
+
const LOW_PRIORITY = 10;
|
|
6
|
+
/** Constraint solver priority levels */
|
|
7
|
+
var UIPriority;
|
|
8
|
+
(function (UIPriority) {
|
|
9
|
+
/** Highest priority */
|
|
10
|
+
UIPriority[UIPriority["P0"] = 0] = "P0";
|
|
11
|
+
/** High priority */
|
|
12
|
+
UIPriority[UIPriority["P1"] = 1] = "P1";
|
|
13
|
+
/** Medium-high priority */
|
|
14
|
+
UIPriority[UIPriority["P2"] = 2] = "P2";
|
|
15
|
+
/** Medium priority */
|
|
16
|
+
UIPriority[UIPriority["P3"] = 3] = "P3";
|
|
17
|
+
/** Medium-low priority */
|
|
18
|
+
UIPriority[UIPriority["P4"] = 4] = "P4";
|
|
19
|
+
/** Low priority */
|
|
20
|
+
UIPriority[UIPriority["P5"] = 5] = "P5";
|
|
21
|
+
/** Very low priority */
|
|
22
|
+
UIPriority[UIPriority["P6"] = 6] = "P6";
|
|
23
|
+
/** Lowest priority */
|
|
24
|
+
UIPriority[UIPriority["P7"] = 7] = "P7";
|
|
25
|
+
})(UIPriority || (UIPriority = {}));
|
|
26
|
+
/**
|
|
27
|
+
* Converts priority to solver strength.
|
|
28
|
+
* @param priority Priority level
|
|
29
|
+
* @returns Solver strength value
|
|
30
|
+
* @throws If priority is invalid
|
|
31
|
+
*/
|
|
32
|
+
function convertPriority(priority) {
|
|
33
|
+
switch (priority) {
|
|
34
|
+
case UIPriority.P0:
|
|
35
|
+
return Strength.create(HIGH_PRIORITY, HIGH_PRIORITY, HIGH_PRIORITY);
|
|
36
|
+
case UIPriority.P1:
|
|
37
|
+
return Strength.create(MEDIUM_PRIORITY, 0, 0);
|
|
38
|
+
case UIPriority.P2:
|
|
39
|
+
return Strength.create(LOW_PRIORITY, 0, 0);
|
|
40
|
+
case UIPriority.P3:
|
|
41
|
+
return Strength.create(0, MEDIUM_PRIORITY, 0);
|
|
42
|
+
case UIPriority.P4:
|
|
43
|
+
return Strength.create(0, LOW_PRIORITY, 0);
|
|
44
|
+
case UIPriority.P5:
|
|
45
|
+
return Strength.create(0, 0, MEDIUM_PRIORITY);
|
|
46
|
+
case UIPriority.P6:
|
|
47
|
+
return Strength.create(0, 0, LOW_PRIORITY);
|
|
48
|
+
case UIPriority.P7:
|
|
49
|
+
return Strength.create(0, 0, 1);
|
|
50
|
+
default:
|
|
51
|
+
throw new Error(`convertPriority.priority: invalid priority`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolves optional priority.
|
|
56
|
+
* @param priority Priority to resolve
|
|
57
|
+
* @returns Priority or P0 if undefined
|
|
58
|
+
*/
|
|
59
|
+
function resolvePriority(priority) {
|
|
60
|
+
return priority ?? UIPriority.P0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { UIPriority, convertPriority, resolvePriority };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Operator } from '@lume/kiwi';
|
|
2
|
+
|
|
3
|
+
/** Relational operators for constraints */
|
|
4
|
+
var UIRelation;
|
|
5
|
+
(function (UIRelation) {
|
|
6
|
+
/** Equality: LHS = RHS */
|
|
7
|
+
UIRelation[UIRelation["EQUAL"] = 0] = "EQUAL";
|
|
8
|
+
/** Less than or equal: LHS ≤ RHS */
|
|
9
|
+
UIRelation[UIRelation["LESS_THAN"] = 1] = "LESS_THAN";
|
|
10
|
+
/** Greater than or equal: LHS ≥ RHS */
|
|
11
|
+
UIRelation[UIRelation["GREATER_THAN"] = 2] = "GREATER_THAN";
|
|
12
|
+
})(UIRelation || (UIRelation = {}));
|
|
13
|
+
/**
|
|
14
|
+
* Converts relation to solver operator.
|
|
15
|
+
* @param relation Relation type
|
|
16
|
+
* @returns Solver operator
|
|
17
|
+
* @throws If relation is invalid
|
|
18
|
+
*/
|
|
19
|
+
function convertRelation(relation) {
|
|
20
|
+
switch (relation) {
|
|
21
|
+
case UIRelation.EQUAL:
|
|
22
|
+
return Operator.Eq;
|
|
23
|
+
case UIRelation.LESS_THAN:
|
|
24
|
+
return Operator.Le;
|
|
25
|
+
case UIRelation.GREATER_THAN:
|
|
26
|
+
return Operator.Ge;
|
|
27
|
+
default:
|
|
28
|
+
throw new Error(`convertRelation.relation: invalid relation`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resolves optional relation.
|
|
33
|
+
* @param relation Relation to resolve
|
|
34
|
+
* @returns Relation or EQUAL if undefined
|
|
35
|
+
*/
|
|
36
|
+
function resolveRelation(relation) {
|
|
37
|
+
return relation ?? UIRelation.EQUAL;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { UIRelation, convertRelation, resolveRelation };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Transparency rendering modes */
|
|
2
|
+
var UITransparencyMode;
|
|
3
|
+
(function (UITransparencyMode) {
|
|
4
|
+
/** Binary transparency. Best performance. */
|
|
5
|
+
UITransparencyMode[UITransparencyMode["CLIP"] = 0] = "CLIP";
|
|
6
|
+
/** Dithered transparency. Good performance. */
|
|
7
|
+
UITransparencyMode[UITransparencyMode["HASH"] = 1] = "HASH";
|
|
8
|
+
/** Alpha blending. Best quality, requires depth sorting. */
|
|
9
|
+
UITransparencyMode[UITransparencyMode["BLEND"] = 2] = "BLEND";
|
|
10
|
+
})(UITransparencyMode || (UITransparencyMode = {}));
|
|
11
|
+
|
|
12
|
+
export { UITransparencyMode };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { assertValidNonNegativeNumber, assertValidNumber } from '../asserts.js';
|
|
2
|
+
import { UIArea } from './UIArea.js';
|
|
3
|
+
|
|
4
|
+
/** Circular interaction area */
|
|
5
|
+
class UIAreaCircle extends UIArea {
|
|
6
|
+
/**
|
|
7
|
+
* Creates circular area.
|
|
8
|
+
*
|
|
9
|
+
* @param centerX - Center X in normalized coordinates (0 to 1)
|
|
10
|
+
* @param centerY - Center Y in normalized coordinates (0 to 1)
|
|
11
|
+
* @param radius - Radius in normalized coordinates (0 to 1)
|
|
12
|
+
*/
|
|
13
|
+
constructor(centerX, centerY, radius) {
|
|
14
|
+
super();
|
|
15
|
+
this.centerX = centerX;
|
|
16
|
+
this.centerY = centerY;
|
|
17
|
+
this.radius = radius;
|
|
18
|
+
assertValidNonNegativeNumber(centerX, "UIAreaCircle.constructor.centerX");
|
|
19
|
+
assertValidNonNegativeNumber(centerY, "UIAreaCircle.constructor.centerY");
|
|
20
|
+
assertValidNonNegativeNumber(radius, "UIAreaCircle.constructor.radius");
|
|
21
|
+
}
|
|
22
|
+
/** @internal */
|
|
23
|
+
contains(pointX, pointY) {
|
|
24
|
+
assertValidNumber(pointX, "UIAreaCircle.contains.pointX");
|
|
25
|
+
assertValidNumber(pointY, "UIAreaCircle.contains.pointY");
|
|
26
|
+
const deltaX = pointX - this.centerX;
|
|
27
|
+
const deltaY = pointY - this.centerY;
|
|
28
|
+
return deltaX * deltaX + deltaY * deltaY <= this.radius * this.radius;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { UIAreaCircle };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { assertValidNumber } from '../asserts.js';
|
|
2
|
+
import { UIArea } from './UIArea.js';
|
|
3
|
+
|
|
4
|
+
/** Polygonal interaction area using ray casting */
|
|
5
|
+
class UIAreaPolygon extends UIArea {
|
|
6
|
+
/**
|
|
7
|
+
* Creates polygonal area.
|
|
8
|
+
*
|
|
9
|
+
* @param vertices - Vertices in normalized coordinates (0 to 1)
|
|
10
|
+
*/
|
|
11
|
+
constructor(vertices) {
|
|
12
|
+
super();
|
|
13
|
+
this.vertices = vertices;
|
|
14
|
+
}
|
|
15
|
+
/** @internal */
|
|
16
|
+
contains(pointX, pointY) {
|
|
17
|
+
assertValidNumber(pointX, "UIAreaPolygon.contains.pointX");
|
|
18
|
+
assertValidNumber(pointY, "UIAreaPolygon.contains.pointY");
|
|
19
|
+
const vertexCount = this.vertices.length;
|
|
20
|
+
if (vertexCount < 3) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
let inside = false;
|
|
24
|
+
for (let index = 0, previousIndex = vertexCount - 1; index < vertexCount; previousIndex = index++) {
|
|
25
|
+
const currentVertex = this.vertices[index];
|
|
26
|
+
const previousVertex = this.vertices[previousIndex];
|
|
27
|
+
const currentX = currentVertex.x;
|
|
28
|
+
const currentY = currentVertex.y;
|
|
29
|
+
const previousX = previousVertex.x;
|
|
30
|
+
const previousY = previousVertex.y;
|
|
31
|
+
if (currentY > pointY !== previousY > pointY &&
|
|
32
|
+
pointX < ((previousX - currentX) * (pointY - currentY)) / (previousY - currentY) + currentX) {
|
|
33
|
+
inside = !inside;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return inside;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { UIAreaPolygon };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { assertValidNonNegativeNumber, assertValidNumber } from '../asserts.js';
|
|
2
|
+
import { UIArea } from './UIArea.js';
|
|
3
|
+
|
|
4
|
+
/** Rectangular interaction area */
|
|
5
|
+
class UIAreaRectangle extends UIArea {
|
|
6
|
+
/**
|
|
7
|
+
* Creates rectangular area.
|
|
8
|
+
*
|
|
9
|
+
* @param x - X position in normalized coordinates (0 to 1)
|
|
10
|
+
* @param y - Y position in normalized coordinates (0 to 1)
|
|
11
|
+
* @param width - Width in normalized coordinates (0 to 1)
|
|
12
|
+
* @param height - Height in normalized coordinates (0 to 1)
|
|
13
|
+
*/
|
|
14
|
+
constructor(x, y, width, height) {
|
|
15
|
+
super();
|
|
16
|
+
this.x = x;
|
|
17
|
+
this.y = y;
|
|
18
|
+
this.width = width;
|
|
19
|
+
this.height = height;
|
|
20
|
+
assertValidNonNegativeNumber(x, "UIAreaRectangle.constructor.x");
|
|
21
|
+
assertValidNonNegativeNumber(y, "UIAreaRectangle.constructor.y");
|
|
22
|
+
assertValidNonNegativeNumber(width, "UIAreaRectangle.constructor.width");
|
|
23
|
+
assertValidNonNegativeNumber(height, "UIAreaRectangle.constructor.height");
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
26
|
+
contains(pointX, pointY) {
|
|
27
|
+
assertValidNumber(pointX, "UIAreaRectangle.contains.pointX");
|
|
28
|
+
assertValidNumber(pointY, "UIAreaRectangle.contains.pointY");
|
|
29
|
+
return (pointX >= this.x &&
|
|
30
|
+
pointX <= this.x + this.width &&
|
|
31
|
+
pointY >= this.y &&
|
|
32
|
+
pointY <= this.y + this.height);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { UIAreaRectangle };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { assertValidNonNegativeNumber, assertValidNumber } from '../asserts.js';
|
|
2
|
+
import { UIArea } from './UIArea.js';
|
|
3
|
+
|
|
4
|
+
/** Rectangular interaction area with rounded corners */
|
|
5
|
+
class UIAreaRoundedRectangle extends UIArea {
|
|
6
|
+
/**
|
|
7
|
+
* Creates rounded rectangular area.
|
|
8
|
+
*
|
|
9
|
+
* Radius clamped to half of smallest dimension.
|
|
10
|
+
*
|
|
11
|
+
* @param x - X position in normalized coordinates (0 to 1)
|
|
12
|
+
* @param y - Y position in normalized coordinates (0 to 1)
|
|
13
|
+
* @param width - Width in normalized coordinates (0 to 1)
|
|
14
|
+
* @param height - Height in normalized coordinates (0 to 1)
|
|
15
|
+
* @param radius - Corner radius in normalized coordinates (0 to 1)
|
|
16
|
+
*/
|
|
17
|
+
constructor(x, y, width, height, radius) {
|
|
18
|
+
super();
|
|
19
|
+
this.x = x;
|
|
20
|
+
this.y = y;
|
|
21
|
+
this.width = width;
|
|
22
|
+
this.height = height;
|
|
23
|
+
this.radius = radius;
|
|
24
|
+
assertValidNonNegativeNumber(x, "UIAreaRoundedRectangle.constructor.x");
|
|
25
|
+
assertValidNonNegativeNumber(y, "UIAreaRoundedRectangle.constructor.y");
|
|
26
|
+
assertValidNonNegativeNumber(width, "UIAreaRoundedRectangle.constructor.width");
|
|
27
|
+
assertValidNonNegativeNumber(height, "UIAreaRoundedRectangle.constructor.height");
|
|
28
|
+
assertValidNonNegativeNumber(radius, "UIAreaRoundedRectangle.constructor.radius");
|
|
29
|
+
this.radius = Math.min(radius, Math.min(width, height) / 2);
|
|
30
|
+
}
|
|
31
|
+
/** @internal */
|
|
32
|
+
contains(pointX, pointY) {
|
|
33
|
+
assertValidNumber(pointX, "UIAreaRoundedRectangle.contains.pointX");
|
|
34
|
+
assertValidNumber(pointY, "UIAreaRoundedRectangle.contains.pointY");
|
|
35
|
+
const left = this.x;
|
|
36
|
+
const right = this.x + this.width;
|
|
37
|
+
const top = this.y;
|
|
38
|
+
const bottom = this.y + this.height;
|
|
39
|
+
if (pointX < left || pointX > right || pointY < top || pointY > bottom) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const cornerLeft = left + this.radius;
|
|
43
|
+
const cornerRight = right - this.radius;
|
|
44
|
+
const cornerTop = top + this.radius;
|
|
45
|
+
const cornerBottom = bottom - this.radius;
|
|
46
|
+
if (pointX >= cornerLeft && pointX <= cornerRight) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
if (pointY >= cornerTop && pointY <= cornerBottom) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
let centerX;
|
|
53
|
+
let centerY;
|
|
54
|
+
if (pointX < cornerLeft) {
|
|
55
|
+
centerX = cornerLeft;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
centerX = cornerRight;
|
|
59
|
+
}
|
|
60
|
+
if (pointY < cornerTop) {
|
|
61
|
+
centerY = cornerTop;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
centerY = cornerBottom;
|
|
65
|
+
}
|
|
66
|
+
const deltaX = pointX - centerX;
|
|
67
|
+
const deltaY = pointY - centerY;
|
|
68
|
+
return deltaX * deltaX + deltaY * deltaY <= this.radius * this.radius;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { UIAreaRoundedRectangle };
|