laymur 0.23.0 → 0.25.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 +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +3 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +14 -16
- package/dist/core/constraints/UIConstraint.d.ts +22 -2
- package/dist/core/constraints/UIConstraint.js +26 -3
- package/dist/core/constraints/UICustomConstraint.d.ts +4 -4
- package/dist/core/constraints/UICustomConstraint.js +15 -15
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +11 -13
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +13 -15
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +3 -3
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js +1 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +13 -7
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +37 -30
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +13 -15
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +3 -3
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +11 -13
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +3 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +11 -11
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +10 -13
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +10 -13
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +10 -13
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +3 -5
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +23 -5
- package/dist/core/elements/UIAnchor/UIAnchor.js +42 -8
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +4 -6
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +10 -10
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +108 -111
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +4 -4
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +5 -8
- package/dist/core/elements/UIDummy/UIDummy.d.ts +19 -11
- package/dist/core/elements/UIDummy/UIDummy.js +59 -42
- package/dist/core/elements/UIElement/UIElement.Internal.d.ts +5 -5
- package/dist/core/elements/UIElement/UIElement.Internal.js +9 -12
- package/dist/core/elements/UIElement/UIElement.d.ts +11 -11
- package/dist/core/elements/UIElement/UIElement.js +57 -60
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +3 -3
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +4 -7
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +7 -7
- package/dist/core/elements/UIGraphics/UIGraphics.js +44 -47
- package/dist/core/elements/UIImage/UIImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIImage/UIImage.Internal.js +1 -0
- package/dist/core/elements/UIImage/UIImage.d.ts +9 -9
- package/dist/core/elements/UIImage/UIImage.js +21 -24
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +3 -3
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +3 -5
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +12 -12
- package/dist/core/elements/UINineSlice/UINineSlice.js +71 -73
- package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +3 -4
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +1 -3
- package/dist/core/elements/UIProgress/UIProgress.d.ts +10 -10
- package/dist/core/elements/UIProgress/UIProgress.js +59 -62
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +3 -3
- package/dist/core/elements/UIScene/UIScene.Internal.js +11 -14
- package/dist/core/elements/UIScene/UIScene.d.ts +8 -8
- package/dist/core/elements/UIScene/UIScene.js +68 -69
- package/dist/core/elements/UIText/UIText.Bidi.d.ts +2 -2
- package/dist/core/elements/UIText/UIText.Bidi.js +3 -5
- package/dist/core/elements/UIText/UIText.Interfaces.d.ts +6 -2
- package/dist/core/elements/UIText/UIText.Interfaces.js +1 -0
- package/dist/core/elements/UIText/UIText.Internal.d.ts +4 -4
- package/dist/core/elements/UIText/UIText.Internal.js +5 -7
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +14 -7
- package/dist/core/elements/UIText/UIText.Measuring.js +115 -55
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +3 -3
- package/dist/core/elements/UIText/UIText.Rendering.js +6 -9
- package/dist/core/elements/UIText/UIText.d.ts +28 -14
- package/dist/core/elements/UIText/UIText.js +181 -141
- package/dist/core/index.d.ts +55 -54
- package/dist/core/index.js +53 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +2 -5
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +43 -42
- package/dist/core/layers/UILayer/UILayer.Internal.d.ts +2 -2
- package/dist/core/layers/UILayer/UILayer.Internal.js +4 -7
- package/dist/core/layers/UILayer/UILayer.d.ts +19 -4
- package/dist/core/layers/UILayer/UILayer.js +125 -62
- package/dist/core/miscellaneous/UIBlendMode.js +1 -3
- package/dist/core/miscellaneous/UIExpression.js +16 -19
- package/dist/core/miscellaneous/UIMode.js +3 -5
- package/dist/core/miscellaneous/UIOrientation.js +2 -4
- package/dist/core/miscellaneous/UIPriority.js +5 -8
- package/dist/core/miscellaneous/UIRelation.js +5 -8
- package/dist/core/miscellaneous/UITransparencyMode.js +1 -3
- package/dist/core/miscellaneous/area/UIArea.js +1 -3
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaCircle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +2 -2
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +3 -6
- package/dist/core/miscellaneous/asserts.d.ts +30 -1
- package/dist/core/miscellaneous/asserts.js +87 -19
- package/dist/core/miscellaneous/canvas.js +13 -7
- package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.Internal.js +1 -3
- package/dist/core/miscellaneous/color/UIColor.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.js +202 -205
- package/dist/core/miscellaneous/computeTransform.d.ts +1 -1
- package/dist/core/miscellaneous/computeTransform.js +4 -7
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +10 -5
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +63 -58
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.d.ts +52 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.js +110 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +181 -261
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +3 -3
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.js +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +209 -115
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +12 -12
- package/dist/core/miscellaneous/generic-plane/shared.js +28 -23
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +1 -3
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +1 -1
- package/dist/core/miscellaneous/insets/UIInsets.js +96 -99
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +1 -3
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +1 -1
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +14 -17
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -2
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +13 -16
- package/dist/core/miscellaneous/math.js +3 -5
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +6 -8
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +1 -1
- package/dist/core/miscellaneous/micro/UIMicro.js +91 -94
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +1 -3
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +3 -6
- package/dist/core/miscellaneous/shared.d.ts +1 -1
- package/dist/core/miscellaneous/shared.js +4 -7
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.js +1 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +2 -2
- package/dist/core/miscellaneous/text-span/UITextSpan.js +10 -13
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +15 -17
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +13 -2
- package/dist/core/miscellaneous/text-style/UITextStyle.js +222 -207
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +7 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +16 -6
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +1 -1
- package/dist/core/miscellaneous/texture/UITextureView.js +113 -117
- package/dist/core/miscellaneous/webglCapabilities.js +3 -4
- package/dist/core/shaders/UIImage.d.ts +9 -0
- package/dist/core/shaders/UIImage.js +14 -0
- package/dist/core/shaders/UINineSlice.d.ts +11 -0
- package/dist/core/shaders/UINineSlice.js +57 -0
- package/dist/core/shaders/UIProgress.d.ts +14 -0
- package/dist/core/shaders/UIProgress.js +21 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.js +16 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.js +15 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +4 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +7 -1
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +50 -47
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +5 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +11 -3
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +42 -26
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +5 -3
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +20 -4
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +138 -117
- package/dist/debug/UIAspectDebug.d.ts +3 -3
- package/dist/debug/UIAspectDebug.js +64 -68
- package/dist/debug/UIConstraintDebug.d.ts +1 -1
- package/dist/debug/UIConstraintDebug.js +1 -0
- package/dist/debug/UIHeightDebug.d.ts +3 -3
- package/dist/debug/UIHeightDebug.js +63 -67
- package/dist/debug/UIHorizontalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalDistanceDebug.js +76 -81
- package/dist/debug/UIHorizontalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalInterpolationDebug.js +74 -78
- package/dist/debug/UILayerDebug.d.ts +1 -1
- package/dist/debug/UILayerDebug.js +55 -64
- package/dist/debug/UIVerticalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIVerticalDistanceDebug.js +76 -81
- package/dist/debug/UIVerticalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIVerticalInterpolationDebug.js +74 -78
- package/dist/debug/UIWidthDebug.d.ts +3 -3
- package/dist/debug/UIWidthDebug.js +63 -67
- package/dist/debug/index.d.ts +8 -8
- package/dist/debug/index.js +8 -8
- package/dist/debug/miscellaneous.js +8 -11
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorModule.js +1 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +37 -40
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +41 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +87 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +17 -20
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +21 -24
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +21 -24
- package/dist/particles/elements/UIEmitter.Internal.d.ts +2 -2
- package/dist/particles/elements/UIEmitter.Internal.js +6 -9
- package/dist/particles/elements/UIEmitter.d.ts +17 -11
- package/dist/particles/elements/UIEmitter.js +100 -88
- package/dist/particles/index.d.ts +20 -18
- package/dist/particles/index.js +19 -18
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +14 -15
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +4 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.js +40 -32
- package/dist/particles/miscellaneous/miscellaneous.d.ts +3 -3
- package/dist/particles/miscellaneous/miscellaneous.js +26 -27
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +5 -8
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +6 -9
- package/dist/particles/renderingModules/UIRenderingModule.js +1 -3
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingTexture.js +4 -7
- package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.js +7 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +9 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.js +16 -0
- package/dist/particles/shaders/UIRenderingTexture.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingTexture.js +7 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnModule.js +1 -3
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +3 -3
- package/dist/particles/spawnModules/UISpawnOffset.js +12 -15
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomScale.js +19 -22
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +21 -24
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +3 -3
- package/dist/particles/spawnModules/UISpawnRectangle.js +21 -24
- package/package.json +13 -17
- package/dist/_virtual/2d.js +0 -3
- package/dist/_virtual/3d.js +0 -3
- package/dist/_virtual/4d.js +0 -3
- package/dist/_virtual/mod.js +0 -5
- package/dist/_virtual/mod2.js +0 -3
- package/dist/core/shaders/UIImage.glsl.js +0 -3
- package/dist/core/shaders/UINineSlice.glsl.js +0 -3
- package/dist/core/shaders/UIProgress.glsl.js +0 -3
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +0 -3
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +0 -3
- package/dist/index.js +0 -52
- package/dist/node_modules/fast-simplex-noise/lib/2d.js +0 -93
- package/dist/node_modules/fast-simplex-noise/lib/3d.js +0 -142
- package/dist/node_modules/fast-simplex-noise/lib/4d.js +0 -196
- package/dist/node_modules/fast-simplex-noise/lib/mod.js +0 -24
- package/dist/node_modules/three/examples/jsm/lines/Line2.js +0 -56
- package/dist/node_modules/three/examples/jsm/lines/LineGeometry.js +0 -157
- package/dist/node_modules/three/examples/jsm/lines/LineMaterial.js +0 -691
- package/dist/node_modules/three/examples/jsm/lines/LineSegments2.js +0 -415
- package/dist/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js +0 -289
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +0 -3
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +0 -3
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +0 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
|
|
1
|
+
import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal.js";
|
|
2
2
|
/** Aspect constraint options */
|
|
3
3
|
export interface UIAspectConstraintOptions extends UISingleParameterConstraintOptions {
|
|
4
4
|
/** Target aspect ratio (width/height) */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
|
|
2
|
-
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
|
|
3
|
-
import type { UIAspectConstraintOptions } from "./UIAspectConstraint.Internal";
|
|
1
|
+
import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared.js";
|
|
2
|
+
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
3
|
+
import type { UIAspectConstraintOptions } from "./UIAspectConstraint.Internal.js";
|
|
4
4
|
/** Maintains element aspect ratio (width = height * aspect) */
|
|
5
5
|
export declare class UIAspectConstraint extends UISingleParameterConstraint {
|
|
6
6
|
readonly element: UIPlaneElement & UILayerElement;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { assertValidPositiveNumber } from
|
|
2
|
-
import { UIExpression } from
|
|
3
|
-
import { UISingleParameterConstraint } from
|
|
4
|
-
|
|
1
|
+
import { assertValidConstraintElement, assertValidPositiveNumber, } from "../../miscellaneous/asserts.js";
|
|
2
|
+
import { UIExpression } from "../../miscellaneous/UIExpression.js";
|
|
3
|
+
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
5
4
|
/** Maintains element aspect ratio (width = height * aspect) */
|
|
6
|
-
class UIAspectConstraint extends UISingleParameterConstraint {
|
|
5
|
+
export class UIAspectConstraint extends UISingleParameterConstraint {
|
|
7
6
|
/**
|
|
8
7
|
* @param element Element to constrain
|
|
9
8
|
* @param options Aspect configuration. Defaults to element's current ratio.
|
|
@@ -12,30 +11,29 @@ class UIAspectConstraint extends UISingleParameterConstraint {
|
|
|
12
11
|
if (options.aspect !== undefined) {
|
|
13
12
|
assertValidPositiveNumber(options.aspect, "UIAspectConstraint.constructor.options.aspect");
|
|
14
13
|
}
|
|
15
|
-
super(element.
|
|
14
|
+
super(assertValidConstraintElement(element, "UIAspectConstraint.constructor"), options);
|
|
16
15
|
this.element = element;
|
|
17
|
-
this.
|
|
18
|
-
this.constraint = this.solverWrapper.createConstraint(this.
|
|
16
|
+
this.aspectInternal = options.aspect ?? element.width / element.height;
|
|
17
|
+
this.constraint = this.solverWrapper.createConstraint(this.buildLHS(), new UIExpression(0), this.relation, this.priority, this.isConstraintEnabled());
|
|
19
18
|
}
|
|
20
19
|
/** Current aspect ratio (width/height) */
|
|
21
20
|
get aspect() {
|
|
22
|
-
return this.
|
|
21
|
+
return this.aspectInternal;
|
|
23
22
|
}
|
|
24
23
|
/** Updates aspect ratio */
|
|
25
24
|
set aspect(value) {
|
|
25
|
+
this.assertNotDestroyed("UIAspectConstraint.aspect");
|
|
26
26
|
assertValidPositiveNumber(value, "UIAspectConstraint.aspect");
|
|
27
|
-
if (this.
|
|
28
|
-
this.
|
|
29
|
-
this.solverWrapper.setConstraintLHS(this.constraint, this.
|
|
27
|
+
if (this.aspectInternal !== value) {
|
|
28
|
+
this.aspectInternal = value;
|
|
29
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this.buildLHS());
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
/** Builds constraint expression: width - (height * aspect) = 0 */
|
|
33
|
-
|
|
33
|
+
buildLHS() {
|
|
34
34
|
return new UIExpression(0, [
|
|
35
35
|
[this.element.wVariable, 1],
|
|
36
|
-
[this.element.hVariable, -this.
|
|
36
|
+
[this.element.hVariable, -this.aspectInternal],
|
|
37
37
|
]);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
export { UIAspectConstraint };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { UILayer } from "../layers/UILayer/UILayer";
|
|
2
|
-
import type { UISolverWrapperView } from "../wrappers/UISolverWrapper/UISolverWrapper.Internal";
|
|
1
|
+
import type { UILayer } from "../layers/UILayer/UILayer.js";
|
|
2
|
+
import type { UISolverWrapperView } from "../wrappers/UISolverWrapper/UISolverWrapper.Internal.js";
|
|
3
3
|
/** Base class for layout constraints */
|
|
4
4
|
export declare abstract class UIConstraint {
|
|
5
5
|
readonly layer: UILayer;
|
|
@@ -7,7 +7,27 @@ export declare abstract class UIConstraint {
|
|
|
7
7
|
name: string;
|
|
8
8
|
/** Constraint solver wrapper */
|
|
9
9
|
protected readonly solverWrapper: UISolverWrapperView;
|
|
10
|
+
private destroyedInternal;
|
|
10
11
|
/** @param layer Layer containing this constraint */
|
|
11
12
|
constructor(layer: UILayer, name?: string);
|
|
13
|
+
/**
|
|
14
|
+
* Whether the constraint is removed from its layer. A constraint is removed by its own
|
|
15
|
+
* `destroy`, or together with an element it refers to or with its layer.
|
|
16
|
+
*/
|
|
17
|
+
get destroyed(): boolean;
|
|
18
|
+
/** Removes constraint from its layer. Does nothing if the constraint is already destroyed. */
|
|
12
19
|
destroy(): void;
|
|
20
|
+
/** Frees what the subclass holds; called once, before the constraint leaves its layer */
|
|
21
|
+
protected destroyInternal(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Throws if the constraint is destroyed.
|
|
24
|
+
* @param subject Name of the changed property for the error message
|
|
25
|
+
*/
|
|
26
|
+
protected assertNotDestroyed(subject: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Checks whether the constraint refers to a solver variable.
|
|
29
|
+
* @param index Solver variable index
|
|
30
|
+
* @returns True if the variable is used by the constraint
|
|
31
|
+
*/
|
|
32
|
+
abstract isUsingVariable(index: number): boolean;
|
|
13
33
|
}
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
/** Base class for layout constraints */
|
|
2
|
-
class UIConstraint {
|
|
2
|
+
export class UIConstraint {
|
|
3
3
|
/** @param layer Layer containing this constraint */
|
|
4
4
|
constructor(layer, name) {
|
|
5
5
|
this.layer = layer;
|
|
6
|
+
this.destroyedInternal = false;
|
|
6
7
|
this.solverWrapper = this.layer.solverWrapper;
|
|
7
8
|
this.name = name ?? "";
|
|
8
9
|
this.layer.addConstraint(this);
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Whether the constraint is removed from its layer. A constraint is removed by its own
|
|
13
|
+
* `destroy`, or together with an element it refers to or with its layer.
|
|
14
|
+
*/
|
|
15
|
+
get destroyed() {
|
|
16
|
+
return this.destroyedInternal;
|
|
17
|
+
}
|
|
18
|
+
/** Removes constraint from its layer. Does nothing if the constraint is already destroyed. */
|
|
10
19
|
destroy() {
|
|
20
|
+
if (this.destroyedInternal) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.destroyedInternal = true;
|
|
24
|
+
this.destroyInternal();
|
|
11
25
|
this.layer.removeConstraint(this);
|
|
12
26
|
}
|
|
27
|
+
/** Frees what the subclass holds; called once, before the constraint leaves its layer */
|
|
28
|
+
destroyInternal() { }
|
|
29
|
+
/**
|
|
30
|
+
* Throws if the constraint is destroyed.
|
|
31
|
+
* @param subject Name of the changed property for the error message
|
|
32
|
+
*/
|
|
33
|
+
assertNotDestroyed(subject) {
|
|
34
|
+
if (this.destroyedInternal) {
|
|
35
|
+
throw new Error(`${subject}: constraint is destroyed`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
13
38
|
}
|
|
14
|
-
|
|
15
|
-
export { UIConstraint };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { UILayer } from "../layers/UILayer/UILayer";
|
|
2
|
-
import type { UIExpression } from "../miscellaneous/UIExpression";
|
|
3
|
-
import { UISingleParameterConstraint } from "./UISingleParameterConstraint/UISingleParameterConstraint";
|
|
4
|
-
import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint/UISingleParameterConstraint.Internal";
|
|
1
|
+
import type { UILayer } from "../layers/UILayer/UILayer.js";
|
|
2
|
+
import type { UIExpression } from "../miscellaneous/UIExpression.js";
|
|
3
|
+
import { UISingleParameterConstraint } from "./UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
4
|
+
import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint/UISingleParameterConstraint.Internal.js";
|
|
5
5
|
/** Constraint with custom LHS and RHS expressions */
|
|
6
6
|
export declare class UICustomConstraint extends UISingleParameterConstraint {
|
|
7
7
|
/** Solver constraint descriptor */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { assertValidConstraintExpressions } from "../miscellaneous/asserts.js";
|
|
2
|
+
import { UISingleParameterConstraint } from "./UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
3
3
|
/** Constraint with custom LHS and RHS expressions */
|
|
4
|
-
class UICustomConstraint extends UISingleParameterConstraint {
|
|
4
|
+
export class UICustomConstraint extends UISingleParameterConstraint {
|
|
5
5
|
/**
|
|
6
6
|
* @param layer Layer containing this constraint
|
|
7
7
|
* @param lhs Left-hand side expression
|
|
@@ -9,29 +9,29 @@ class UICustomConstraint extends UISingleParameterConstraint {
|
|
|
9
9
|
* @param options Constraint configuration
|
|
10
10
|
*/
|
|
11
11
|
constructor(layer, lhs, rhs, options = {}) {
|
|
12
|
-
super(layer, options);
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.constraint = this.solverWrapper.createConstraint(this.
|
|
12
|
+
super(assertValidConstraintExpressions(layer, [lhs, rhs], "UICustomConstraint.constructor"), options);
|
|
13
|
+
this.lhsInternal = lhs;
|
|
14
|
+
this.rhsInternal = rhs;
|
|
15
|
+
this.constraint = this.solverWrapper.createConstraint(this.lhsInternal, this.rhsInternal, this.relation, this.priority, this.isConstraintEnabled());
|
|
16
16
|
}
|
|
17
17
|
/** Left-hand side expression */
|
|
18
18
|
get lhs() {
|
|
19
|
-
return this.
|
|
19
|
+
return this.lhsInternal;
|
|
20
20
|
}
|
|
21
21
|
/** Right-hand side expression */
|
|
22
22
|
get rhs() {
|
|
23
|
-
return this.
|
|
23
|
+
return this.rhsInternal;
|
|
24
24
|
}
|
|
25
25
|
/** Updates left-hand side expression */
|
|
26
26
|
setLHS(value) {
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
27
|
+
this.assertNotDestroyed("UICustomConstraint.setLHS");
|
|
28
|
+
this.lhsInternal = value;
|
|
29
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this.lhsInternal);
|
|
29
30
|
}
|
|
30
31
|
/** Updates right-hand side expression */
|
|
31
32
|
setRHS(value) {
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
33
|
+
this.assertNotDestroyed("UICustomConstraint.setRHS");
|
|
34
|
+
this.rhsInternal = value;
|
|
35
|
+
this.solverWrapper.setConstraintRHS(this.constraint, this.rhsInternal);
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
export { UICustomConstraint };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
|
|
1
|
+
import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal.js";
|
|
2
2
|
/** Height constraint options */
|
|
3
3
|
export interface UIHeightConstraintOptions extends UISingleParameterConstraintOptions {
|
|
4
4
|
/** Target height in world units */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
|
|
2
|
-
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
|
|
3
|
-
import type { UIHeightConstraintOptions } from "./UIHeightConstraint.Internal";
|
|
1
|
+
import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared.js";
|
|
2
|
+
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
3
|
+
import type { UIHeightConstraintOptions } from "./UIHeightConstraint.Internal.js";
|
|
4
4
|
/** Fixes element height to constant value */
|
|
5
5
|
export declare class UIHeightConstraint extends UISingleParameterConstraint {
|
|
6
6
|
readonly element: UIPlaneElement & UILayerElement;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { assertValidPositiveNumber } from
|
|
2
|
-
import { UIExpression } from
|
|
3
|
-
import { UISingleParameterConstraint } from
|
|
4
|
-
|
|
1
|
+
import { assertValidConstraintElement, assertValidPositiveNumber, } from "../../miscellaneous/asserts.js";
|
|
2
|
+
import { UIExpression } from "../../miscellaneous/UIExpression.js";
|
|
3
|
+
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
5
4
|
/** Fixes element height to constant value */
|
|
6
|
-
class UIHeightConstraint extends UISingleParameterConstraint {
|
|
5
|
+
export class UIHeightConstraint extends UISingleParameterConstraint {
|
|
7
6
|
/**
|
|
8
7
|
* @param element Element to constrain
|
|
9
8
|
* @param options Height configuration. Defaults to element's current height.
|
|
@@ -12,23 +11,22 @@ class UIHeightConstraint extends UISingleParameterConstraint {
|
|
|
12
11
|
if (options.height !== undefined) {
|
|
13
12
|
assertValidPositiveNumber(options.height, "UIHeightConstraint.constructor.options.height");
|
|
14
13
|
}
|
|
15
|
-
super(element.
|
|
14
|
+
super(assertValidConstraintElement(element, "UIHeightConstraint.constructor"), options);
|
|
16
15
|
this.element = element;
|
|
17
|
-
this.
|
|
18
|
-
this.constraint = this.solverWrapper.createConstraint(new UIExpression(0, [[this.element.hVariable, 1]]), new UIExpression(this.
|
|
16
|
+
this.heightInternal = options.height ?? element.height;
|
|
17
|
+
this.constraint = this.solverWrapper.createConstraint(new UIExpression(0, [[this.element.hVariable, 1]]), new UIExpression(this.heightInternal), this.relation, this.priority, this.isConstraintEnabled());
|
|
19
18
|
}
|
|
20
19
|
/** Current height in world units */
|
|
21
20
|
get height() {
|
|
22
|
-
return this.
|
|
21
|
+
return this.heightInternal;
|
|
23
22
|
}
|
|
24
23
|
/** Updates height */
|
|
25
24
|
set height(value) {
|
|
25
|
+
this.assertNotDestroyed("UIHeightConstraint.height");
|
|
26
26
|
assertValidPositiveNumber(value, "UIHeightConstraint.height");
|
|
27
|
-
if (this.
|
|
28
|
-
this.
|
|
27
|
+
if (this.heightInternal !== value) {
|
|
28
|
+
this.heightInternal = value;
|
|
29
29
|
this.solverWrapper.setConstraintRHS(this.constraint, new UIExpression(value));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
export { UIHeightConstraint };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
|
|
1
|
+
import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal.js";
|
|
2
2
|
export declare const DEFAULT_ANCHOR = 0.5;
|
|
3
3
|
/** Horizontal distance constraint options */
|
|
4
4
|
export interface UIHorizontalDistanceConstraintOptions extends UISingleParameterConstraintOptions {
|
package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
|
|
2
|
-
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
|
|
3
|
-
import type { UIHorizontalDistanceConstraintOptions } from "./UIHorizontalDistanceConstraint.Internal";
|
|
1
|
+
import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared.js";
|
|
2
|
+
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
3
|
+
import type { UIHorizontalDistanceConstraintOptions } from "./UIHorizontalDistanceConstraint.Internal.js";
|
|
4
4
|
/** Maintains horizontal distance between elements with configurable anchors */
|
|
5
5
|
export declare class UIHorizontalDistanceConstraint extends UISingleParameterConstraint {
|
|
6
6
|
readonly a: UIPointElement | UIPlaneElement;
|
package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isUIPlaneElement, isUIPointElement } from
|
|
3
|
-
import { UIExpression } from
|
|
4
|
-
import { UISingleParameterConstraint } from
|
|
5
|
-
import { DEFAULT_ANCHOR } from
|
|
6
|
-
|
|
1
|
+
import { assertValidConstraintArguments, assertValidNumber } from "../../miscellaneous/asserts.js";
|
|
2
|
+
import { isUIPlaneElement, isUIPointElement } from "../../miscellaneous/shared.js";
|
|
3
|
+
import { UIExpression } from "../../miscellaneous/UIExpression.js";
|
|
4
|
+
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
5
|
+
import { DEFAULT_ANCHOR } from "./UIHorizontalDistanceConstraint.Internal.js";
|
|
7
6
|
/** Maintains horizontal distance between elements with configurable anchors */
|
|
8
|
-
class UIHorizontalDistanceConstraint extends UISingleParameterConstraint {
|
|
7
|
+
export class UIHorizontalDistanceConstraint extends UISingleParameterConstraint {
|
|
9
8
|
/**
|
|
10
9
|
* @param a First element
|
|
11
10
|
* @param b Second element
|
|
@@ -24,77 +23,78 @@ class UIHorizontalDistanceConstraint extends UISingleParameterConstraint {
|
|
|
24
23
|
super(assertValidConstraintArguments(a, b, "UIHorizontalDistanceConstraint.constructor"), options);
|
|
25
24
|
this.a = a;
|
|
26
25
|
this.b = b;
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.constraint = this.solverWrapper.createConstraint(this.
|
|
26
|
+
this.anchorAInternal = options.anchorA ?? DEFAULT_ANCHOR;
|
|
27
|
+
this.anchorBInternal = options.anchorB ?? DEFAULT_ANCHOR;
|
|
28
|
+
this.distanceInternal = options.distance ?? 0;
|
|
29
|
+
this.constraint = this.solverWrapper.createConstraint(this.buildLHS(), new UIExpression(this.distanceInternal), this.relation, this.priority, this.isConstraintEnabled());
|
|
31
30
|
}
|
|
32
31
|
/** Current distance in world units */
|
|
33
32
|
get distance() {
|
|
34
|
-
return this.
|
|
33
|
+
return this.distanceInternal;
|
|
35
34
|
}
|
|
36
35
|
/** Anchor on element A (0 = left, 0.5 = center, 1 = right) */
|
|
37
36
|
get anchorA() {
|
|
38
|
-
return this.
|
|
37
|
+
return this.anchorAInternal;
|
|
39
38
|
}
|
|
40
39
|
/** Anchor on element B (0 = left, 0.5 = center, 1 = right) */
|
|
41
40
|
get anchorB() {
|
|
42
|
-
return this.
|
|
41
|
+
return this.anchorBInternal;
|
|
43
42
|
}
|
|
44
43
|
/** Updates distance */
|
|
45
44
|
set distance(value) {
|
|
45
|
+
this.assertNotDestroyed("UIHorizontalDistanceConstraint.distance");
|
|
46
46
|
assertValidNumber(value, "UIHorizontalDistanceConstraint.distance");
|
|
47
|
-
if (this.
|
|
48
|
-
this.
|
|
49
|
-
this.solverWrapper.setConstraintRHS(this.constraint, new UIExpression(this.
|
|
47
|
+
if (this.distanceInternal !== value) {
|
|
48
|
+
this.distanceInternal = value;
|
|
49
|
+
this.solverWrapper.setConstraintRHS(this.constraint, new UIExpression(this.distanceInternal));
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
/** Updates anchor on element A */
|
|
53
53
|
set anchorA(value) {
|
|
54
|
+
this.assertNotDestroyed("UIHorizontalDistanceConstraint.anchorA");
|
|
54
55
|
assertValidNumber(value, "UIHorizontalDistanceConstraint.anchorA");
|
|
55
|
-
if (this.
|
|
56
|
-
this.
|
|
57
|
-
this.solverWrapper.setConstraintLHS(this.constraint, this.
|
|
56
|
+
if (this.anchorAInternal !== value) {
|
|
57
|
+
this.anchorAInternal = value;
|
|
58
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this.buildLHS());
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
/** Updates anchor on element B */
|
|
61
62
|
set anchorB(value) {
|
|
63
|
+
this.assertNotDestroyed("UIHorizontalDistanceConstraint.anchorB");
|
|
62
64
|
assertValidNumber(value, "UIHorizontalDistanceConstraint.anchorB");
|
|
63
|
-
if (this.
|
|
64
|
-
this.
|
|
65
|
-
this.solverWrapper.setConstraintLHS(this.constraint, this.
|
|
65
|
+
if (this.anchorBInternal !== value) {
|
|
66
|
+
this.anchorBInternal = value;
|
|
67
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this.buildLHS());
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
/** Builds constraint expression for distance between anchored positions */
|
|
69
|
-
|
|
71
|
+
buildLHS() {
|
|
70
72
|
let aExpression;
|
|
71
73
|
let bExpression;
|
|
72
74
|
if (isUIPlaneElement(this.a)) {
|
|
73
75
|
aExpression = new UIExpression(0, [
|
|
74
76
|
[this.a.xVariable, 1],
|
|
75
|
-
[this.a.wVariable, this.
|
|
77
|
+
[this.a.wVariable, this.anchorAInternal],
|
|
76
78
|
]);
|
|
77
79
|
}
|
|
78
80
|
else if (isUIPointElement(this.a)) {
|
|
79
81
|
aExpression = new UIExpression().plus(this.a.xVariable, 1);
|
|
80
82
|
}
|
|
81
83
|
else {
|
|
82
|
-
throw new Error("UIHorizontalDistanceConstraint.buildLHS.a:
|
|
84
|
+
throw new Error("UIHorizontalDistanceConstraint.buildLHS.a: A is neither a point nor a plane element");
|
|
83
85
|
}
|
|
84
86
|
if (isUIPlaneElement(this.b)) {
|
|
85
87
|
bExpression = new UIExpression(0, [
|
|
86
88
|
[this.b.xVariable, 1],
|
|
87
|
-
[this.b.wVariable, this.
|
|
89
|
+
[this.b.wVariable, this.anchorBInternal],
|
|
88
90
|
]);
|
|
89
91
|
}
|
|
90
92
|
else if (isUIPointElement(this.b)) {
|
|
91
93
|
bExpression = new UIExpression().plus(this.b.xVariable, 1);
|
|
92
94
|
}
|
|
93
95
|
else {
|
|
94
|
-
throw new Error("UIHorizontalDistanceConstraint.buildLHS.b:
|
|
96
|
+
throw new Error("UIHorizontalDistanceConstraint.buildLHS.b: B is neither a point nor a plane element");
|
|
95
97
|
}
|
|
96
98
|
return UIExpression.minus(bExpression, aExpression);
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
|
-
|
|
100
|
-
export { UIHorizontalDistanceConstraint };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
|
|
1
|
+
import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal.js";
|
|
2
2
|
export declare const DEFAULT_ANCHOR = 0.5;
|
|
3
3
|
export declare const DEFAULT_T = 0.5;
|
|
4
4
|
/** Horizontal interpolation constraint options */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
|
|
2
|
-
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
|
|
3
|
-
import type { UIHorizontalInterpolationConstraintOptions } from "./UIHorizontalInterpolationConstraint.Internal";
|
|
1
|
+
import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared.js";
|
|
2
|
+
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
3
|
+
import type { UIHorizontalInterpolationConstraintOptions } from "./UIHorizontalInterpolationConstraint.Internal.js";
|
|
4
4
|
/** Positions element C horizontally between A and B based on interpolation factor */
|
|
5
5
|
export declare class UIHorizontalInterpolationConstraint extends UISingleParameterConstraint {
|
|
6
6
|
readonly a: UIPointElement | UIPlaneElement;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { assertValidNumber,
|
|
2
|
-
import { isUIPlaneElement, isUIPointElement } from
|
|
3
|
-
import { UIExpression } from
|
|
4
|
-
import { UISingleParameterConstraint } from
|
|
5
|
-
import { DEFAULT_ANCHOR, DEFAULT_T } from
|
|
6
|
-
|
|
1
|
+
import { assertValidInterpolationConstraintArguments, assertValidNumber, } from "../../miscellaneous/asserts.js";
|
|
2
|
+
import { isUIPlaneElement, isUIPointElement } from "../../miscellaneous/shared.js";
|
|
3
|
+
import { UIExpression } from "../../miscellaneous/UIExpression.js";
|
|
4
|
+
import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint.js";
|
|
5
|
+
import { DEFAULT_ANCHOR, DEFAULT_T } from "./UIHorizontalInterpolationConstraint.Internal.js";
|
|
7
6
|
/** Positions element C horizontally between A and B based on interpolation factor */
|
|
8
|
-
class UIHorizontalInterpolationConstraint extends UISingleParameterConstraint {
|
|
7
|
+
export class UIHorizontalInterpolationConstraint extends UISingleParameterConstraint {
|
|
9
8
|
/**
|
|
10
9
|
* @param a First element
|
|
11
10
|
* @param b Second element
|
|
@@ -31,105 +30,107 @@ class UIHorizontalInterpolationConstraint extends UISingleParameterConstraint {
|
|
|
31
30
|
this.a = a;
|
|
32
31
|
this.b = b;
|
|
33
32
|
this.c = c;
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.constraint = this.solverWrapper.createConstraint(this.
|
|
33
|
+
this.anchorAInternal = anchorA;
|
|
34
|
+
this.anchorBInternal = anchorA;
|
|
35
|
+
this.anchorCInternal = options.anchorC ?? DEFAULT_ANCHOR;
|
|
36
|
+
this.tInternal = options.t ?? DEFAULT_T;
|
|
37
|
+
this.constraint = this.solverWrapper.createConstraint(this.buildLHS(), new UIExpression(0), this.relation, this.priority, this.isConstraintEnabled());
|
|
39
38
|
}
|
|
40
39
|
/** Interpolation factor (0 = A position, 1 = B position) */
|
|
41
40
|
get t() {
|
|
42
|
-
return this.
|
|
41
|
+
return this.tInternal;
|
|
43
42
|
}
|
|
44
43
|
/** Anchor on element A (0 = left, 0.5 = center, 1 = right) */
|
|
45
44
|
get anchorA() {
|
|
46
|
-
return this.
|
|
45
|
+
return this.anchorAInternal;
|
|
47
46
|
}
|
|
48
47
|
/** Anchor on element B (0 = left, 0.5 = center, 1 = right) */
|
|
49
48
|
get anchorB() {
|
|
50
|
-
return this.
|
|
49
|
+
return this.anchorBInternal;
|
|
51
50
|
}
|
|
52
51
|
/** Anchor on element C (0 = left, 0.5 = center, 1 = right) */
|
|
53
52
|
get anchorC() {
|
|
54
|
-
return this.
|
|
53
|
+
return this.anchorCInternal;
|
|
55
54
|
}
|
|
56
55
|
/** Updates interpolation factor */
|
|
57
56
|
set t(value) {
|
|
57
|
+
this.assertNotDestroyed("UIHorizontalInterpolationConstraint.t");
|
|
58
58
|
assertValidNumber(value, "UIHorizontalInterpolationConstraint.t");
|
|
59
|
-
if (this.
|
|
60
|
-
this.
|
|
61
|
-
this.solverWrapper.setConstraintLHS(this.constraint, this.
|
|
59
|
+
if (this.tInternal !== value) {
|
|
60
|
+
this.tInternal = value;
|
|
61
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this.buildLHS());
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
/** Updates anchor on element A */
|
|
65
65
|
set anchorA(value) {
|
|
66
|
+
this.assertNotDestroyed("UIHorizontalInterpolationConstraint.anchorA");
|
|
66
67
|
assertValidNumber(value, "UIHorizontalInterpolationConstraint.anchorA");
|
|
67
|
-
if (this.
|
|
68
|
-
this.
|
|
69
|
-
this.solverWrapper.setConstraintLHS(this.constraint, this.
|
|
68
|
+
if (this.anchorAInternal !== value) {
|
|
69
|
+
this.anchorAInternal = value;
|
|
70
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this.buildLHS());
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
/** Updates anchor on element B */
|
|
73
74
|
set anchorB(value) {
|
|
75
|
+
this.assertNotDestroyed("UIHorizontalInterpolationConstraint.anchorB");
|
|
74
76
|
assertValidNumber(value, "UIHorizontalInterpolationConstraint.anchorB");
|
|
75
|
-
if (this.
|
|
76
|
-
this.
|
|
77
|
-
this.solverWrapper.setConstraintLHS(this.constraint, this.
|
|
77
|
+
if (this.anchorBInternal !== value) {
|
|
78
|
+
this.anchorBInternal = value;
|
|
79
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this.buildLHS());
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
/** Updates anchor on element C */
|
|
81
83
|
set anchorC(value) {
|
|
84
|
+
this.assertNotDestroyed("UIHorizontalInterpolationConstraint.anchorC");
|
|
82
85
|
assertValidNumber(value, "UIHorizontalInterpolationConstraint.anchorC");
|
|
83
|
-
if (this.
|
|
84
|
-
this.
|
|
85
|
-
this.solverWrapper.setConstraintLHS(this.constraint, this.
|
|
86
|
+
if (this.anchorCInternal !== value) {
|
|
87
|
+
this.anchorCInternal = value;
|
|
88
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this.buildLHS());
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
/** Builds constraint expression: C - A*(1-t) - B*t = 0 */
|
|
89
|
-
|
|
92
|
+
buildLHS() {
|
|
90
93
|
let aExpression;
|
|
91
94
|
let bExpression;
|
|
92
95
|
let cExpression;
|
|
93
96
|
if (isUIPlaneElement(this.a)) {
|
|
94
97
|
aExpression = new UIExpression(0, [
|
|
95
98
|
[this.a.xVariable, 1],
|
|
96
|
-
[this.a.wVariable, this.
|
|
99
|
+
[this.a.wVariable, this.anchorAInternal],
|
|
97
100
|
]);
|
|
98
101
|
}
|
|
99
102
|
else if (isUIPointElement(this.a)) {
|
|
100
103
|
aExpression = new UIExpression().plus(this.a.xVariable, 1);
|
|
101
104
|
}
|
|
102
105
|
else {
|
|
103
|
-
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.a:
|
|
106
|
+
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.a: A is neither a point nor a plane element");
|
|
104
107
|
}
|
|
105
108
|
if (isUIPlaneElement(this.b)) {
|
|
106
109
|
bExpression = new UIExpression(0, [
|
|
107
110
|
[this.b.xVariable, 1],
|
|
108
|
-
[this.b.wVariable, this.
|
|
111
|
+
[this.b.wVariable, this.anchorBInternal],
|
|
109
112
|
]);
|
|
110
113
|
}
|
|
111
114
|
else if (isUIPointElement(this.b)) {
|
|
112
115
|
bExpression = new UIExpression().plus(this.b.xVariable, 1);
|
|
113
116
|
}
|
|
114
117
|
else {
|
|
115
|
-
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.b:
|
|
118
|
+
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.b: B is neither a point nor a plane element");
|
|
116
119
|
}
|
|
117
120
|
if (isUIPlaneElement(this.c)) {
|
|
118
121
|
cExpression = new UIExpression(0, [
|
|
119
122
|
[this.c.xVariable, 1],
|
|
120
|
-
[this.c.wVariable, this.
|
|
123
|
+
[this.c.wVariable, this.anchorCInternal],
|
|
121
124
|
]);
|
|
122
125
|
}
|
|
123
126
|
else if (isUIPointElement(this.c)) {
|
|
124
127
|
cExpression = new UIExpression().plus(this.c.xVariable, 1);
|
|
125
128
|
}
|
|
126
129
|
else {
|
|
127
|
-
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.c:
|
|
130
|
+
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.c: C is neither a point nor a plane element");
|
|
128
131
|
}
|
|
129
|
-
const aScaled = aExpression.clone().multiply(1 - this.
|
|
130
|
-
const bScaled = bExpression.clone().multiply(this.
|
|
132
|
+
const aScaled = aExpression.clone().multiply(1 - this.tInternal);
|
|
133
|
+
const bScaled = bExpression.clone().multiply(this.tInternal);
|
|
131
134
|
return UIExpression.minus(UIExpression.minus(cExpression, aScaled), bScaled);
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
|
-
|
|
135
|
-
export { UIHorizontalInterpolationConstraint };
|