laymur 0.17.0 → 0.17.2
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 +5 -0
- package/{src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts → dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +22 -0
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
- package/dist/core/constraints/UIConstraint.d.ts +12 -0
- package/dist/core/constraints/UIConstraint.js +11 -0
- package/dist/core/constraints/UICustomConstraint.d.ts +28 -0
- package/dist/core/constraints/UICustomConstraint.js +37 -0
- package/{src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts → dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +20 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +11 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +36 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +14 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +44 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
- package/{src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts → dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +22 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
- package/{src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts → dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts} +8 -9
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +43 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +11 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +32 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +14 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +44 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
- package/{src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts → dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +22 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
- package/{src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts → dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +20 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +64 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +46 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +13 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +29 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +13 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +29 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.d.ts +12 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +32 -0
- package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +27 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +77 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +30 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
- package/dist/core/elements/UIDummy/UIDummy.d.ts +82 -0
- package/dist/core/elements/UIDummy/UIDummy.js +173 -0
- package/{src/core/elements/UIElement/UIElement.Internal.ts → dist/core/elements/UIElement/UIElement.Internal.d.ts} +5 -7
- package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
- package/dist/core/elements/UIElement/UIElement.d.ts +38 -0
- package/dist/core/elements/UIElement/UIElement.js +74 -0
- package/{src/core/elements/UIGraphics/UIGraphics.Internal.ts → dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts} +5 -7
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +51 -0
- package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
- package/{src/core/elements/UIImage/UIImage.Internal.ts → dist/core/elements/UIImage/UIImage.Internal.d.ts} +2 -3
- package/dist/core/elements/UIImage/UIImage.d.ts +32 -0
- package/dist/core/elements/UIImage/UIImage.js +85 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +23 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +60 -0
- package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +14 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
- package/dist/core/elements/UIProgress/UIProgress.d.ts +45 -0
- package/dist/core/elements/UIProgress/UIProgress.js +165 -0
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +43 -0
- package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
- package/dist/core/elements/UIScene/UIScene.d.ts +59 -0
- package/dist/core/elements/UIScene/UIScene.js +157 -0
- package/{src/core/elements/UIText/UIText.Interfaces.ts → dist/core/elements/UIText/UIText.Interfaces.d.ts} +16 -21
- package/dist/core/elements/UIText/UIText.Internal.d.ts +26 -0
- package/dist/core/elements/UIText/UIText.Internal.js +12 -0
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +50 -0
- package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +20 -0
- package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
- package/dist/core/elements/UIText/UIText.d.ts +71 -0
- package/dist/core/elements/UIText/UIText.js +265 -0
- package/{src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts → dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts} +11 -14
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +63 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
- package/{src/core/layers/UILayer/UILayer.Internal.ts → dist/core/layers/UILayer/UILayer.Internal.d.ts} +11 -15
- package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
- package/dist/core/layers/UILayer/UILayer.d.ts +49 -0
- package/dist/core/layers/UILayer/UILayer.js +113 -0
- package/dist/core/miscellaneous/UIExpression.d.ts +69 -0
- package/dist/core/miscellaneous/UIExpression.js +128 -0
- package/dist/core/miscellaneous/UIMode.d.ts +23 -0
- package/dist/core/miscellaneous/UIMode.js +30 -0
- package/dist/core/miscellaneous/UIOrientation.d.ts +15 -0
- package/dist/core/miscellaneous/UIOrientation.js +20 -0
- package/dist/core/miscellaneous/UIPriority.d.ts +32 -0
- package/dist/core/miscellaneous/UIPriority.js +63 -0
- package/dist/core/miscellaneous/UIRelation.d.ts +23 -0
- package/dist/core/miscellaneous/UIRelation.js +40 -0
- package/dist/core/miscellaneous/UITransparencyMode.d.ts +9 -0
- package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
- package/dist/core/miscellaneous/area/UIArea.d.ts +3 -0
- package/dist/core/miscellaneous/area/UIArea.js +5 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +15 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +12 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +17 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +21 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
- package/dist/core/miscellaneous/asserts.d.ts +43 -0
- package/dist/core/miscellaneous/asserts.js +163 -0
- package/dist/core/miscellaneous/canvas.d.ts +31 -0
- package/dist/core/miscellaneous/canvas.js +37 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +7 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
- package/dist/core/miscellaneous/color/UIColor.d.ts +234 -0
- package/dist/core/miscellaneous/color/UIColor.js +636 -0
- package/dist/core/miscellaneous/computeTransform.d.ts +18 -0
- package/dist/core/miscellaneous/computeTransform.js +82 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +19 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
- package/{src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts → dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts} +8 -10
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +38 -0
- package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.d.ts +11 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +48 -0
- package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +9 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +21 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +16 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
- package/dist/core/miscellaneous/math.d.ts +7 -0
- package/dist/core/miscellaneous/math.js +11 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.d.ts +31 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +59 -0
- package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.d.ts +3 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +5 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
- package/dist/core/miscellaneous/shared.d.ts +46 -0
- package/dist/core/miscellaneous/shared.js +37 -0
- package/{src/core/miscellaneous/text-span/UITextSpan.Internal.ts → dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts} +4 -5
- package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +14 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.d.ts +48 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +85 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +49 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +67 -0
- package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
- package/dist/core/miscellaneous/webglCapabilities.d.ts +2 -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/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +17 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +13 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +13 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +20 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +49 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +215 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
- package/dist/index.js +51 -0
- 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.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 +8 -1
- package/.claude/settings.local.json +0 -9
- package/.editorconfig +0 -14
- package/CLAUDE.md +0 -181
- package/assets/logotype.png +0 -0
- package/eslint.config.js +0 -111
- package/rollup.config.js +0 -52
- package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +0 -60
- package/src/core/constraints/UIConstraint.ts +0 -20
- package/src/core/constraints/UICustomConstraint.ts +0 -62
- package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +0 -52
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +0 -13
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +0 -139
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +0 -16
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +0 -189
- package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +0 -68
- package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +0 -94
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +0 -13
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +0 -135
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +0 -16
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +0 -189
- package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +0 -68
- package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +0 -52
- package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +0 -84
- package/src/core/constraints/builders/UIConstraint2DBuilder.ts +0 -168
- package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +0 -15
- package/src/core/constraints/builders/UICoverConstraintBuilder.ts +0 -84
- package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +0 -15
- package/src/core/constraints/builders/UIFitConstraintBuilder.ts +0 -84
- package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +0 -13
- package/src/core/elements/UIAnchor/UIAnchor.ts +0 -70
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +0 -30
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +0 -355
- package/src/core/elements/UIDummy/UIDummy.Internal.ts +0 -33
- package/src/core/elements/UIDummy/UIDummy.ts +0 -244
- package/src/core/elements/UIElement/UIElement.ts +0 -127
- package/src/core/elements/UIGraphics/UIGraphics.ts +0 -168
- package/src/core/elements/UIImage/UIImage.ts +0 -138
- package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +0 -26
- package/src/core/elements/UINineSlice/UINineSlice.ts +0 -296
- package/src/core/elements/UIProgress/UIProgress.Internal.ts +0 -24
- package/src/core/elements/UIProgress/UIProgress.ts +0 -259
- package/src/core/elements/UIScene/UIScene.Internal.ts +0 -46
- package/src/core/elements/UIScene/UIScene.ts +0 -259
- package/src/core/elements/UIText/UIText.Internal.ts +0 -29
- package/src/core/elements/UIText/UIText.Measuring.ts +0 -183
- package/src/core/elements/UIText/UIText.Rendering.ts +0 -83
- package/src/core/elements/UIText/UIText.ts +0 -376
- package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +0 -233
- package/src/core/layers/UILayer/UILayer.ts +0 -156
- package/src/core/miscellaneous/UIExpression.ts +0 -142
- package/src/core/miscellaneous/UIMode.ts +0 -29
- package/src/core/miscellaneous/UIOrientation.ts +0 -18
- package/src/core/miscellaneous/UIPriority.ts +0 -63
- package/src/core/miscellaneous/UIRelation.ts +0 -39
- package/src/core/miscellaneous/UITransparencyMode.ts +0 -9
- package/src/core/miscellaneous/area/UIArea.ts +0 -5
- package/src/core/miscellaneous/area/UIAreaCircle.ts +0 -32
- package/src/core/miscellaneous/area/UIAreaPolygon.ts +0 -50
- package/src/core/miscellaneous/area/UIAreaRectangle.ts +0 -38
- package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +0 -78
- package/src/core/miscellaneous/asserts.ts +0 -187
- package/src/core/miscellaneous/canvas.ts +0 -73
- package/src/core/miscellaneous/color/UIColor.Internal.ts +0 -89
- package/src/core/miscellaneous/color/UIColor.ts +0 -844
- package/src/core/miscellaneous/computeTransform.ts +0 -127
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +0 -235
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +0 -524
- package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +0 -448
- package/src/core/miscellaneous/generic-plane/shared.ts +0 -323
- package/src/core/miscellaneous/insets/UIInsets.Internal.ts +0 -9
- package/src/core/miscellaneous/insets/UIInsets.ts +0 -248
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +0 -24
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +0 -58
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +0 -52
- package/src/core/miscellaneous/math.ts +0 -16
- package/src/core/miscellaneous/micro/UIMicro.Internal.ts +0 -33
- package/src/core/miscellaneous/micro/UIMicro.ts +0 -222
- package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +0 -8
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +0 -57
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +0 -57
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +0 -11
- package/src/core/miscellaneous/shared.ts +0 -73
- package/src/core/miscellaneous/text-span/UITextSpan.ts +0 -43
- package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +0 -52
- package/src/core/miscellaneous/text-style/UITextStyle.ts +0 -479
- package/src/core/miscellaneous/texture/UITextureView.Internal.ts +0 -55
- package/src/core/miscellaneous/texture/UITextureView.ts +0 -308
- package/src/core/miscellaneous/webglCapabilities.ts +0 -129
- package/src/core/shaders/UIImage.glsl +0 -10
- package/src/core/shaders/UINineSlice.glsl +0 -53
- package/src/core/shaders/UIProgress.glsl +0 -15
- package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +0 -13
- package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +0 -12
- package/src/core/shaders/glsl.d.ts +0 -27
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +0 -23
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +0 -124
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +0 -22
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +0 -101
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +0 -58
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +0 -605
- package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +0 -70
- package/src/particles/behaviorModules/UIBehaviorModule.ts +0 -20
- package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +0 -173
- package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +0 -104
- package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +0 -75
- package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +0 -115
- package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +0 -77
- package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +0 -118
- package/src/particles/elements/UIEmitter.Internal.ts +0 -22
- package/src/particles/elements/UIEmitter.ts +0 -313
- package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +0 -263
- package/src/particles/instancedParticle/UIInstancedParticle.ts +0 -138
- package/src/particles/miscellaneous/miscellaneous.ts +0 -115
- package/src/particles/renderingModules/UIRenderingColorOverLife.ts +0 -39
- package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +0 -49
- package/src/particles/renderingModules/UIRenderingModule.ts +0 -17
- package/src/particles/renderingModules/UIRenderingTexture.ts +0 -30
- package/src/particles/shaders/UIRenderingColorOverLife.glsl +0 -4
- package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +0 -6
- package/src/particles/shaders/UIRenderingTexture.glsl +0 -4
- package/src/particles/spawnModules/UISpawnModule.ts +0 -22
- package/src/particles/spawnModules/UISpawnOffset.ts +0 -62
- package/src/particles/spawnModules/UISpawnRandomLifetime.ts +0 -68
- package/src/particles/spawnModules/UISpawnRandomRotation.ts +0 -60
- package/src/particles/spawnModules/UISpawnRandomScale.ts +0 -81
- package/src/particles/spawnModules/UISpawnRandomTorque.ts +0 -62
- package/src/particles/spawnModules/UISpawnRandomVelocity.ts +0 -92
- package/src/particles/spawnModules/UISpawnRectangle.ts +0 -81
- package/tsconfig.json +0 -29
- /package/{src/core/index.ts → dist/core/index.d.ts} +0 -0
- /package/{src/particles/index.ts → dist/particles/index.d.ts} +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIExpression } from '../../miscellaneous/UIExpression.js';
|
|
3
|
+
import { UISingleParameterConstraint } from '../UISingleParameterConstraint/UISingleParameterConstraint.js';
|
|
4
|
+
|
|
5
|
+
/** Fixes element width to constant value */
|
|
6
|
+
class UIWidthConstraint extends UISingleParameterConstraint {
|
|
7
|
+
/**
|
|
8
|
+
* @param element Element to constrain
|
|
9
|
+
* @param options Width configuration. Defaults to element's current width.
|
|
10
|
+
*/
|
|
11
|
+
constructor(_private_element, options = {}) {
|
|
12
|
+
if (options.width !== undefined) {
|
|
13
|
+
assertValidPositiveNumber(options.width, "UIWidthConstraint.constructor.options.width");
|
|
14
|
+
}
|
|
15
|
+
super(_private_element.layer, options);
|
|
16
|
+
this._private_element = _private_element;
|
|
17
|
+
this._private_widthInternal = options.width ?? _private_element.width;
|
|
18
|
+
this.constraint = this.solverWrapper.createConstraint(new UIExpression(0, [[this._private_element.wVariable, 1]]), new UIExpression(this._private_widthInternal), this.relation, this.priority, this.isConstraintEnabled());
|
|
19
|
+
}
|
|
20
|
+
/** Current width in world units */
|
|
21
|
+
get width() {
|
|
22
|
+
return this._private_widthInternal;
|
|
23
|
+
}
|
|
24
|
+
/** Updates width */
|
|
25
|
+
set width(value) {
|
|
26
|
+
assertValidPositiveNumber(value, "UIWidthConstraint.width");
|
|
27
|
+
if (this._private_widthInternal !== value) {
|
|
28
|
+
this._private_widthInternal = value;
|
|
29
|
+
this.solverWrapper.setConstraintRHS(this.constraint, new UIExpression(value));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { UIWidthConstraint };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { UIOrientation } from "../../miscellaneous/UIOrientation";
|
|
2
|
+
import type { UIPriority } from "../../miscellaneous/UIPriority";
|
|
3
|
+
import type { UIRelation } from "../../miscellaneous/UIRelation";
|
|
4
|
+
/** Horizontal and vertical values object */
|
|
5
|
+
export interface UIType2DObject<T> {
|
|
6
|
+
/** Horizontal value */
|
|
7
|
+
h?: T;
|
|
8
|
+
/** Vertical value */
|
|
9
|
+
v?: T;
|
|
10
|
+
}
|
|
11
|
+
/** Horizontal and vertical values as object, tuple, or single value */
|
|
12
|
+
export type UIType2D<T> = UIType2DObject<T> | [T, T] | T;
|
|
13
|
+
/**
|
|
14
|
+
* Normalizes UIType2D input to object form.
|
|
15
|
+
* @param value Object, tuple, or single value
|
|
16
|
+
* @returns Normalized object with h and v properties
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeUIType2D<T>(value: UIType2D<T> | undefined): UIType2DObject<T>;
|
|
19
|
+
/** Base 2D constraint options */
|
|
20
|
+
export interface UIConstraint2DOptions {
|
|
21
|
+
/** Priority for each axis */
|
|
22
|
+
priority: UIType2D<UIPriority>;
|
|
23
|
+
/** Relation for each axis */
|
|
24
|
+
relation: UIType2D<UIRelation>;
|
|
25
|
+
/** Orientation for each axis */
|
|
26
|
+
orientation: UIType2D<UIOrientation>;
|
|
27
|
+
}
|
|
28
|
+
/** 2D size constraint options */
|
|
29
|
+
export interface UIConstraintSize2DOptions extends UIConstraint2DOptions {
|
|
30
|
+
/** Width and height */
|
|
31
|
+
size: UIType2D<number>;
|
|
32
|
+
}
|
|
33
|
+
/** 2D distance constraint options */
|
|
34
|
+
export interface UIConstraintDistance2DOptions extends UIConstraint2DOptions {
|
|
35
|
+
/** Anchor on element A for each axis */
|
|
36
|
+
anchorA: UIType2D<number>;
|
|
37
|
+
/** Anchor on element B for each axis */
|
|
38
|
+
anchorB: UIType2D<number>;
|
|
39
|
+
/** Distance for each axis */
|
|
40
|
+
distance: UIType2D<number>;
|
|
41
|
+
}
|
|
42
|
+
/** 2D proportion constraint options */
|
|
43
|
+
export interface UIConstraintProportion2DOptions extends UIConstraint2DOptions {
|
|
44
|
+
/** Proportion for each axis */
|
|
45
|
+
proportion: UIType2D<number>;
|
|
46
|
+
}
|
|
47
|
+
/** 2D interpolation constraint options */
|
|
48
|
+
export interface UIConstraintInterpolation2DOptions extends UIConstraint2DOptions {
|
|
49
|
+
/** Anchor on element A for each axis */
|
|
50
|
+
anchorA: UIType2D<number>;
|
|
51
|
+
/** Anchor on element B for each axis */
|
|
52
|
+
anchorB: UIType2D<number>;
|
|
53
|
+
/** Anchor on element C for each axis */
|
|
54
|
+
anchorC: UIType2D<number>;
|
|
55
|
+
/** Interpolation factor for each axis */
|
|
56
|
+
t: UIType2D<number>;
|
|
57
|
+
}
|
|
58
|
+
/** Horizontal and vertical constraint pair */
|
|
59
|
+
export interface UIConstraint2DResult<TH, TV> {
|
|
60
|
+
/** Horizontal constraint */
|
|
61
|
+
h: TH;
|
|
62
|
+
/** Vertical constraint */
|
|
63
|
+
v: TV;
|
|
64
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes UIType2D input to object form.
|
|
3
|
+
* @param value Object, tuple, or single value
|
|
4
|
+
* @returns Normalized object with h and v properties
|
|
5
|
+
*/
|
|
6
|
+
function normalizeUIType2D(value) {
|
|
7
|
+
if (value === undefined) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
return { h: value[0], v: value[1] };
|
|
12
|
+
}
|
|
13
|
+
if (typeof value === "object" && value !== null && ("h" in value || "v" in value)) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
return { h: value, v: value };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { normalizeUIType2D };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { UIElement } from "../../elements/UIElement/UIElement";
|
|
2
|
+
import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
|
|
3
|
+
import { UIHeightConstraint } from "../UIHeightConstraint/UIHeightConstraint";
|
|
4
|
+
import { UIHorizontalDistanceConstraint } from "../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint";
|
|
5
|
+
import { UIHorizontalInterpolationConstraint } from "../UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint";
|
|
6
|
+
import { UIHorizontalProportionConstraint } from "../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint";
|
|
7
|
+
import { UIVerticalDistanceConstraint } from "../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint";
|
|
8
|
+
import { UIVerticalInterpolationConstraint } from "../UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint";
|
|
9
|
+
import { UIVerticalProportionConstraint } from "../UIVerticalProportionConstraint/UIVerticalProportionConstraint";
|
|
10
|
+
import { UIWidthConstraint } from "../UIWidthConstraint/UIWidthConstraint";
|
|
11
|
+
import type { UIConstraint2DResult, UIConstraintDistance2DOptions, UIConstraintInterpolation2DOptions, UIConstraintProportion2DOptions, UIConstraintSize2DOptions } from "./UIConstraint2DBuilder.Internal";
|
|
12
|
+
/** Builder for paired horizontal and vertical constraints */
|
|
13
|
+
export declare class UIConstraint2DBuilder {
|
|
14
|
+
/**
|
|
15
|
+
* Creates width and height constraints.
|
|
16
|
+
* @param element Element to constrain
|
|
17
|
+
* @param options Size configuration for both axes
|
|
18
|
+
* @returns Width and height constraints
|
|
19
|
+
*/
|
|
20
|
+
static size(element: UIElement, options?: Partial<UIConstraintSize2DOptions>): UIConstraint2DResult<UIWidthConstraint, UIHeightConstraint>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates horizontal and vertical distance constraints.
|
|
23
|
+
* @param a First element
|
|
24
|
+
* @param b Second element
|
|
25
|
+
* @param options Distance configuration for both axes
|
|
26
|
+
* @returns Horizontal and vertical distance constraints
|
|
27
|
+
*/
|
|
28
|
+
static distance(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, options?: Partial<UIConstraintDistance2DOptions>): UIConstraint2DResult<UIHorizontalDistanceConstraint, UIVerticalDistanceConstraint>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates horizontal and vertical proportion constraints.
|
|
31
|
+
* @param a Element with proportional dimensions
|
|
32
|
+
* @param b Target element
|
|
33
|
+
* @param options Proportion configuration for both axes
|
|
34
|
+
* @returns Horizontal and vertical proportion constraints
|
|
35
|
+
*/
|
|
36
|
+
static proportion(a: UIPlaneElement, b: UIPlaneElement, options?: Partial<UIConstraintProportion2DOptions>): UIConstraint2DResult<UIHorizontalProportionConstraint, UIVerticalProportionConstraint>;
|
|
37
|
+
/**
|
|
38
|
+
* Creates horizontal and vertical interpolation constraints.
|
|
39
|
+
* @param a First element
|
|
40
|
+
* @param b Second element
|
|
41
|
+
* @param c Element to position between A and B
|
|
42
|
+
* @param options Interpolation configuration for both axes
|
|
43
|
+
* @returns Horizontal and vertical interpolation constraints
|
|
44
|
+
*/
|
|
45
|
+
static interpolation(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, c: UIPointElement | UIPlaneElement, options?: Partial<UIConstraintInterpolation2DOptions>): UIConstraint2DResult<UIHorizontalInterpolationConstraint, UIVerticalInterpolationConstraint>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { UIHeightConstraint } from '../UIHeightConstraint/UIHeightConstraint.js';
|
|
2
|
+
import { UIHorizontalDistanceConstraint } from '../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js';
|
|
3
|
+
import { UIHorizontalInterpolationConstraint } from '../UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js';
|
|
4
|
+
import { UIHorizontalProportionConstraint } from '../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js';
|
|
5
|
+
import { UIVerticalDistanceConstraint } from '../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js';
|
|
6
|
+
import { UIVerticalInterpolationConstraint } from '../UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js';
|
|
7
|
+
import { UIVerticalProportionConstraint } from '../UIVerticalProportionConstraint/UIVerticalProportionConstraint.js';
|
|
8
|
+
import { UIWidthConstraint } from '../UIWidthConstraint/UIWidthConstraint.js';
|
|
9
|
+
import { normalizeUIType2D } from './UIConstraint2DBuilder.Internal.js';
|
|
10
|
+
|
|
11
|
+
/** Builder for paired horizontal and vertical constraints */
|
|
12
|
+
class UIConstraint2DBuilder {
|
|
13
|
+
/**
|
|
14
|
+
* Creates width and height constraints.
|
|
15
|
+
* @param element Element to constrain
|
|
16
|
+
* @param options Size configuration for both axes
|
|
17
|
+
* @returns Width and height constraints
|
|
18
|
+
*/
|
|
19
|
+
static size(element, options = {}) {
|
|
20
|
+
const size = normalizeUIType2D(options.size);
|
|
21
|
+
const priority = normalizeUIType2D(options.priority);
|
|
22
|
+
const relation = normalizeUIType2D(options.relation);
|
|
23
|
+
const orientation = normalizeUIType2D(options.orientation);
|
|
24
|
+
return {
|
|
25
|
+
h: new UIWidthConstraint(element, {
|
|
26
|
+
width: size.h,
|
|
27
|
+
priority: priority.h,
|
|
28
|
+
relation: relation.h,
|
|
29
|
+
orientation: orientation.h,
|
|
30
|
+
}),
|
|
31
|
+
v: new UIHeightConstraint(element, {
|
|
32
|
+
height: size.v,
|
|
33
|
+
priority: priority.v,
|
|
34
|
+
relation: relation.v,
|
|
35
|
+
orientation: orientation.v,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates horizontal and vertical distance constraints.
|
|
41
|
+
* @param a First element
|
|
42
|
+
* @param b Second element
|
|
43
|
+
* @param options Distance configuration for both axes
|
|
44
|
+
* @returns Horizontal and vertical distance constraints
|
|
45
|
+
*/
|
|
46
|
+
static distance(a, b, options = {}) {
|
|
47
|
+
const anchorA = normalizeUIType2D(options.anchorA);
|
|
48
|
+
const anchorB = normalizeUIType2D(options.anchorB);
|
|
49
|
+
const distance = normalizeUIType2D(options.distance);
|
|
50
|
+
const priority = normalizeUIType2D(options.priority);
|
|
51
|
+
const relation = normalizeUIType2D(options.relation);
|
|
52
|
+
const orientation = normalizeUIType2D(options.orientation);
|
|
53
|
+
return {
|
|
54
|
+
h: new UIHorizontalDistanceConstraint(a, b, {
|
|
55
|
+
anchorA: anchorA.h,
|
|
56
|
+
anchorB: anchorB.h,
|
|
57
|
+
distance: distance.h,
|
|
58
|
+
priority: priority.h,
|
|
59
|
+
relation: relation.h,
|
|
60
|
+
orientation: orientation.h,
|
|
61
|
+
}),
|
|
62
|
+
v: new UIVerticalDistanceConstraint(a, b, {
|
|
63
|
+
anchorA: anchorA.v,
|
|
64
|
+
anchorB: anchorB.v,
|
|
65
|
+
distance: distance.v,
|
|
66
|
+
priority: priority.v,
|
|
67
|
+
relation: relation.v,
|
|
68
|
+
orientation: orientation.v,
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates horizontal and vertical proportion constraints.
|
|
74
|
+
* @param a Element with proportional dimensions
|
|
75
|
+
* @param b Target element
|
|
76
|
+
* @param options Proportion configuration for both axes
|
|
77
|
+
* @returns Horizontal and vertical proportion constraints
|
|
78
|
+
*/
|
|
79
|
+
static proportion(a, b, options = {}) {
|
|
80
|
+
const proportion = normalizeUIType2D(options.proportion);
|
|
81
|
+
const priority = normalizeUIType2D(options.priority);
|
|
82
|
+
const relation = normalizeUIType2D(options.relation);
|
|
83
|
+
const orientation = normalizeUIType2D(options.orientation);
|
|
84
|
+
return {
|
|
85
|
+
h: new UIHorizontalProportionConstraint(a, b, {
|
|
86
|
+
proportion: proportion.h,
|
|
87
|
+
priority: priority.h,
|
|
88
|
+
relation: relation.h,
|
|
89
|
+
orientation: orientation.h,
|
|
90
|
+
}),
|
|
91
|
+
v: new UIVerticalProportionConstraint(a, b, {
|
|
92
|
+
proportion: proportion.v,
|
|
93
|
+
priority: priority.v,
|
|
94
|
+
relation: relation.v,
|
|
95
|
+
orientation: orientation.v,
|
|
96
|
+
}),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Creates horizontal and vertical interpolation constraints.
|
|
101
|
+
* @param a First element
|
|
102
|
+
* @param b Second element
|
|
103
|
+
* @param c Element to position between A and B
|
|
104
|
+
* @param options Interpolation configuration for both axes
|
|
105
|
+
* @returns Horizontal and vertical interpolation constraints
|
|
106
|
+
*/
|
|
107
|
+
static interpolation(a, b, c, options = {}) {
|
|
108
|
+
const anchorA = normalizeUIType2D(options.anchorA);
|
|
109
|
+
const anchorB = normalizeUIType2D(options.anchorB);
|
|
110
|
+
const anchorC = normalizeUIType2D(options.anchorC);
|
|
111
|
+
const t = normalizeUIType2D(options.t);
|
|
112
|
+
const priority = normalizeUIType2D(options.priority);
|
|
113
|
+
const relation = normalizeUIType2D(options.relation);
|
|
114
|
+
const orientation = normalizeUIType2D(options.orientation);
|
|
115
|
+
return {
|
|
116
|
+
h: new UIHorizontalInterpolationConstraint(a, b, c, {
|
|
117
|
+
anchorA: anchorA.h,
|
|
118
|
+
anchorB: anchorB.h,
|
|
119
|
+
anchorC: anchorC.h,
|
|
120
|
+
t: t.h,
|
|
121
|
+
priority: priority.h,
|
|
122
|
+
relation: relation.h,
|
|
123
|
+
orientation: orientation.h,
|
|
124
|
+
}),
|
|
125
|
+
v: new UIVerticalInterpolationConstraint(a, b, c, {
|
|
126
|
+
anchorA: anchorA.v,
|
|
127
|
+
anchorB: anchorB.v,
|
|
128
|
+
anchorC: anchorC.v,
|
|
129
|
+
t: t.v,
|
|
130
|
+
priority: priority.v,
|
|
131
|
+
relation: relation.v,
|
|
132
|
+
orientation: orientation.v,
|
|
133
|
+
}),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { UIConstraint2DBuilder };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UIOrientation } from "../../miscellaneous/UIOrientation";
|
|
2
|
+
export declare const COVER_CONSTRAINT_DEFAULT_ANCHOR = 0.5;
|
|
3
|
+
/** Cover constraint builder options */
|
|
4
|
+
export interface UICoverConstraintBuilderOptions {
|
|
5
|
+
/** Whether to maintain active element aspect ratio */
|
|
6
|
+
keepActiveAspect: boolean;
|
|
7
|
+
/** Horizontal anchor (0 = left, 0.5 = center, 1 = right) */
|
|
8
|
+
anchorH: number;
|
|
9
|
+
/** Vertical anchor (0 = bottom, 0.5 = center, 1 = top) */
|
|
10
|
+
anchorV: number;
|
|
11
|
+
/** Orientation for constraints */
|
|
12
|
+
orientation: UIOrientation;
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
|
|
2
|
+
import { UIAspectConstraint } from "../UIAspectConstraint/UIAspectConstraint";
|
|
3
|
+
import { UIHorizontalDistanceConstraint } from "../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint";
|
|
4
|
+
import { UIHorizontalProportionConstraint } from "../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint";
|
|
5
|
+
import { UIVerticalDistanceConstraint } from "../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint";
|
|
6
|
+
import { UIVerticalProportionConstraint } from "../UIVerticalProportionConstraint/UIVerticalProportionConstraint";
|
|
7
|
+
import type { UICoverConstraintBuilderOptions } from "./UICoverConstraintBuilder.Internal";
|
|
8
|
+
/** Builder for cover layout (like CSS object-fit: cover) */
|
|
9
|
+
export declare class UICoverConstraintBuilder {
|
|
10
|
+
/**
|
|
11
|
+
* Creates cover layout constraints.
|
|
12
|
+
* @param passive Container element
|
|
13
|
+
* @param active Content element that covers container
|
|
14
|
+
* @param options Cover configuration
|
|
15
|
+
* @returns Created constraints
|
|
16
|
+
*/
|
|
17
|
+
static build(passive: UIPlaneElement, active: UIPlaneElement & UILayerElement, options?: Partial<UICoverConstraintBuilderOptions>): {
|
|
18
|
+
/** Aspect constraint if keepActiveAspect is true */
|
|
19
|
+
activeAspectConstraint?: UIAspectConstraint;
|
|
20
|
+
/** Horizontal position constraint */
|
|
21
|
+
xConstraint: UIHorizontalDistanceConstraint;
|
|
22
|
+
/** Vertical position constraint */
|
|
23
|
+
yConstraint: UIVerticalDistanceConstraint;
|
|
24
|
+
/** Width constraint (ensures coverage) */
|
|
25
|
+
widthConstraint: UIHorizontalProportionConstraint;
|
|
26
|
+
/** Height constraint (ensures coverage) */
|
|
27
|
+
heightConstraint: UIVerticalProportionConstraint;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIPriority } from '../../miscellaneous/UIPriority.js';
|
|
3
|
+
import { UIRelation } from '../../miscellaneous/UIRelation.js';
|
|
4
|
+
import { UIAspectConstraint } from '../UIAspectConstraint/UIAspectConstraint.js';
|
|
5
|
+
import { UIHorizontalDistanceConstraint } from '../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js';
|
|
6
|
+
import { UIHorizontalProportionConstraint } from '../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js';
|
|
7
|
+
import { UIVerticalDistanceConstraint } from '../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js';
|
|
8
|
+
import { UIVerticalProportionConstraint } from '../UIVerticalProportionConstraint/UIVerticalProportionConstraint.js';
|
|
9
|
+
import { COVER_CONSTRAINT_DEFAULT_ANCHOR } from './UICoverConstraintBuilder.Internal.js';
|
|
10
|
+
|
|
11
|
+
/** Builder for cover layout (like CSS object-fit: cover) */
|
|
12
|
+
class UICoverConstraintBuilder {
|
|
13
|
+
/**
|
|
14
|
+
* Creates cover layout constraints.
|
|
15
|
+
* @param passive Container element
|
|
16
|
+
* @param active Content element that covers container
|
|
17
|
+
* @param options Cover configuration
|
|
18
|
+
* @returns Created constraints
|
|
19
|
+
*/
|
|
20
|
+
static build(passive, active, options = {}) {
|
|
21
|
+
if (options.anchorH !== undefined) {
|
|
22
|
+
assertValidNumber(options.anchorH, "UICoverConstraintBuilder.build.anchorH");
|
|
23
|
+
}
|
|
24
|
+
if (options.anchorV !== undefined) {
|
|
25
|
+
assertValidNumber(options.anchorV, "UICoverConstraintBuilder.build.anchorV");
|
|
26
|
+
}
|
|
27
|
+
let activeAspectConstraint;
|
|
28
|
+
if (options.keepActiveAspect !== false) {
|
|
29
|
+
activeAspectConstraint = new UIAspectConstraint(active, {
|
|
30
|
+
orientation: options.orientation,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const xConstraint = new UIHorizontalDistanceConstraint(passive, active, {
|
|
34
|
+
anchorA: options.anchorH ?? COVER_CONSTRAINT_DEFAULT_ANCHOR,
|
|
35
|
+
anchorB: options.anchorH ?? COVER_CONSTRAINT_DEFAULT_ANCHOR,
|
|
36
|
+
orientation: options.orientation,
|
|
37
|
+
});
|
|
38
|
+
const yConstraint = new UIVerticalDistanceConstraint(passive, active, {
|
|
39
|
+
anchorA: options.anchorV ?? COVER_CONSTRAINT_DEFAULT_ANCHOR,
|
|
40
|
+
anchorB: options.anchorV ?? COVER_CONSTRAINT_DEFAULT_ANCHOR,
|
|
41
|
+
orientation: options.orientation,
|
|
42
|
+
});
|
|
43
|
+
const widthConstraint = new UIHorizontalProportionConstraint(passive, active, {
|
|
44
|
+
proportion: 1,
|
|
45
|
+
relation: UIRelation.GREATER_THAN,
|
|
46
|
+
orientation: options.orientation,
|
|
47
|
+
});
|
|
48
|
+
const heightConstraint = new UIVerticalProportionConstraint(passive, active, {
|
|
49
|
+
proportion: 1,
|
|
50
|
+
priority: UIPriority.P1,
|
|
51
|
+
orientation: options.orientation,
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
activeAspectConstraint,
|
|
55
|
+
xConstraint,
|
|
56
|
+
yConstraint,
|
|
57
|
+
widthConstraint,
|
|
58
|
+
heightConstraint,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { UICoverConstraintBuilder };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UIOrientation } from "../../miscellaneous/UIOrientation";
|
|
2
|
+
export declare const DEFAULT_ANCHOR = 0.5;
|
|
3
|
+
/** Fit constraint builder options */
|
|
4
|
+
export interface UIFitConstraintBuilderOptions {
|
|
5
|
+
/** Whether to maintain active element aspect ratio */
|
|
6
|
+
keepActiveAspect: boolean;
|
|
7
|
+
/** Horizontal anchor (0 = left, 0.5 = center, 1 = right) */
|
|
8
|
+
anchorH: number;
|
|
9
|
+
/** Vertical anchor (0 = bottom, 0.5 = center, 1 = top) */
|
|
10
|
+
anchorV: number;
|
|
11
|
+
/** Orientation for constraints */
|
|
12
|
+
orientation: UIOrientation;
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
|
|
2
|
+
import { UIAspectConstraint } from "../UIAspectConstraint/UIAspectConstraint";
|
|
3
|
+
import { UIHorizontalDistanceConstraint } from "../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint";
|
|
4
|
+
import { UIHorizontalProportionConstraint } from "../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint";
|
|
5
|
+
import { UIVerticalDistanceConstraint } from "../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint";
|
|
6
|
+
import { UIVerticalProportionConstraint } from "../UIVerticalProportionConstraint/UIVerticalProportionConstraint";
|
|
7
|
+
import type { UIFitConstraintBuilderOptions } from "./UIFitConstraintBuilder.Internal";
|
|
8
|
+
/** Builder for fit layout (like CSS object-fit: contain) */
|
|
9
|
+
export declare class UIFitConstraintBuilder {
|
|
10
|
+
/**
|
|
11
|
+
* Creates fit layout constraints.
|
|
12
|
+
* @param passive Container element
|
|
13
|
+
* @param active Content element that fits within container
|
|
14
|
+
* @param options Fit configuration
|
|
15
|
+
* @returns Created constraints
|
|
16
|
+
*/
|
|
17
|
+
static build(passive: UIPlaneElement, active: UIPlaneElement & UILayerElement, options?: Partial<UIFitConstraintBuilderOptions>): {
|
|
18
|
+
/** Aspect constraint if keepActiveAspect is true */
|
|
19
|
+
activeAspectConstraint?: UIAspectConstraint;
|
|
20
|
+
/** Horizontal position constraint */
|
|
21
|
+
xConstraint: UIHorizontalDistanceConstraint;
|
|
22
|
+
/** Vertical position constraint */
|
|
23
|
+
yConstraint: UIVerticalDistanceConstraint;
|
|
24
|
+
/** Width constraint (ensures fitting) */
|
|
25
|
+
widthConstraint: UIHorizontalProportionConstraint;
|
|
26
|
+
/** Height constraint (ensures fitting) */
|
|
27
|
+
heightConstraint: UIVerticalProportionConstraint;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIPriority } from '../../miscellaneous/UIPriority.js';
|
|
3
|
+
import { UIRelation } from '../../miscellaneous/UIRelation.js';
|
|
4
|
+
import { UIAspectConstraint } from '../UIAspectConstraint/UIAspectConstraint.js';
|
|
5
|
+
import { UIHorizontalDistanceConstraint } from '../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js';
|
|
6
|
+
import { UIHorizontalProportionConstraint } from '../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js';
|
|
7
|
+
import { UIVerticalDistanceConstraint } from '../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js';
|
|
8
|
+
import { UIVerticalProportionConstraint } from '../UIVerticalProportionConstraint/UIVerticalProportionConstraint.js';
|
|
9
|
+
import { DEFAULT_ANCHOR } from './UIFitConstraintBuilder.Internal.js';
|
|
10
|
+
|
|
11
|
+
/** Builder for fit layout (like CSS object-fit: contain) */
|
|
12
|
+
class UIFitConstraintBuilder {
|
|
13
|
+
/**
|
|
14
|
+
* Creates fit layout constraints.
|
|
15
|
+
* @param passive Container element
|
|
16
|
+
* @param active Content element that fits within container
|
|
17
|
+
* @param options Fit configuration
|
|
18
|
+
* @returns Created constraints
|
|
19
|
+
*/
|
|
20
|
+
static build(passive, active, options = {}) {
|
|
21
|
+
if (options.anchorH !== undefined) {
|
|
22
|
+
assertValidNumber(options.anchorH, "UIFitConstraintBuilder.build.anchorH");
|
|
23
|
+
}
|
|
24
|
+
if (options.anchorV !== undefined) {
|
|
25
|
+
assertValidNumber(options.anchorV, "UIFitConstraintBuilder.build.anchorV");
|
|
26
|
+
}
|
|
27
|
+
let activeAspectConstraint;
|
|
28
|
+
if (options.keepActiveAspect === true) {
|
|
29
|
+
activeAspectConstraint = new UIAspectConstraint(active, {
|
|
30
|
+
orientation: options.orientation,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const xConstraint = new UIHorizontalDistanceConstraint(passive, active, {
|
|
34
|
+
anchorA: options.anchorH ?? DEFAULT_ANCHOR,
|
|
35
|
+
anchorB: options.anchorH ?? DEFAULT_ANCHOR,
|
|
36
|
+
orientation: options.orientation,
|
|
37
|
+
});
|
|
38
|
+
const yConstraint = new UIVerticalDistanceConstraint(passive, active, {
|
|
39
|
+
anchorA: options.anchorV ?? DEFAULT_ANCHOR,
|
|
40
|
+
anchorB: options.anchorV ?? DEFAULT_ANCHOR,
|
|
41
|
+
orientation: options.orientation,
|
|
42
|
+
});
|
|
43
|
+
const widthConstraint = new UIHorizontalProportionConstraint(passive, active, {
|
|
44
|
+
proportion: 1,
|
|
45
|
+
relation: UIRelation.LESS_THAN,
|
|
46
|
+
orientation: options.orientation,
|
|
47
|
+
});
|
|
48
|
+
const heightConstraint = new UIVerticalProportionConstraint(passive, active, {
|
|
49
|
+
proportion: 1,
|
|
50
|
+
priority: UIPriority.P1,
|
|
51
|
+
orientation: options.orientation,
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
activeAspectConstraint,
|
|
55
|
+
xConstraint,
|
|
56
|
+
yConstraint,
|
|
57
|
+
widthConstraint,
|
|
58
|
+
heightConstraint,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { UIFitConstraintBuilder };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Configuration options for UIAnchor */
|
|
2
|
+
export interface UIAnchorOptions {
|
|
3
|
+
/** X coordinate in world units */
|
|
4
|
+
x: number;
|
|
5
|
+
/** Y coordinate in world units */
|
|
6
|
+
y: number;
|
|
7
|
+
/** Identifier for debugging */
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const ANCHOR_DEFAULT_X = 0;
|
|
11
|
+
export declare const ANCHOR_DEFAULT_Y = 0;
|
|
12
|
+
export declare const ANCHOR_DEFAULT_NAME = "";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { UILayer } from "../../layers/UILayer/UILayer";
|
|
2
|
+
import type { UILayerElement, UIPointElement } from "../../miscellaneous/shared";
|
|
3
|
+
import type { UISolverWrapperView } from "../../wrappers/UISolverWrapper/UISolverWrapper.Internal";
|
|
4
|
+
import type { UIAnchorOptions } from "./UIAnchor.Internal";
|
|
5
|
+
/** Point in 2D space with constraint-based positioning */
|
|
6
|
+
export declare class UIAnchor implements UILayerElement, UIPointElement {
|
|
7
|
+
readonly layer: UILayer;
|
|
8
|
+
/** Identifier for debugging */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Solver variable for x coordinate */
|
|
11
|
+
readonly xVariable: number;
|
|
12
|
+
/** Solver variable for y coordinate */
|
|
13
|
+
readonly yVariable: number;
|
|
14
|
+
protected readonly solverWrapper: UISolverWrapperView;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new UIAnchor instance.
|
|
17
|
+
*
|
|
18
|
+
* @param layer - Layer containing this anchor
|
|
19
|
+
* @param options - Configuration options
|
|
20
|
+
*/
|
|
21
|
+
constructor(layer: UILayer, options?: Partial<UIAnchorOptions>);
|
|
22
|
+
/** X coordinate relative to layer origin (bottom-left) */
|
|
23
|
+
get x(): number;
|
|
24
|
+
/** Y coordinate relative to layer origin (bottom-left) */
|
|
25
|
+
get y(): number;
|
|
26
|
+
/** X coordinate relative to layer origin (bottom-left) */
|
|
27
|
+
set x(value: number);
|
|
28
|
+
/** Y coordinate relative to layer origin (bottom-left) */
|
|
29
|
+
set y(value: number);
|
|
30
|
+
/** Removes anchor and frees resources */
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIPriority } from '../../miscellaneous/UIPriority.js';
|
|
3
|
+
import { ANCHOR_DEFAULT_X, ANCHOR_DEFAULT_Y, ANCHOR_DEFAULT_NAME } from './UIAnchor.Internal.js';
|
|
4
|
+
|
|
5
|
+
/** Point in 2D space with constraint-based positioning */
|
|
6
|
+
class UIAnchor {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new UIAnchor instance.
|
|
9
|
+
*
|
|
10
|
+
* @param layer - Layer containing this anchor
|
|
11
|
+
* @param options - Configuration options
|
|
12
|
+
*/
|
|
13
|
+
constructor(layer, options) {
|
|
14
|
+
this.layer = layer;
|
|
15
|
+
const x = options?.x ?? ANCHOR_DEFAULT_X;
|
|
16
|
+
const y = options?.y ?? ANCHOR_DEFAULT_Y;
|
|
17
|
+
assertValidNumber(x, "UIAnchor.constructor.options.x");
|
|
18
|
+
assertValidNumber(y, "UIAnchor.constructor.options.y");
|
|
19
|
+
this.solverWrapper = this.layer.solverWrapper;
|
|
20
|
+
this.xVariable = this.solverWrapper.createVariable(x, UIPriority.P7);
|
|
21
|
+
this.yVariable = this.solverWrapper.createVariable(y, UIPriority.P7);
|
|
22
|
+
this.name = options?.name ?? ANCHOR_DEFAULT_NAME;
|
|
23
|
+
}
|
|
24
|
+
/** X coordinate relative to layer origin (bottom-left) */
|
|
25
|
+
get x() {
|
|
26
|
+
return this.solverWrapper.readVariableValue(this.xVariable);
|
|
27
|
+
}
|
|
28
|
+
/** Y coordinate relative to layer origin (bottom-left) */
|
|
29
|
+
get y() {
|
|
30
|
+
return this.solverWrapper.readVariableValue(this.yVariable);
|
|
31
|
+
}
|
|
32
|
+
/** X coordinate relative to layer origin (bottom-left) */
|
|
33
|
+
set x(value) {
|
|
34
|
+
assertValidNumber(value, "UIAnchor.x");
|
|
35
|
+
this.solverWrapper.suggestVariableValue(this.xVariable, value);
|
|
36
|
+
}
|
|
37
|
+
/** Y coordinate relative to layer origin (bottom-left) */
|
|
38
|
+
set y(value) {
|
|
39
|
+
assertValidNumber(value, "UIAnchor.y");
|
|
40
|
+
this.solverWrapper.suggestVariableValue(this.yVariable, value);
|
|
41
|
+
}
|
|
42
|
+
/** Removes anchor and frees resources */
|
|
43
|
+
destroy() {
|
|
44
|
+
this.solverWrapper.removeVariable(this.yVariable);
|
|
45
|
+
this.solverWrapper.removeVariable(this.xVariable);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { UIAnchor };
|