laymur 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -208
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
- package/dist/{constraints → core/constraints}/UIConstraint.d.ts +2 -2
- package/dist/core/constraints/UIConstraint.js +11 -0
- package/dist/core/constraints/UICustomConstraint.js +37 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
- package/dist/{elements → core/elements}/UIAnchor/UIAnchor.Internal.d.ts +3 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
- package/dist/{elements → core/elements}/UIAnchor/UIAnchor.d.ts +3 -3
- package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
- package/dist/{elements → core/elements}/UIDummy/UIDummy.d.ts +2 -2
- package/dist/core/elements/UIDummy/UIDummy.js +173 -0
- package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
- package/dist/{elements → core/elements}/UIElement/UIElement.d.ts +2 -2
- package/dist/core/elements/UIElement/UIElement.js +74 -0
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
- package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
- package/dist/core/elements/UIImage/UIImage.js +85 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
- package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
- package/dist/core/elements/UIProgress/UIProgress.js +165 -0
- package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
- package/dist/core/elements/UIScene/UIScene.js +157 -0
- package/dist/core/elements/UIText/UIText.Internal.js +12 -0
- package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
- package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
- package/dist/core/elements/UIText/UIText.js +265 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
- package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
- package/dist/core/layers/UILayer/UILayer.js +113 -0
- package/dist/core/miscellaneous/UIExpression.js +128 -0
- package/dist/core/miscellaneous/UIMode.js +30 -0
- package/dist/core/miscellaneous/UIOrientation.js +20 -0
- package/dist/core/miscellaneous/UIPriority.js +63 -0
- package/dist/core/miscellaneous/UIRelation.js +40 -0
- package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
- package/dist/core/miscellaneous/area/UIArea.js +5 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
- package/dist/core/miscellaneous/asserts.js +163 -0
- package/dist/core/miscellaneous/canvas.js +37 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
- package/dist/core/miscellaneous/color/UIColor.js +636 -0
- package/dist/core/miscellaneous/computeTransform.js +82 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
- package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
- package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
- package/dist/{miscellaneous → core/miscellaneous}/math.d.ts +2 -0
- package/dist/core/miscellaneous/math.js +11 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
- package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
- package/dist/core/miscellaneous/shared.js +37 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
- package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
- package/dist/core/miscellaneous/webglCapabilities.js +103 -0
- package/dist/core/shaders/UIImage.glsl.js +3 -0
- package/dist/core/shaders/UINineSlice.glsl.js +3 -0
- package/dist/core/shaders/UIProgress.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
- package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.d.ts +2 -2
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
- package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.d.ts +2 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
- package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.d.ts +2 -2
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
- package/dist/index.js +51 -9246
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
- package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
- package/dist/particles/elements/UIEmitter.Internal.js +11 -0
- package/dist/particles/elements/UIEmitter.d.ts +68 -0
- package/dist/particles/elements/UIEmitter.js +203 -0
- package/dist/particles/index.d.ts +18 -0
- package/dist/particles/index.js +18 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
- package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
- package/dist/particles/miscellaneous/miscellaneous.js +67 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
- package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
- package/dist/particles/spawnModules/UISpawnModule.js +9 -0
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
- package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
- package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
- package/package.json +27 -36
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UICustomConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIDummy/UIDummy.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIElement/UIElement.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIImage/UIImage.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIImage/UIImage.d.ts +0 -0
- /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIProgress/UIProgress.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIProgress/UIProgress.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIScene/UIScene.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIScene/UIScene.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Interfaces.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Measuring.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Rendering.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.d.ts +0 -0
- /package/dist/{index.d.ts → core/index.d.ts} +0 -0
- /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +0 -0
- /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -0
- /package/dist/{layers → core/layers}/UILayer/UILayer.Internal.d.ts +0 -0
- /package/dist/{layers → core/layers}/UILayer/UILayer.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIExpression.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIMode.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIOrientation.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIPriority.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIRelation.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UITransparencyMode.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIArea.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaCircle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaPolygon.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRectangle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRoundedRectangle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/asserts.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/canvas.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/computeTransform.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/shared.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunction.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicy.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCover.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCross.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFit.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyNone.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/shared.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/webglCapabilities.d.ts +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { assertValidNumber, assertValidInterpolationConstraintArguments } 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';
|
|
6
|
+
|
|
7
|
+
/** Positions element C horizontally between A and B based on interpolation factor */
|
|
8
|
+
class UIHorizontalInterpolationConstraint extends UISingleParameterConstraint {
|
|
9
|
+
/**
|
|
10
|
+
* @param a First element
|
|
11
|
+
* @param b Second element
|
|
12
|
+
* @param c Element to position between A and B
|
|
13
|
+
* @param options Interpolation configuration
|
|
14
|
+
*/
|
|
15
|
+
constructor(_private_a, _private_b, _private_c, options = {}) {
|
|
16
|
+
if (options.anchorA !== undefined) {
|
|
17
|
+
assertValidNumber(options.anchorA, "UIHorizontalInterpolationConstraint.constructor.options.anchorA");
|
|
18
|
+
}
|
|
19
|
+
if (options.anchorB !== undefined) {
|
|
20
|
+
assertValidNumber(options.anchorB, "UIHorizontalInterpolationConstraint.constructor.options.anchorB");
|
|
21
|
+
}
|
|
22
|
+
if (options.anchorC !== undefined) {
|
|
23
|
+
assertValidNumber(options.anchorC, "UIHorizontalInterpolationConstraint.constructor.options.anchorC");
|
|
24
|
+
}
|
|
25
|
+
if (options.t !== undefined) {
|
|
26
|
+
assertValidNumber(options.t, "UIHorizontalInterpolationConstraint.constructor.options.t");
|
|
27
|
+
}
|
|
28
|
+
const anchorA = options.anchorA ?? DEFAULT_ANCHOR;
|
|
29
|
+
const anchorB = options.anchorB ?? DEFAULT_ANCHOR;
|
|
30
|
+
super(assertValidInterpolationConstraintArguments("UIHorizontalInterpolationConstraint.constructor", _private_a, _private_b, _private_c, anchorA, anchorB), options);
|
|
31
|
+
this._private_a = _private_a;
|
|
32
|
+
this._private_b = _private_b;
|
|
33
|
+
this._private_c = _private_c;
|
|
34
|
+
this._private_anchorAInternal = anchorA;
|
|
35
|
+
this._private_anchorBInternal = anchorA;
|
|
36
|
+
this._private_anchorCInternal = options.anchorC ?? DEFAULT_ANCHOR;
|
|
37
|
+
this._private_tInternal = options.t ?? DEFAULT_T;
|
|
38
|
+
this.constraint = this.solverWrapper.createConstraint(this._private_buildLHS(), new UIExpression(0), this.relation, this.priority, this.isConstraintEnabled());
|
|
39
|
+
}
|
|
40
|
+
/** Interpolation factor (0 = A position, 1 = B position) */
|
|
41
|
+
get t() {
|
|
42
|
+
return this._private_tInternal;
|
|
43
|
+
}
|
|
44
|
+
/** Anchor on element A (0 = left, 0.5 = center, 1 = right) */
|
|
45
|
+
get anchorA() {
|
|
46
|
+
return this._private_anchorAInternal;
|
|
47
|
+
}
|
|
48
|
+
/** Anchor on element B (0 = left, 0.5 = center, 1 = right) */
|
|
49
|
+
get anchorB() {
|
|
50
|
+
return this._private_anchorBInternal;
|
|
51
|
+
}
|
|
52
|
+
/** Anchor on element C (0 = left, 0.5 = center, 1 = right) */
|
|
53
|
+
get anchorC() {
|
|
54
|
+
return this._private_anchorCInternal;
|
|
55
|
+
}
|
|
56
|
+
/** Updates interpolation factor */
|
|
57
|
+
set t(value) {
|
|
58
|
+
assertValidNumber(value, "UIHorizontalInterpolationConstraint.t");
|
|
59
|
+
if (this._private_tInternal !== value) {
|
|
60
|
+
this._private_tInternal = value;
|
|
61
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Updates anchor on element A */
|
|
65
|
+
set anchorA(value) {
|
|
66
|
+
assertValidNumber(value, "UIHorizontalInterpolationConstraint.anchorA");
|
|
67
|
+
if (this._private_anchorAInternal !== value) {
|
|
68
|
+
this._private_anchorAInternal = value;
|
|
69
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Updates anchor on element B */
|
|
73
|
+
set anchorB(value) {
|
|
74
|
+
assertValidNumber(value, "UIHorizontalInterpolationConstraint.anchorB");
|
|
75
|
+
if (this._private_anchorBInternal !== value) {
|
|
76
|
+
this._private_anchorBInternal = value;
|
|
77
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Updates anchor on element C */
|
|
81
|
+
set anchorC(value) {
|
|
82
|
+
assertValidNumber(value, "UIHorizontalInterpolationConstraint.anchorC");
|
|
83
|
+
if (this._private_anchorCInternal !== value) {
|
|
84
|
+
this._private_anchorCInternal = value;
|
|
85
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Builds constraint expression: C - A*(1-t) - B*t = 0 */
|
|
89
|
+
_private_buildLHS() {
|
|
90
|
+
let aExpression;
|
|
91
|
+
let bExpression;
|
|
92
|
+
let cExpression;
|
|
93
|
+
if (isUIPlaneElement(this._private_a)) {
|
|
94
|
+
aExpression = new UIExpression(0, [
|
|
95
|
+
[this._private_a.xVariable, 1],
|
|
96
|
+
[this._private_a.wVariable, this._private_anchorAInternal],
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
else if (isUIPointElement(this._private_a)) {
|
|
100
|
+
aExpression = new UIExpression().plus(this._private_a.xVariable, 1);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.a: invalid element type");
|
|
104
|
+
}
|
|
105
|
+
if (isUIPlaneElement(this._private_b)) {
|
|
106
|
+
bExpression = new UIExpression(0, [
|
|
107
|
+
[this._private_b.xVariable, 1],
|
|
108
|
+
[this._private_b.wVariable, this._private_anchorBInternal],
|
|
109
|
+
]);
|
|
110
|
+
}
|
|
111
|
+
else if (isUIPointElement(this._private_b)) {
|
|
112
|
+
bExpression = new UIExpression().plus(this._private_b.xVariable, 1);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.b: invalid element type");
|
|
116
|
+
}
|
|
117
|
+
if (isUIPlaneElement(this._private_c)) {
|
|
118
|
+
cExpression = new UIExpression(0, [
|
|
119
|
+
[this._private_c.xVariable, 1],
|
|
120
|
+
[this._private_c.wVariable, this._private_anchorCInternal],
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
else if (isUIPointElement(this._private_c)) {
|
|
124
|
+
cExpression = new UIExpression().plus(this._private_c.xVariable, 1);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
throw new Error("UIHorizontalInterpolationConstraint.buildLHS.c: invalid element type");
|
|
128
|
+
}
|
|
129
|
+
// C - A*(1-t) - B*t = 0
|
|
130
|
+
const aScaled = aExpression.clone().multiply(1 - this._private_tInternal);
|
|
131
|
+
const bScaled = bExpression.clone().multiply(this._private_tInternal);
|
|
132
|
+
return UIExpression.minus(UIExpression.minus(cExpression, aScaled), bScaled);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { UIHorizontalInterpolationConstraint };
|
package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { assertValidPositiveNumber, assertValidConstraintArguments } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIExpression } from '../../miscellaneous/UIExpression.js';
|
|
3
|
+
import { UISingleParameterConstraint } from '../UISingleParameterConstraint/UISingleParameterConstraint.js';
|
|
4
|
+
|
|
5
|
+
/** Maintains proportional width relationship (A.width * proportion = B.width) */
|
|
6
|
+
class UIHorizontalProportionConstraint extends UISingleParameterConstraint {
|
|
7
|
+
/**
|
|
8
|
+
* @param a First element
|
|
9
|
+
* @param b Second element
|
|
10
|
+
* @param options Proportion configuration
|
|
11
|
+
*/
|
|
12
|
+
constructor(_private_a, _private_b, options = {}) {
|
|
13
|
+
if (options.proportion !== undefined) {
|
|
14
|
+
assertValidPositiveNumber(options.proportion, "UIHorizontalProportionConstraint.constructor.options.proportion");
|
|
15
|
+
}
|
|
16
|
+
super(assertValidConstraintArguments(_private_a, _private_b, "UIHorizontalProportionConstraint.constructor"), options);
|
|
17
|
+
this._private_a = _private_a;
|
|
18
|
+
this._private_b = _private_b;
|
|
19
|
+
this._private_proportionInternal = options.proportion ?? 1;
|
|
20
|
+
this.constraint = this.solverWrapper.createConstraint(new UIExpression(0), this._private_buildRHS(), this.relation, this.priority, this.isConstraintEnabled());
|
|
21
|
+
}
|
|
22
|
+
/** Current proportion multiplier */
|
|
23
|
+
get proportion() {
|
|
24
|
+
return this._private_proportionInternal;
|
|
25
|
+
}
|
|
26
|
+
/** Updates proportion multiplier */
|
|
27
|
+
set proportion(value) {
|
|
28
|
+
assertValidPositiveNumber(value, "UIHorizontalProportionConstraint.proportion");
|
|
29
|
+
if (this._private_proportionInternal !== value) {
|
|
30
|
+
this._private_proportionInternal = value;
|
|
31
|
+
this.solverWrapper.setConstraintRHS(this.constraint, this._private_buildRHS());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Builds constraint expression for proportional relationship */
|
|
35
|
+
_private_buildRHS() {
|
|
36
|
+
return UIExpression.minus(new UIExpression(0, [[this._private_a.wVariable, this._private_proportionInternal]]), new UIExpression(0, [[this._private_b.wVariable, 1]]));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { UIHorizontalProportionConstraint };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { resolveOrientation, UIOrientation } from '../../miscellaneous/UIOrientation.js';
|
|
2
|
+
import { resolvePriority } from '../../miscellaneous/UIPriority.js';
|
|
3
|
+
import { resolveRelation } from '../../miscellaneous/UIRelation.js';
|
|
4
|
+
import { UIConstraint } from '../UIConstraint.js';
|
|
5
|
+
|
|
6
|
+
/** Base class for constraints with priority, relation, and orientation */
|
|
7
|
+
class UISingleParameterConstraint extends UIConstraint {
|
|
8
|
+
/**
|
|
9
|
+
* @param layer Layer containing this constraint
|
|
10
|
+
* @param options Constraint configuration
|
|
11
|
+
*/
|
|
12
|
+
constructor(layer, options) {
|
|
13
|
+
super(layer, options?.name);
|
|
14
|
+
/** Updates constraint enabled state when layer orientation changes */
|
|
15
|
+
this._private_onOrientationChange = () => {
|
|
16
|
+
this.solverWrapper.setConstraintEnabled(this.constraint, this.isConstraintEnabled());
|
|
17
|
+
};
|
|
18
|
+
this._private_priorityInternal = resolvePriority(options?.priority);
|
|
19
|
+
this._private_relationInternal = resolveRelation(options?.relation);
|
|
20
|
+
this._private_orientationInternal = resolveOrientation(options?.orientation);
|
|
21
|
+
this.layer.signalOrientationChanged.on(this._private_onOrientationChange);
|
|
22
|
+
}
|
|
23
|
+
/** Constraint priority */
|
|
24
|
+
get priority() {
|
|
25
|
+
return this._private_priorityInternal;
|
|
26
|
+
}
|
|
27
|
+
/** Constraint relation */
|
|
28
|
+
get relation() {
|
|
29
|
+
return this._private_relationInternal;
|
|
30
|
+
}
|
|
31
|
+
/** When constraint is active */
|
|
32
|
+
get orientation() {
|
|
33
|
+
return this._private_orientationInternal;
|
|
34
|
+
}
|
|
35
|
+
/** Updates constraint priority */
|
|
36
|
+
set priority(value) {
|
|
37
|
+
if (value !== this._private_priorityInternal) {
|
|
38
|
+
this._private_priorityInternal = value;
|
|
39
|
+
this.solverWrapper.setConstraintPriority(this.constraint, this._private_priorityInternal);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Updates constraint relation */
|
|
43
|
+
set relation(value) {
|
|
44
|
+
if (value !== this._private_relationInternal) {
|
|
45
|
+
this._private_relationInternal = value;
|
|
46
|
+
this.solverWrapper.setConstraintRelation(this.constraint, this._private_relationInternal);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** Updates when constraint is active */
|
|
50
|
+
set orientation(value) {
|
|
51
|
+
if (value !== this._private_orientationInternal) {
|
|
52
|
+
this._private_orientationInternal = value;
|
|
53
|
+
this._private_onOrientationChange();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Removes constraint from solver and cleans up listeners */
|
|
57
|
+
destroy() {
|
|
58
|
+
this.layer.signalOrientationChanged.off(this._private_onOrientationChange);
|
|
59
|
+
this.solverWrapper.removeConstraint(this.constraint);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Checks if constraint should be active for current orientation.
|
|
63
|
+
* @returns True if orientation is ALWAYS or matches layer orientation
|
|
64
|
+
*/
|
|
65
|
+
isConstraintEnabled() {
|
|
66
|
+
return (this._private_orientationInternal === UIOrientation.ALWAYS ||
|
|
67
|
+
this._private_orientationInternal === this.layer.orientation);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { UISingleParameterConstraint };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { assertValidNumber, assertValidConstraintArguments } 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 './UIVerticalDistanceConstraint.Internal.js';
|
|
6
|
+
|
|
7
|
+
/** Maintains vertical distance between elements with configurable anchors */
|
|
8
|
+
class UIVerticalDistanceConstraint extends UISingleParameterConstraint {
|
|
9
|
+
/**
|
|
10
|
+
* @param a First element
|
|
11
|
+
* @param b Second element
|
|
12
|
+
* @param options Distance configuration
|
|
13
|
+
*/
|
|
14
|
+
constructor(_private_a, _private_b, options = {}) {
|
|
15
|
+
if (options.anchorA !== undefined) {
|
|
16
|
+
assertValidNumber(options.anchorA, "UIVerticalDistanceConstraint.constructor.options.anchorA");
|
|
17
|
+
}
|
|
18
|
+
if (options.anchorB !== undefined) {
|
|
19
|
+
assertValidNumber(options.anchorB, "UIVerticalDistanceConstraint.constructor.options.anchorB");
|
|
20
|
+
}
|
|
21
|
+
if (options.distance !== undefined) {
|
|
22
|
+
assertValidNumber(options.distance, "UIVerticalDistanceConstraint.constructor.options.distance");
|
|
23
|
+
}
|
|
24
|
+
super(assertValidConstraintArguments(_private_a, _private_b, "UIVerticalDistanceConstraint.constructor"), options);
|
|
25
|
+
this._private_a = _private_a;
|
|
26
|
+
this._private_b = _private_b;
|
|
27
|
+
this._private_anchorAInternal = options.anchorA ?? DEFAULT_ANCHOR;
|
|
28
|
+
this._private_anchorBInternal = options.anchorB ?? DEFAULT_ANCHOR;
|
|
29
|
+
this._private_distanceInternal = options.distance ?? 0;
|
|
30
|
+
this.constraint = this.solverWrapper.createConstraint(this._private_buildLHS(), new UIExpression(this._private_distanceInternal), this.relation, this.priority, this.isConstraintEnabled());
|
|
31
|
+
}
|
|
32
|
+
/** Current distance in world units */
|
|
33
|
+
get distance() {
|
|
34
|
+
return this._private_distanceInternal;
|
|
35
|
+
}
|
|
36
|
+
/** Anchor on element A (0 = bottom, 0.5 = center, 1 = top) */
|
|
37
|
+
get anchorA() {
|
|
38
|
+
return this._private_anchorAInternal;
|
|
39
|
+
}
|
|
40
|
+
/** Anchor on element B (0 = bottom, 0.5 = center, 1 = top) */
|
|
41
|
+
get anchorB() {
|
|
42
|
+
return this._private_anchorBInternal;
|
|
43
|
+
}
|
|
44
|
+
/** Updates distance */
|
|
45
|
+
set distance(value) {
|
|
46
|
+
assertValidNumber(value, "UIVerticalDistanceConstraint.distance");
|
|
47
|
+
if (this._private_distanceInternal !== value) {
|
|
48
|
+
this._private_distanceInternal = value;
|
|
49
|
+
this.solverWrapper.setConstraintRHS(this.constraint, new UIExpression(this._private_distanceInternal));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** Updates anchor on element A */
|
|
53
|
+
set anchorA(value) {
|
|
54
|
+
assertValidNumber(value, "UIVerticalDistanceConstraint.anchorA");
|
|
55
|
+
if (this._private_anchorAInternal !== value) {
|
|
56
|
+
this._private_anchorAInternal = value;
|
|
57
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Updates anchor on element B */
|
|
61
|
+
set anchorB(value) {
|
|
62
|
+
assertValidNumber(value, "UIVerticalDistanceConstraint.anchorB");
|
|
63
|
+
if (this._private_anchorBInternal !== value) {
|
|
64
|
+
this._private_anchorBInternal = value;
|
|
65
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Builds constraint expression for distance between anchored positions */
|
|
69
|
+
_private_buildLHS() {
|
|
70
|
+
let aExpression;
|
|
71
|
+
let bExpression;
|
|
72
|
+
if (isUIPlaneElement(this._private_a)) {
|
|
73
|
+
aExpression = new UIExpression(0, [
|
|
74
|
+
[this._private_a.yVariable, 1],
|
|
75
|
+
[this._private_a.hVariable, this._private_anchorAInternal],
|
|
76
|
+
]);
|
|
77
|
+
}
|
|
78
|
+
else if (isUIPointElement(this._private_a)) {
|
|
79
|
+
aExpression = new UIExpression().plus(this._private_a.yVariable, 1);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
throw new Error("UIVerticalDistanceConstraint.buildLHS.a: invalid element type");
|
|
83
|
+
}
|
|
84
|
+
if (isUIPlaneElement(this._private_b)) {
|
|
85
|
+
bExpression = new UIExpression(0, [
|
|
86
|
+
[this._private_b.yVariable, 1],
|
|
87
|
+
[this._private_b.hVariable, this._private_anchorBInternal],
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
else if (isUIPointElement(this._private_b)) {
|
|
91
|
+
bExpression = new UIExpression().plus(this._private_b.yVariable, 1);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
throw new Error("UIVerticalDistanceConstraint.buildLHS.b: invalid element type");
|
|
95
|
+
}
|
|
96
|
+
return UIExpression.minus(bExpression, aExpression);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { UIVerticalDistanceConstraint };
|
package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { assertValidNumber, assertValidInterpolationConstraintArguments } 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 './UIVerticalInterpolationConstraint.Internal.js';
|
|
6
|
+
|
|
7
|
+
/** Positions element C vertically between A and B based on interpolation factor */
|
|
8
|
+
class UIVerticalInterpolationConstraint extends UISingleParameterConstraint {
|
|
9
|
+
/**
|
|
10
|
+
* @param a First element
|
|
11
|
+
* @param b Second element
|
|
12
|
+
* @param c Element to position between A and B
|
|
13
|
+
* @param options Interpolation configuration
|
|
14
|
+
*/
|
|
15
|
+
constructor(_private_a, _private_b, _private_c, options = {}) {
|
|
16
|
+
if (options.anchorA !== undefined) {
|
|
17
|
+
assertValidNumber(options.anchorA, "UIVerticalInterpolationConstraint.constructor.options.anchorA");
|
|
18
|
+
}
|
|
19
|
+
if (options.anchorB !== undefined) {
|
|
20
|
+
assertValidNumber(options.anchorB, "UIVerticalInterpolationConstraint.constructor.options.anchorB");
|
|
21
|
+
}
|
|
22
|
+
if (options.anchorC !== undefined) {
|
|
23
|
+
assertValidNumber(options.anchorC, "UIVerticalInterpolationConstraint.constructor.options.anchorC");
|
|
24
|
+
}
|
|
25
|
+
if (options.t !== undefined) {
|
|
26
|
+
assertValidNumber(options.t, "UIVerticalInterpolationConstraint.constructor.options.t");
|
|
27
|
+
}
|
|
28
|
+
const anchorA = options.anchorA ?? DEFAULT_ANCHOR;
|
|
29
|
+
const anchorB = options.anchorB ?? DEFAULT_ANCHOR;
|
|
30
|
+
super(assertValidInterpolationConstraintArguments("UIVerticalInterpolationConstraint.constructor", _private_a, _private_b, _private_c, anchorA, anchorB), options);
|
|
31
|
+
this._private_a = _private_a;
|
|
32
|
+
this._private_b = _private_b;
|
|
33
|
+
this._private_c = _private_c;
|
|
34
|
+
this._private_anchorAInternal = anchorA;
|
|
35
|
+
this._private_anchorBInternal = anchorA;
|
|
36
|
+
this._private_anchorCInternal = options.anchorC ?? DEFAULT_ANCHOR;
|
|
37
|
+
this._private_tInternal = options.t ?? DEFAULT_T;
|
|
38
|
+
this.constraint = this.solverWrapper.createConstraint(this._private_buildLHS(), new UIExpression(0), this.relation, this.priority, this.isConstraintEnabled());
|
|
39
|
+
}
|
|
40
|
+
/** Interpolation factor (0 = A position, 1 = B position) */
|
|
41
|
+
get t() {
|
|
42
|
+
return this._private_tInternal;
|
|
43
|
+
}
|
|
44
|
+
/** Anchor on element A (0 = bottom, 0.5 = center, 1 = top) */
|
|
45
|
+
get anchorA() {
|
|
46
|
+
return this._private_anchorAInternal;
|
|
47
|
+
}
|
|
48
|
+
/** Anchor on element B (0 = bottom, 0.5 = center, 1 = top) */
|
|
49
|
+
get anchorB() {
|
|
50
|
+
return this._private_anchorBInternal;
|
|
51
|
+
}
|
|
52
|
+
/** Anchor on element C (0 = bottom, 0.5 = center, 1 = top) */
|
|
53
|
+
get anchorC() {
|
|
54
|
+
return this._private_anchorCInternal;
|
|
55
|
+
}
|
|
56
|
+
/** Updates interpolation factor */
|
|
57
|
+
set t(value) {
|
|
58
|
+
assertValidNumber(value, "UIVerticalInterpolationConstraint.t");
|
|
59
|
+
if (this._private_tInternal !== value) {
|
|
60
|
+
this._private_tInternal = value;
|
|
61
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Updates anchor on element A */
|
|
65
|
+
set anchorA(value) {
|
|
66
|
+
assertValidNumber(value, "UIVerticalInterpolationConstraint.anchorA");
|
|
67
|
+
if (this._private_anchorAInternal !== value) {
|
|
68
|
+
this._private_anchorAInternal = value;
|
|
69
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Updates anchor on element B */
|
|
73
|
+
set anchorB(value) {
|
|
74
|
+
assertValidNumber(value, "UIVerticalInterpolationConstraint.anchorB");
|
|
75
|
+
if (this._private_anchorBInternal !== value) {
|
|
76
|
+
this._private_anchorBInternal = value;
|
|
77
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Updates anchor on element C */
|
|
81
|
+
set anchorC(value) {
|
|
82
|
+
assertValidNumber(value, "UIVerticalInterpolationConstraint.anchorC");
|
|
83
|
+
if (this._private_anchorCInternal !== value) {
|
|
84
|
+
this._private_anchorCInternal = value;
|
|
85
|
+
this.solverWrapper.setConstraintLHS(this.constraint, this._private_buildLHS());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Builds constraint expression: C - A*(1-t) - B*t = 0 */
|
|
89
|
+
_private_buildLHS() {
|
|
90
|
+
let aExpression;
|
|
91
|
+
let bExpression;
|
|
92
|
+
let cExpression;
|
|
93
|
+
if (isUIPlaneElement(this._private_a)) {
|
|
94
|
+
aExpression = new UIExpression(0, [
|
|
95
|
+
[this._private_a.yVariable, 1],
|
|
96
|
+
[this._private_a.hVariable, this._private_anchorAInternal],
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
else if (isUIPointElement(this._private_a)) {
|
|
100
|
+
aExpression = new UIExpression().plus(this._private_a.yVariable, 1);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
throw new Error("UIVerticalInterpolationConstraint.buildLHS.a: invalid element type");
|
|
104
|
+
}
|
|
105
|
+
if (isUIPlaneElement(this._private_b)) {
|
|
106
|
+
bExpression = new UIExpression(0, [
|
|
107
|
+
[this._private_b.yVariable, 1],
|
|
108
|
+
[this._private_b.hVariable, this._private_anchorBInternal],
|
|
109
|
+
]);
|
|
110
|
+
}
|
|
111
|
+
else if (isUIPointElement(this._private_b)) {
|
|
112
|
+
bExpression = new UIExpression().plus(this._private_b.yVariable, 1);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
throw new Error("UIVerticalInterpolationConstraint.buildLHS.b: invalid element type");
|
|
116
|
+
}
|
|
117
|
+
if (isUIPlaneElement(this._private_c)) {
|
|
118
|
+
cExpression = new UIExpression(0, [
|
|
119
|
+
[this._private_c.yVariable, 1],
|
|
120
|
+
[this._private_c.hVariable, this._private_anchorCInternal],
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
else if (isUIPointElement(this._private_c)) {
|
|
124
|
+
cExpression = new UIExpression().plus(this._private_c.yVariable, 1);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
throw new Error("UIVerticalInterpolationConstraint.buildLHS.c: invalid element type");
|
|
128
|
+
}
|
|
129
|
+
// C - A*(1-t) - B*t = 0
|
|
130
|
+
const aScaled = aExpression.clone().multiply(1 - this._private_tInternal);
|
|
131
|
+
const bScaled = bExpression.clone().multiply(this._private_tInternal);
|
|
132
|
+
return UIExpression.minus(UIExpression.minus(cExpression, aScaled), bScaled);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { UIVerticalInterpolationConstraint };
|
package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { assertValidPositiveNumber, assertValidConstraintArguments } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIExpression } from '../../miscellaneous/UIExpression.js';
|
|
3
|
+
import { UISingleParameterConstraint } from '../UISingleParameterConstraint/UISingleParameterConstraint.js';
|
|
4
|
+
|
|
5
|
+
/** Maintains proportional height relationship (A.height * proportion = B.height) */
|
|
6
|
+
class UIVerticalProportionConstraint extends UISingleParameterConstraint {
|
|
7
|
+
/**
|
|
8
|
+
* @param a First element
|
|
9
|
+
* @param b Second element
|
|
10
|
+
* @param options Proportion configuration
|
|
11
|
+
*/
|
|
12
|
+
constructor(_private_a, _private_b, options = {}) {
|
|
13
|
+
if (options.proportion !== undefined) {
|
|
14
|
+
assertValidPositiveNumber(options.proportion, "UIVerticalProportionConstraint.constructor.options.proportion");
|
|
15
|
+
}
|
|
16
|
+
super(assertValidConstraintArguments(_private_a, _private_b, "UIVerticalProportionConstraint.constructor"), options);
|
|
17
|
+
this._private_a = _private_a;
|
|
18
|
+
this._private_b = _private_b;
|
|
19
|
+
this._private_proportionInternal = options.proportion ?? 1;
|
|
20
|
+
this.constraint = this.solverWrapper.createConstraint(new UIExpression(0), this._private_buildRHS(), this.relation, this.priority, this.isConstraintEnabled());
|
|
21
|
+
}
|
|
22
|
+
/** Current proportion multiplier */
|
|
23
|
+
get proportion() {
|
|
24
|
+
return this._private_proportionInternal;
|
|
25
|
+
}
|
|
26
|
+
/** Updates proportion multiplier */
|
|
27
|
+
set proportion(value) {
|
|
28
|
+
assertValidPositiveNumber(value, "UIVerticalProportionConstraint.proportion");
|
|
29
|
+
if (this._private_proportionInternal !== value) {
|
|
30
|
+
this._private_proportionInternal = value;
|
|
31
|
+
this.solverWrapper.setConstraintRHS(this.constraint, this._private_buildRHS());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Builds constraint expression for proportional relationship */
|
|
35
|
+
_private_buildRHS() {
|
|
36
|
+
return UIExpression.minus(new UIExpression(0, [[this._private_a.hVariable, this._private_proportionInternal]]), new UIExpression(0, [[this._private_b.hVariable, 1]]));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { UIVerticalProportionConstraint };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIExpression } from '../../miscellaneous/UIExpression.js';
|
|
3
|
+
import { UISingleParameterConstraint } from '../UISingleParameterConstraint/UISingleParameterConstraint.js';
|
|
4
|
+
|
|
5
|
+
/** Fixes element width to constant value */
|
|
6
|
+
class UIWidthConstraint extends UISingleParameterConstraint {
|
|
7
|
+
/**
|
|
8
|
+
* @param element Element to constrain
|
|
9
|
+
* @param options Width configuration. Defaults to element's current width.
|
|
10
|
+
*/
|
|
11
|
+
constructor(_private_element, options = {}) {
|
|
12
|
+
if (options.width !== undefined) {
|
|
13
|
+
assertValidPositiveNumber(options.width, "UIWidthConstraint.constructor.options.width");
|
|
14
|
+
}
|
|
15
|
+
super(_private_element.layer, options);
|
|
16
|
+
this._private_element = _private_element;
|
|
17
|
+
this._private_widthInternal = options.width ?? _private_element.width;
|
|
18
|
+
this.constraint = this.solverWrapper.createConstraint(new UIExpression(0, [[this._private_element.wVariable, 1]]), new UIExpression(this._private_widthInternal), this.relation, this.priority, this.isConstraintEnabled());
|
|
19
|
+
}
|
|
20
|
+
/** Current width in world units */
|
|
21
|
+
get width() {
|
|
22
|
+
return this._private_widthInternal;
|
|
23
|
+
}
|
|
24
|
+
/** Updates width */
|
|
25
|
+
set width(value) {
|
|
26
|
+
assertValidPositiveNumber(value, "UIWidthConstraint.width");
|
|
27
|
+
if (this._private_widthInternal !== value) {
|
|
28
|
+
this._private_widthInternal = value;
|
|
29
|
+
this.solverWrapper.setConstraintRHS(this.constraint, new UIExpression(value));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { UIWidthConstraint };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes UIType2D input to object form.
|
|
3
|
+
* @param value Object, tuple, or single value
|
|
4
|
+
* @returns Normalized object with h and v properties
|
|
5
|
+
*/
|
|
6
|
+
function normalizeUIType2D(value) {
|
|
7
|
+
if (value === undefined) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
return { h: value[0], v: value[1] };
|
|
12
|
+
}
|
|
13
|
+
if (typeof value === "object" && value !== null && ("h" in value || "v" in value)) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
return { h: value, v: value };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { normalizeUIType2D };
|