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
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UIExpression } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { Constraint, Expression, Solver, Variable } from "@lume/kiwi";
|
|
2
|
+
import { UIExpression } from "../../miscellaneous/UIExpression.js";
|
|
3
|
+
import { convertPriority, UIPriority } from "../../miscellaneous/UIPriority.js";
|
|
4
|
+
import { convertRelation, UIRelation } from "../../miscellaneous/UIRelation.js";
|
|
6
5
|
/**
|
|
7
6
|
* Wrapper around the Kiwi constraint solver providing enhanced UI-specific functionality.
|
|
8
7
|
*
|
|
@@ -23,22 +22,22 @@ import { UIRelation, convertRelation } from '../../miscellaneous/UIRelation.js';
|
|
|
23
22
|
* @see {@link UIPriority} - Priority levels for variables and constraints
|
|
24
23
|
* @see {@link UIRelation} - Relational operators for constraints
|
|
25
24
|
*/
|
|
26
|
-
class UISolverWrapper {
|
|
25
|
+
export class UISolverWrapper {
|
|
27
26
|
constructor() {
|
|
28
27
|
/** @internal */
|
|
29
28
|
this.dirty = false;
|
|
30
29
|
/** The underlying Kiwi solver instance, undefined when solver needs rebuilding. */
|
|
31
|
-
this.
|
|
30
|
+
this.solver = new Solver();
|
|
32
31
|
/** Flag indicating whether variable values need recalculation. */
|
|
33
|
-
this.
|
|
32
|
+
this.recalculationRequired = false;
|
|
34
33
|
/** Map of variable indices to their descriptions. */
|
|
35
|
-
this.
|
|
34
|
+
this.variables = new Map();
|
|
36
35
|
/** Counter for generating unique variable indices. */
|
|
37
|
-
this.
|
|
36
|
+
this.lastVariableIndex = 0;
|
|
38
37
|
/** Map of constraint indices to their descriptions. */
|
|
39
|
-
this.
|
|
38
|
+
this.constraints = new Map();
|
|
40
39
|
/** Counter for generating unique constraint indices. */
|
|
41
|
-
this.
|
|
40
|
+
this.lastConstraintIndex = 0;
|
|
42
41
|
}
|
|
43
42
|
/**
|
|
44
43
|
* Creates a new solver variable with the specified value and priority.
|
|
@@ -52,30 +51,30 @@ class UISolverWrapper {
|
|
|
52
51
|
* @returns Unique index identifier for the created variable
|
|
53
52
|
*/
|
|
54
53
|
createVariable(value, priority) {
|
|
55
|
-
const index = this.
|
|
54
|
+
const index = this.lastVariableIndex++;
|
|
56
55
|
const variable = new Variable();
|
|
57
56
|
if (priority === UIPriority.P0) {
|
|
58
57
|
const description = { variable, priority, value };
|
|
59
|
-
this.
|
|
60
|
-
description.constraint = this.
|
|
58
|
+
this.variables.set(index, description);
|
|
59
|
+
description.constraint = this.buildConstraint(new UIExpression(0, [[index, 1]]), new UIExpression(value), UIRelation.EQUAL, priority);
|
|
61
60
|
try {
|
|
62
|
-
this.
|
|
61
|
+
this.solver?.addConstraint(description.constraint);
|
|
63
62
|
}
|
|
64
63
|
catch {
|
|
65
|
-
this.
|
|
64
|
+
this.solver = undefined;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
else {
|
|
69
|
-
this.
|
|
68
|
+
this.variables.set(index, { variable, priority, value });
|
|
70
69
|
try {
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
70
|
+
this.solver?.addEditVariable(variable, convertPriority(priority));
|
|
71
|
+
this.solver?.suggestValue(variable, value);
|
|
73
72
|
}
|
|
74
73
|
catch {
|
|
75
|
-
this.
|
|
74
|
+
this.solver = undefined;
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
|
-
this.
|
|
77
|
+
this.recalculationRequired = true;
|
|
79
78
|
this.dirty = true;
|
|
80
79
|
return index;
|
|
81
80
|
}
|
|
@@ -89,27 +88,36 @@ class UISolverWrapper {
|
|
|
89
88
|
* @throws Will throw an error if the variable doesn't exist or is still in use
|
|
90
89
|
*/
|
|
91
90
|
removeVariable(index) {
|
|
92
|
-
const description = this.
|
|
91
|
+
const description = this.variables.get(index);
|
|
93
92
|
if (description === undefined) {
|
|
94
|
-
throw new Error(`UISolverWrapper.removeVariable.index: variable does not exist`);
|
|
93
|
+
throw new Error(`UISolverWrapper.removeVariable.index: variable ${index} does not exist; its element may be destroyed`);
|
|
95
94
|
}
|
|
96
|
-
for (const cDescription of this.
|
|
95
|
+
for (const [cIndex, cDescription] of this.constraints) {
|
|
97
96
|
if (cDescription.lhs.hasTerm(index) || cDescription.rhs.hasTerm(index)) {
|
|
98
|
-
throw new Error(`UISolverWrapper.removeVariable.index: variable is used in constraint`);
|
|
97
|
+
throw new Error(`UISolverWrapper.removeVariable.index: variable ${index} is used in constraint ${cIndex}; destroy the constraint first`);
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
100
|
try {
|
|
102
101
|
description.constraint
|
|
103
|
-
? this.
|
|
104
|
-
: this.
|
|
102
|
+
? this.solver?.removeConstraint(description.constraint)
|
|
103
|
+
: this.solver?.removeEditVariable(description.variable);
|
|
105
104
|
}
|
|
106
105
|
catch {
|
|
107
|
-
this.
|
|
106
|
+
this.solver = undefined;
|
|
108
107
|
}
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
108
|
+
this.variables.delete(index);
|
|
109
|
+
this.recalculationRequired = true;
|
|
111
110
|
this.dirty = true;
|
|
112
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Checks whether a variable exists.
|
|
114
|
+
*
|
|
115
|
+
* @param index - Index of the variable
|
|
116
|
+
* @returns True if the variable was created and not removed
|
|
117
|
+
*/
|
|
118
|
+
hasVariable(index) {
|
|
119
|
+
return this.variables.has(index);
|
|
120
|
+
}
|
|
113
121
|
/**
|
|
114
122
|
* Suggests a new value for an existing variable.
|
|
115
123
|
*
|
|
@@ -122,19 +130,19 @@ class UISolverWrapper {
|
|
|
122
130
|
* @throws Will throw an error if the variable doesn't exist
|
|
123
131
|
*/
|
|
124
132
|
suggestVariableValue(index, value) {
|
|
125
|
-
const description = this.
|
|
133
|
+
const description = this.variables.get(index);
|
|
126
134
|
if (description === undefined) {
|
|
127
|
-
throw new Error(`UISolverWrapper.suggestVariableValue.index: variable does not exist`);
|
|
135
|
+
throw new Error(`UISolverWrapper.suggestVariableValue.index: variable ${index} does not exist; its element may be destroyed`);
|
|
128
136
|
}
|
|
129
137
|
if (description.value !== value) {
|
|
130
138
|
description.value = value;
|
|
131
139
|
if (description.constraint) {
|
|
132
|
-
description.constraint = this.
|
|
140
|
+
description.constraint = this.rebuildConstraint(description.constraint, new UIExpression().plus(index, 1), new UIExpression(description.value), UIRelation.EQUAL, description.priority);
|
|
133
141
|
}
|
|
134
142
|
else {
|
|
135
|
-
this.
|
|
143
|
+
this.solver?.suggestValue(description.variable, value);
|
|
136
144
|
}
|
|
137
|
-
this.
|
|
145
|
+
this.recalculationRequired = true;
|
|
138
146
|
this.dirty = true;
|
|
139
147
|
}
|
|
140
148
|
}
|
|
@@ -150,36 +158,36 @@ class UISolverWrapper {
|
|
|
150
158
|
* @throws Will throw an error if the variable doesn't exist
|
|
151
159
|
*/
|
|
152
160
|
setVariablePriority(index, priority) {
|
|
153
|
-
const description = this.
|
|
161
|
+
const description = this.variables.get(index);
|
|
154
162
|
if (description === undefined) {
|
|
155
|
-
throw new Error(`UISolverWrapper.setVariablePriority.index: variable does not exist`);
|
|
163
|
+
throw new Error(`UISolverWrapper.setVariablePriority.index: variable ${index} does not exist; its element may be destroyed`);
|
|
156
164
|
}
|
|
157
165
|
if (priority !== description.priority) {
|
|
158
166
|
description.priority = priority;
|
|
159
167
|
if (description.priority === UIPriority.P0) {
|
|
160
168
|
const lhs = new UIExpression().plus(index, 1);
|
|
161
169
|
const rhs = new UIExpression(description.value);
|
|
162
|
-
description.constraint = this.
|
|
170
|
+
description.constraint = this.buildConstraint(lhs, rhs, UIRelation.EQUAL, description.priority);
|
|
163
171
|
try {
|
|
164
|
-
this.
|
|
172
|
+
this.solver?.addConstraint(description.constraint);
|
|
165
173
|
}
|
|
166
174
|
catch {
|
|
167
|
-
this.
|
|
175
|
+
this.solver = undefined;
|
|
168
176
|
}
|
|
169
177
|
}
|
|
170
178
|
else {
|
|
171
179
|
if (description.constraint) {
|
|
172
180
|
try {
|
|
173
|
-
this.
|
|
181
|
+
this.solver?.removeConstraint(description.constraint);
|
|
174
182
|
}
|
|
175
183
|
catch {
|
|
176
|
-
this.
|
|
184
|
+
this.solver = undefined;
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
187
|
description.constraint = undefined;
|
|
180
|
-
this.
|
|
188
|
+
this.rebuildVariable(index, description);
|
|
181
189
|
}
|
|
182
|
-
this.
|
|
190
|
+
this.recalculationRequired = true;
|
|
183
191
|
this.dirty = true;
|
|
184
192
|
}
|
|
185
193
|
}
|
|
@@ -194,16 +202,16 @@ class UISolverWrapper {
|
|
|
194
202
|
* @throws Will throw an error if the variable doesn't exist
|
|
195
203
|
*/
|
|
196
204
|
readVariableValue(index) {
|
|
197
|
-
const description = this.
|
|
205
|
+
const description = this.variables.get(index);
|
|
198
206
|
if (description === undefined) {
|
|
199
|
-
throw new Error(`UISolverWrapper.readVariableValue.index: variable does not exist`);
|
|
207
|
+
throw new Error(`UISolverWrapper.readVariableValue.index: variable ${index} does not exist; its element may be destroyed`);
|
|
200
208
|
}
|
|
201
|
-
if (this.
|
|
202
|
-
this.
|
|
209
|
+
if (this.solver === undefined) {
|
|
210
|
+
this.rebuildSolver();
|
|
203
211
|
}
|
|
204
|
-
if (this.
|
|
205
|
-
this.
|
|
206
|
-
this.
|
|
212
|
+
if (this.recalculationRequired) {
|
|
213
|
+
this.solver?.updateVariables();
|
|
214
|
+
this.recalculationRequired = false;
|
|
207
215
|
}
|
|
208
216
|
return description.variable.value();
|
|
209
217
|
}
|
|
@@ -221,9 +229,9 @@ class UISolverWrapper {
|
|
|
221
229
|
* @returns Unique index identifier for the created constraint
|
|
222
230
|
*/
|
|
223
231
|
createConstraint(lhs, rhs, relation, priority, enabled) {
|
|
224
|
-
const index = this.
|
|
225
|
-
const constraint = this.
|
|
226
|
-
this.
|
|
232
|
+
const index = this.lastConstraintIndex++;
|
|
233
|
+
const constraint = this.buildConstraint(lhs, rhs, relation, priority);
|
|
234
|
+
this.constraints.set(index, {
|
|
227
235
|
constraint,
|
|
228
236
|
lhs: lhs.clone(),
|
|
229
237
|
rhs: rhs.clone(),
|
|
@@ -233,12 +241,12 @@ class UISolverWrapper {
|
|
|
233
241
|
});
|
|
234
242
|
if (enabled) {
|
|
235
243
|
try {
|
|
236
|
-
this.
|
|
244
|
+
this.solver?.addConstraint(constraint);
|
|
237
245
|
}
|
|
238
246
|
catch {
|
|
239
|
-
this.
|
|
247
|
+
this.solver = undefined;
|
|
240
248
|
}
|
|
241
|
-
this.
|
|
249
|
+
this.recalculationRequired = true;
|
|
242
250
|
this.dirty = true;
|
|
243
251
|
}
|
|
244
252
|
return index;
|
|
@@ -253,22 +261,37 @@ class UISolverWrapper {
|
|
|
253
261
|
* @throws Will throw an error if the constraint doesn't exist
|
|
254
262
|
*/
|
|
255
263
|
removeConstraint(index) {
|
|
256
|
-
const description = this.
|
|
264
|
+
const description = this.constraints.get(index);
|
|
257
265
|
if (description === undefined) {
|
|
258
|
-
throw new Error(`UISolverWrapper.removeConstraint.index: constraint does not exist`);
|
|
266
|
+
throw new Error(`UISolverWrapper.removeConstraint.index: constraint ${index} does not exist; it may be destroyed`);
|
|
259
267
|
}
|
|
260
268
|
if (description.enabled) {
|
|
261
269
|
try {
|
|
262
|
-
this.
|
|
270
|
+
this.solver?.removeConstraint(description.constraint);
|
|
263
271
|
}
|
|
264
272
|
catch {
|
|
265
|
-
this.
|
|
273
|
+
this.solver = undefined;
|
|
266
274
|
}
|
|
267
275
|
}
|
|
268
|
-
this.
|
|
269
|
-
this.
|
|
276
|
+
this.constraints.delete(index);
|
|
277
|
+
this.recalculationRequired = true;
|
|
270
278
|
this.dirty = true;
|
|
271
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* Checks whether a constraint references a variable in either of its expressions.
|
|
282
|
+
*
|
|
283
|
+
* @param constraintIndex - Index of the constraint to check
|
|
284
|
+
* @param variableIndex - Index of the variable to look for
|
|
285
|
+
* @returns True if the variable is a term of the constraint
|
|
286
|
+
* @throws Will throw an error if the constraint doesn't exist
|
|
287
|
+
*/
|
|
288
|
+
isConstraintUsingVariable(constraintIndex, variableIndex) {
|
|
289
|
+
const description = this.constraints.get(constraintIndex);
|
|
290
|
+
if (description === undefined) {
|
|
291
|
+
throw new Error(`UISolverWrapper.isConstraintUsingVariable.constraintIndex: constraint ${constraintIndex} does not exist; it may be destroyed`);
|
|
292
|
+
}
|
|
293
|
+
return description.lhs.hasTerm(variableIndex) || description.rhs.hasTerm(variableIndex);
|
|
294
|
+
}
|
|
272
295
|
/**
|
|
273
296
|
* Updates the left-hand side expression of an existing constraint.
|
|
274
297
|
*
|
|
@@ -280,13 +303,13 @@ class UISolverWrapper {
|
|
|
280
303
|
* @throws Will throw an error if the constraint doesn't exist
|
|
281
304
|
*/
|
|
282
305
|
setConstraintLHS(index, lhs) {
|
|
283
|
-
const description = this.
|
|
306
|
+
const description = this.constraints.get(index);
|
|
284
307
|
if (description === undefined) {
|
|
285
|
-
throw new Error(`UISolverWrapper.setConstraintLHS.index: constraint does not exist`);
|
|
308
|
+
throw new Error(`UISolverWrapper.setConstraintLHS.index: constraint ${index} does not exist; it may be destroyed`);
|
|
286
309
|
}
|
|
287
310
|
description.lhs.copy(lhs);
|
|
288
|
-
this.
|
|
289
|
-
this.
|
|
311
|
+
this.rebuildConstraintByDescription(description);
|
|
312
|
+
this.recalculationRequired = true;
|
|
290
313
|
this.dirty = true;
|
|
291
314
|
}
|
|
292
315
|
/**
|
|
@@ -300,13 +323,13 @@ class UISolverWrapper {
|
|
|
300
323
|
* @throws Will throw an error if the constraint doesn't exist
|
|
301
324
|
*/
|
|
302
325
|
setConstraintRHS(index, rhs) {
|
|
303
|
-
const description = this.
|
|
326
|
+
const description = this.constraints.get(index);
|
|
304
327
|
if (description === undefined) {
|
|
305
|
-
throw new Error(`UISolverWrapper.setConstraintRHS.index: constraint does not exist`);
|
|
328
|
+
throw new Error(`UISolverWrapper.setConstraintRHS.index: constraint ${index} does not exist; it may be destroyed`);
|
|
306
329
|
}
|
|
307
330
|
description.rhs.copy(rhs);
|
|
308
|
-
this.
|
|
309
|
-
this.
|
|
331
|
+
this.rebuildConstraintByDescription(description);
|
|
332
|
+
this.recalculationRequired = true;
|
|
310
333
|
this.dirty = true;
|
|
311
334
|
}
|
|
312
335
|
/**
|
|
@@ -320,14 +343,14 @@ class UISolverWrapper {
|
|
|
320
343
|
* @throws Will throw an error if the constraint doesn't exist
|
|
321
344
|
*/
|
|
322
345
|
setConstraintRelation(index, relation) {
|
|
323
|
-
const description = this.
|
|
346
|
+
const description = this.constraints.get(index);
|
|
324
347
|
if (description === undefined) {
|
|
325
|
-
throw new Error(`UISolverWrapper.setConstraintRelation.index: constraint does not exist`);
|
|
348
|
+
throw new Error(`UISolverWrapper.setConstraintRelation.index: constraint ${index} does not exist; it may be destroyed`);
|
|
326
349
|
}
|
|
327
350
|
if (description.relation !== relation) {
|
|
328
351
|
description.relation = relation;
|
|
329
|
-
this.
|
|
330
|
-
this.
|
|
352
|
+
this.rebuildConstraintByDescription(description);
|
|
353
|
+
this.recalculationRequired = true;
|
|
331
354
|
this.dirty = true;
|
|
332
355
|
}
|
|
333
356
|
}
|
|
@@ -342,14 +365,14 @@ class UISolverWrapper {
|
|
|
342
365
|
* @throws Will throw an error if the constraint doesn't exist
|
|
343
366
|
*/
|
|
344
367
|
setConstraintPriority(index, priority) {
|
|
345
|
-
const description = this.
|
|
368
|
+
const description = this.constraints.get(index);
|
|
346
369
|
if (description === undefined) {
|
|
347
|
-
throw new Error(`UISolverWrapper.setConstraintPriority.index: constraint does not exist`);
|
|
370
|
+
throw new Error(`UISolverWrapper.setConstraintPriority.index: constraint ${index} does not exist; it may be destroyed`);
|
|
348
371
|
}
|
|
349
372
|
if (description.priority !== priority) {
|
|
350
373
|
description.priority = priority;
|
|
351
|
-
this.
|
|
352
|
-
this.
|
|
374
|
+
this.rebuildConstraintByDescription(description);
|
|
375
|
+
this.recalculationRequired = true;
|
|
353
376
|
this.dirty = true;
|
|
354
377
|
}
|
|
355
378
|
}
|
|
@@ -364,21 +387,21 @@ class UISolverWrapper {
|
|
|
364
387
|
* @throws Will throw an error if the constraint doesn't exist
|
|
365
388
|
*/
|
|
366
389
|
setConstraintEnabled(index, enabled) {
|
|
367
|
-
const description = this.
|
|
390
|
+
const description = this.constraints.get(index);
|
|
368
391
|
if (description === undefined) {
|
|
369
|
-
throw new Error(`UISolverWrapper.setConstraintEnabled.index: constraint does not exist`);
|
|
392
|
+
throw new Error(`UISolverWrapper.setConstraintEnabled.index: constraint ${index} does not exist; it may be destroyed`);
|
|
370
393
|
}
|
|
371
394
|
if (enabled !== description.enabled) {
|
|
372
395
|
description.enabled = enabled;
|
|
373
396
|
try {
|
|
374
397
|
description.enabled
|
|
375
|
-
? this.
|
|
376
|
-
: this.
|
|
398
|
+
? this.solver?.addConstraint(description.constraint)
|
|
399
|
+
: this.solver?.removeConstraint(description.constraint);
|
|
377
400
|
}
|
|
378
401
|
catch {
|
|
379
|
-
this.
|
|
402
|
+
this.solver = undefined;
|
|
380
403
|
}
|
|
381
|
-
this.
|
|
404
|
+
this.recalculationRequired = true;
|
|
382
405
|
this.dirty = true;
|
|
383
406
|
}
|
|
384
407
|
}
|
|
@@ -389,30 +412,30 @@ class UISolverWrapper {
|
|
|
389
412
|
* updates the variable configuration, then rebuilds and re-adds
|
|
390
413
|
* the dependent constraints.
|
|
391
414
|
*/
|
|
392
|
-
|
|
415
|
+
rebuildVariable(index, description) {
|
|
393
416
|
const dependConstraints = [];
|
|
394
|
-
for (const cDescription of this.
|
|
417
|
+
for (const cDescription of this.constraints.values()) {
|
|
395
418
|
if (cDescription.lhs.hasTerm(index) || cDescription.rhs.hasTerm(index)) {
|
|
396
419
|
try {
|
|
397
|
-
this.
|
|
420
|
+
this.solver?.removeConstraint(cDescription.constraint);
|
|
398
421
|
}
|
|
399
422
|
catch {
|
|
400
|
-
this.
|
|
423
|
+
this.solver = undefined;
|
|
401
424
|
}
|
|
402
425
|
dependConstraints.push(cDescription);
|
|
403
426
|
}
|
|
404
427
|
}
|
|
405
|
-
this.
|
|
406
|
-
this.
|
|
428
|
+
this.solver?.removeEditVariable(description.variable);
|
|
429
|
+
this.solver?.addEditVariable(description.variable, convertPriority(description.priority));
|
|
407
430
|
for (const cDescription of dependConstraints) {
|
|
408
|
-
cDescription.constraint = this.
|
|
431
|
+
cDescription.constraint = this.buildConstraint(cDescription.lhs, cDescription.rhs, cDescription.relation, cDescription.priority);
|
|
409
432
|
}
|
|
410
433
|
for (const cDescription of dependConstraints) {
|
|
411
434
|
try {
|
|
412
|
-
this.
|
|
435
|
+
this.solver?.addConstraint(cDescription.constraint);
|
|
413
436
|
}
|
|
414
437
|
catch {
|
|
415
|
-
this.
|
|
438
|
+
this.solver = undefined;
|
|
416
439
|
break;
|
|
417
440
|
}
|
|
418
441
|
}
|
|
@@ -423,29 +446,29 @@ class UISolverWrapper {
|
|
|
423
446
|
* Uses different rebuild strategies depending on whether the
|
|
424
447
|
* constraint is currently enabled.
|
|
425
448
|
*/
|
|
426
|
-
|
|
449
|
+
rebuildConstraintByDescription(description) {
|
|
427
450
|
description.constraint = description.enabled
|
|
428
|
-
? this.
|
|
429
|
-
: this.
|
|
451
|
+
? this.rebuildConstraint(description.constraint, description.lhs, description.rhs, description.relation, description.priority)
|
|
452
|
+
: this.buildConstraint(description.lhs, description.rhs, description.relation, description.priority);
|
|
430
453
|
}
|
|
431
454
|
/**
|
|
432
455
|
* Rebuilds a constraint by removing the old one and creating a new one.
|
|
433
456
|
*
|
|
434
457
|
* Safely handles solver state transitions and constraint replacement.
|
|
435
458
|
*/
|
|
436
|
-
|
|
459
|
+
rebuildConstraint(oldConstraint, lhs, rhs, relation, priority) {
|
|
437
460
|
try {
|
|
438
|
-
this.
|
|
461
|
+
this.solver?.removeConstraint(oldConstraint);
|
|
439
462
|
}
|
|
440
463
|
catch {
|
|
441
|
-
this.
|
|
464
|
+
this.solver = undefined;
|
|
442
465
|
}
|
|
443
|
-
const constraint = this.
|
|
466
|
+
const constraint = this.buildConstraint(lhs, rhs, relation, priority);
|
|
444
467
|
try {
|
|
445
|
-
this.
|
|
468
|
+
this.solver?.addConstraint(constraint);
|
|
446
469
|
}
|
|
447
470
|
catch {
|
|
448
|
-
this.
|
|
471
|
+
this.solver = undefined;
|
|
449
472
|
}
|
|
450
473
|
return constraint;
|
|
451
474
|
}
|
|
@@ -454,8 +477,8 @@ class UISolverWrapper {
|
|
|
454
477
|
*
|
|
455
478
|
* Converts UI-level expressions and enums to Kiwi-compatible formats.
|
|
456
479
|
*/
|
|
457
|
-
|
|
458
|
-
return new Constraint(this.
|
|
480
|
+
buildConstraint(lhs, rhs, relation, priority) {
|
|
481
|
+
return new Constraint(this.convertExpression(lhs), convertRelation(relation), this.convertExpression(rhs), convertPriority(priority));
|
|
459
482
|
}
|
|
460
483
|
/**
|
|
461
484
|
* Converts a UIExpression to a Kiwi Expression.
|
|
@@ -463,11 +486,11 @@ class UISolverWrapper {
|
|
|
463
486
|
* Maps variable indices to their corresponding Kiwi Variable instances
|
|
464
487
|
* and preserves coefficients and constants.
|
|
465
488
|
*/
|
|
466
|
-
|
|
489
|
+
convertExpression(expression) {
|
|
467
490
|
return new Expression(...expression.prepareTerms().map(([variableIndex, coefficient]) => {
|
|
468
|
-
const description = this.
|
|
491
|
+
const description = this.variables.get(variableIndex);
|
|
469
492
|
if (description === undefined) {
|
|
470
|
-
throw new Error(`UISolverWrapper.convertExpression.expression: variable does not exist`);
|
|
493
|
+
throw new Error(`UISolverWrapper.convertExpression.expression: variable ${variableIndex} does not exist; its element may be destroyed`);
|
|
471
494
|
}
|
|
472
495
|
return [coefficient, description.variable];
|
|
473
496
|
}), expression.constant);
|
|
@@ -485,12 +508,12 @@ class UISolverWrapper {
|
|
|
485
508
|
* already in. The fresh solver is only published once the replay is complete,
|
|
486
509
|
* so a rejection can never leave a half-built solver in place.
|
|
487
510
|
*/
|
|
488
|
-
|
|
489
|
-
if (this.
|
|
511
|
+
rebuildSolver() {
|
|
512
|
+
if (this.solver) {
|
|
490
513
|
throw new Error("UISolverWrapper.rebuildSolver: solver already exists");
|
|
491
514
|
}
|
|
492
515
|
const solver = new Solver();
|
|
493
|
-
for (const description of this.
|
|
516
|
+
for (const description of this.variables.values()) {
|
|
494
517
|
try {
|
|
495
518
|
if (description.constraint) {
|
|
496
519
|
solver.addConstraint(description.constraint);
|
|
@@ -504,7 +527,7 @@ class UISolverWrapper {
|
|
|
504
527
|
continue;
|
|
505
528
|
}
|
|
506
529
|
}
|
|
507
|
-
for (const description of this.
|
|
530
|
+
for (const description of this.constraints.values()) {
|
|
508
531
|
if (description.enabled) {
|
|
509
532
|
try {
|
|
510
533
|
solver.addConstraint(description.constraint);
|
|
@@ -514,10 +537,8 @@ class UISolverWrapper {
|
|
|
514
537
|
}
|
|
515
538
|
}
|
|
516
539
|
}
|
|
517
|
-
this.
|
|
518
|
-
this.
|
|
540
|
+
this.solver = solver;
|
|
541
|
+
this.recalculationRequired = true;
|
|
519
542
|
this.dirty = true;
|
|
520
543
|
}
|
|
521
544
|
}
|
|
522
|
-
|
|
523
|
-
export { UISolverWrapper };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UIAspectConstraint } from "../core";
|
|
2
|
-
import { UIColor } from "../core";
|
|
3
|
-
import type { UIConstraintDebug } from "./UIConstraintDebug";
|
|
1
|
+
import type { UIAspectConstraint } from "../core/index.js";
|
|
2
|
+
import { UIColor } from "../core/index.js";
|
|
3
|
+
import type { UIConstraintDebug } from "./UIConstraintDebug.js";
|
|
4
4
|
export declare class UIAspectDebug implements UIConstraintDebug {
|
|
5
5
|
readonly constraint: UIAspectConstraint;
|
|
6
6
|
readonly tint: UIColor;
|