laymur 0.17.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/{src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts → dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +22 -0
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
- package/dist/core/constraints/UIConstraint.d.ts +12 -0
- package/dist/core/constraints/UIConstraint.js +11 -0
- package/dist/core/constraints/UICustomConstraint.d.ts +28 -0
- package/dist/core/constraints/UICustomConstraint.js +37 -0
- package/{src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts → dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +20 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +11 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +36 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +14 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +44 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
- package/{src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts → dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +22 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
- package/{src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts → dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts} +8 -9
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +43 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +11 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +32 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +14 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +44 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
- package/{src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts → dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +22 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
- package/{src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts → dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +20 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +64 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +46 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +13 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +29 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +13 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +29 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.d.ts +12 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +32 -0
- package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +27 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +77 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +30 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
- package/dist/core/elements/UIDummy/UIDummy.d.ts +82 -0
- package/dist/core/elements/UIDummy/UIDummy.js +173 -0
- package/{src/core/elements/UIElement/UIElement.Internal.ts → dist/core/elements/UIElement/UIElement.Internal.d.ts} +5 -7
- package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
- package/dist/core/elements/UIElement/UIElement.d.ts +38 -0
- package/dist/core/elements/UIElement/UIElement.js +74 -0
- package/{src/core/elements/UIGraphics/UIGraphics.Internal.ts → dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts} +5 -7
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +51 -0
- package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
- package/{src/core/elements/UIImage/UIImage.Internal.ts → dist/core/elements/UIImage/UIImage.Internal.d.ts} +2 -3
- package/dist/core/elements/UIImage/UIImage.d.ts +32 -0
- package/dist/core/elements/UIImage/UIImage.js +85 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +23 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +60 -0
- package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +14 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
- package/dist/core/elements/UIProgress/UIProgress.d.ts +45 -0
- package/dist/core/elements/UIProgress/UIProgress.js +165 -0
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +43 -0
- package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
- package/dist/core/elements/UIScene/UIScene.d.ts +59 -0
- package/dist/core/elements/UIScene/UIScene.js +157 -0
- package/{src/core/elements/UIText/UIText.Interfaces.ts → dist/core/elements/UIText/UIText.Interfaces.d.ts} +16 -21
- package/dist/core/elements/UIText/UIText.Internal.d.ts +26 -0
- package/dist/core/elements/UIText/UIText.Internal.js +12 -0
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +50 -0
- package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +20 -0
- package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
- package/dist/core/elements/UIText/UIText.d.ts +71 -0
- package/dist/core/elements/UIText/UIText.js +265 -0
- package/{src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts → dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts} +11 -14
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +63 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
- package/{src/core/layers/UILayer/UILayer.Internal.ts → dist/core/layers/UILayer/UILayer.Internal.d.ts} +11 -15
- package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
- package/dist/core/layers/UILayer/UILayer.d.ts +49 -0
- package/dist/core/layers/UILayer/UILayer.js +113 -0
- package/dist/core/miscellaneous/UIExpression.d.ts +69 -0
- package/dist/core/miscellaneous/UIExpression.js +128 -0
- package/dist/core/miscellaneous/UIMode.d.ts +23 -0
- package/dist/core/miscellaneous/UIMode.js +30 -0
- package/dist/core/miscellaneous/UIOrientation.d.ts +15 -0
- package/dist/core/miscellaneous/UIOrientation.js +20 -0
- package/dist/core/miscellaneous/UIPriority.d.ts +32 -0
- package/dist/core/miscellaneous/UIPriority.js +63 -0
- package/dist/core/miscellaneous/UIRelation.d.ts +23 -0
- package/dist/core/miscellaneous/UIRelation.js +40 -0
- package/dist/core/miscellaneous/UITransparencyMode.d.ts +9 -0
- package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
- package/dist/core/miscellaneous/area/UIArea.d.ts +3 -0
- package/dist/core/miscellaneous/area/UIArea.js +5 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +15 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +12 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +17 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +21 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
- package/dist/core/miscellaneous/asserts.d.ts +43 -0
- package/dist/core/miscellaneous/asserts.js +163 -0
- package/dist/core/miscellaneous/canvas.d.ts +31 -0
- package/dist/core/miscellaneous/canvas.js +37 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +7 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
- package/dist/core/miscellaneous/color/UIColor.d.ts +234 -0
- package/dist/core/miscellaneous/color/UIColor.js +636 -0
- package/dist/core/miscellaneous/computeTransform.d.ts +18 -0
- package/dist/core/miscellaneous/computeTransform.js +82 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +19 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
- package/{src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts → dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts} +8 -10
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +38 -0
- package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.d.ts +11 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +48 -0
- package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +9 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +21 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +16 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
- package/dist/core/miscellaneous/math.d.ts +7 -0
- package/dist/core/miscellaneous/math.js +11 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.d.ts +31 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +59 -0
- package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.d.ts +3 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +5 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
- package/dist/core/miscellaneous/shared.d.ts +46 -0
- package/dist/core/miscellaneous/shared.js +37 -0
- package/{src/core/miscellaneous/text-span/UITextSpan.Internal.ts → dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts} +4 -5
- package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +14 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.d.ts +48 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +85 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +49 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +67 -0
- package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
- package/dist/core/miscellaneous/webglCapabilities.d.ts +2 -0
- package/dist/core/miscellaneous/webglCapabilities.js +103 -0
- package/dist/core/shaders/UIImage.glsl.js +3 -0
- package/dist/core/shaders/UINineSlice.glsl.js +3 -0
- package/dist/core/shaders/UIProgress.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +17 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +13 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +13 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +20 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +49 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +215 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
- package/dist/index.js +51 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
- package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
- package/dist/particles/elements/UIEmitter.Internal.js +11 -0
- package/dist/particles/elements/UIEmitter.d.ts +68 -0
- package/dist/particles/elements/UIEmitter.js +203 -0
- package/dist/particles/index.js +18 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
- package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
- package/dist/particles/miscellaneous/miscellaneous.js +67 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
- package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
- package/dist/particles/spawnModules/UISpawnModule.js +9 -0
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
- package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
- package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
- package/package.json +8 -1
- package/.claude/settings.local.json +0 -9
- package/.editorconfig +0 -14
- package/CLAUDE.md +0 -181
- package/assets/logotype.png +0 -0
- package/eslint.config.js +0 -111
- package/rollup.config.js +0 -52
- package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +0 -60
- package/src/core/constraints/UIConstraint.ts +0 -20
- package/src/core/constraints/UICustomConstraint.ts +0 -62
- package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +0 -52
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +0 -13
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +0 -139
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +0 -16
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +0 -189
- package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +0 -68
- package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +0 -94
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +0 -13
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +0 -135
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +0 -16
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +0 -189
- package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +0 -68
- package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +0 -52
- package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +0 -84
- package/src/core/constraints/builders/UIConstraint2DBuilder.ts +0 -168
- package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +0 -15
- package/src/core/constraints/builders/UICoverConstraintBuilder.ts +0 -84
- package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +0 -15
- package/src/core/constraints/builders/UIFitConstraintBuilder.ts +0 -84
- package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +0 -13
- package/src/core/elements/UIAnchor/UIAnchor.ts +0 -70
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +0 -30
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +0 -355
- package/src/core/elements/UIDummy/UIDummy.Internal.ts +0 -33
- package/src/core/elements/UIDummy/UIDummy.ts +0 -244
- package/src/core/elements/UIElement/UIElement.ts +0 -127
- package/src/core/elements/UIGraphics/UIGraphics.ts +0 -168
- package/src/core/elements/UIImage/UIImage.ts +0 -138
- package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +0 -26
- package/src/core/elements/UINineSlice/UINineSlice.ts +0 -296
- package/src/core/elements/UIProgress/UIProgress.Internal.ts +0 -24
- package/src/core/elements/UIProgress/UIProgress.ts +0 -259
- package/src/core/elements/UIScene/UIScene.Internal.ts +0 -46
- package/src/core/elements/UIScene/UIScene.ts +0 -259
- package/src/core/elements/UIText/UIText.Internal.ts +0 -29
- package/src/core/elements/UIText/UIText.Measuring.ts +0 -183
- package/src/core/elements/UIText/UIText.Rendering.ts +0 -83
- package/src/core/elements/UIText/UIText.ts +0 -376
- package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +0 -233
- package/src/core/layers/UILayer/UILayer.ts +0 -156
- package/src/core/miscellaneous/UIExpression.ts +0 -142
- package/src/core/miscellaneous/UIMode.ts +0 -29
- package/src/core/miscellaneous/UIOrientation.ts +0 -18
- package/src/core/miscellaneous/UIPriority.ts +0 -63
- package/src/core/miscellaneous/UIRelation.ts +0 -39
- package/src/core/miscellaneous/UITransparencyMode.ts +0 -9
- package/src/core/miscellaneous/area/UIArea.ts +0 -5
- package/src/core/miscellaneous/area/UIAreaCircle.ts +0 -32
- package/src/core/miscellaneous/area/UIAreaPolygon.ts +0 -50
- package/src/core/miscellaneous/area/UIAreaRectangle.ts +0 -38
- package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +0 -78
- package/src/core/miscellaneous/asserts.ts +0 -187
- package/src/core/miscellaneous/canvas.ts +0 -73
- package/src/core/miscellaneous/color/UIColor.Internal.ts +0 -89
- package/src/core/miscellaneous/color/UIColor.ts +0 -844
- package/src/core/miscellaneous/computeTransform.ts +0 -127
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +0 -235
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +0 -524
- package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +0 -448
- package/src/core/miscellaneous/generic-plane/shared.ts +0 -323
- package/src/core/miscellaneous/insets/UIInsets.Internal.ts +0 -9
- package/src/core/miscellaneous/insets/UIInsets.ts +0 -248
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +0 -24
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +0 -58
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +0 -52
- package/src/core/miscellaneous/math.ts +0 -16
- package/src/core/miscellaneous/micro/UIMicro.Internal.ts +0 -33
- package/src/core/miscellaneous/micro/UIMicro.ts +0 -222
- package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +0 -8
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +0 -57
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +0 -57
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +0 -11
- package/src/core/miscellaneous/shared.ts +0 -73
- package/src/core/miscellaneous/text-span/UITextSpan.ts +0 -43
- package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +0 -52
- package/src/core/miscellaneous/text-style/UITextStyle.ts +0 -479
- package/src/core/miscellaneous/texture/UITextureView.Internal.ts +0 -55
- package/src/core/miscellaneous/texture/UITextureView.ts +0 -308
- package/src/core/miscellaneous/webglCapabilities.ts +0 -129
- package/src/core/shaders/UIImage.glsl +0 -10
- package/src/core/shaders/UINineSlice.glsl +0 -53
- package/src/core/shaders/UIProgress.glsl +0 -15
- package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +0 -13
- package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +0 -12
- package/src/core/shaders/glsl.d.ts +0 -27
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +0 -23
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +0 -124
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +0 -22
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +0 -101
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +0 -58
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +0 -605
- package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +0 -70
- package/src/particles/behaviorModules/UIBehaviorModule.ts +0 -20
- package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +0 -173
- package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +0 -104
- package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +0 -75
- package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +0 -115
- package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +0 -77
- package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +0 -118
- package/src/particles/elements/UIEmitter.Internal.ts +0 -22
- package/src/particles/elements/UIEmitter.ts +0 -313
- package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +0 -263
- package/src/particles/instancedParticle/UIInstancedParticle.ts +0 -138
- package/src/particles/miscellaneous/miscellaneous.ts +0 -115
- package/src/particles/renderingModules/UIRenderingColorOverLife.ts +0 -39
- package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +0 -49
- package/src/particles/renderingModules/UIRenderingModule.ts +0 -17
- package/src/particles/renderingModules/UIRenderingTexture.ts +0 -30
- package/src/particles/shaders/UIRenderingColorOverLife.glsl +0 -4
- package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +0 -6
- package/src/particles/shaders/UIRenderingTexture.glsl +0 -4
- package/src/particles/spawnModules/UISpawnModule.ts +0 -22
- package/src/particles/spawnModules/UISpawnOffset.ts +0 -62
- package/src/particles/spawnModules/UISpawnRandomLifetime.ts +0 -68
- package/src/particles/spawnModules/UISpawnRandomRotation.ts +0 -60
- package/src/particles/spawnModules/UISpawnRandomScale.ts +0 -81
- package/src/particles/spawnModules/UISpawnRandomTorque.ts +0 -62
- package/src/particles/spawnModules/UISpawnRandomVelocity.ts +0 -92
- package/src/particles/spawnModules/UISpawnRectangle.ts +0 -81
- package/tsconfig.json +0 -29
- /package/{src/core/index.ts → dist/core/index.d.ts} +0 -0
- /package/{src/particles/index.ts → dist/particles/index.d.ts} +0 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { Matrix3 } from 'three';
|
|
2
|
+
import { createCanvas, createCanvasTexture } from '../../miscellaneous/canvas.js';
|
|
3
|
+
import { UIColor } from '../../miscellaneous/color/UIColor.js';
|
|
4
|
+
import { UIInsets } from '../../miscellaneous/insets/UIInsets.js';
|
|
5
|
+
import { UITextSpan } from '../../miscellaneous/text-span/UITextSpan.js';
|
|
6
|
+
import { UITextStyle } from '../../miscellaneous/text-style/UITextStyle.js';
|
|
7
|
+
import source from '../../shaders/UIImage.glsl.js';
|
|
8
|
+
import { UIElement } from '../UIElement/UIElement.js';
|
|
9
|
+
import { TEXT_DEFAULT_MAX_LINE_WIDTH, TEXT_DEFAULT_RESIZE_MODE, UITextResizeMode } from './UIText.Internal.js';
|
|
10
|
+
import { calculateTextContentParameters, buildTextChunks } from './UIText.Measuring.js';
|
|
11
|
+
import { renderTextLines } from './UIText.Rendering.js';
|
|
12
|
+
|
|
13
|
+
/** Canvas-based text rendering element */
|
|
14
|
+
class UIText extends UIElement {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new UIText instance.
|
|
17
|
+
*
|
|
18
|
+
* @param layer - Layer containing this element
|
|
19
|
+
* @param content - Text content as string or styled spans
|
|
20
|
+
* @param options - Configuration options
|
|
21
|
+
*/
|
|
22
|
+
constructor(layer, content, options = {}) {
|
|
23
|
+
const canvas = createCanvas(2, 2);
|
|
24
|
+
const context = canvas.getContext("2d");
|
|
25
|
+
if (!context) {
|
|
26
|
+
throw new Error("UIText.constructor: failed to create canvas context");
|
|
27
|
+
}
|
|
28
|
+
const texture = createCanvasTexture(canvas);
|
|
29
|
+
texture.needsUpdate = true;
|
|
30
|
+
const color = new UIColor(options.color);
|
|
31
|
+
super(layer, source, {
|
|
32
|
+
texture: texture,
|
|
33
|
+
textureTransform: new Matrix3(),
|
|
34
|
+
color,
|
|
35
|
+
}, options);
|
|
36
|
+
this._private_contentInternal = [];
|
|
37
|
+
this._private_contentDirty = false;
|
|
38
|
+
this._private_maxLineWidthDirty = false;
|
|
39
|
+
this._private_resizeModeDirty = false;
|
|
40
|
+
this._private_textChunks = [];
|
|
41
|
+
this._private_textChunksDirty = false;
|
|
42
|
+
this._private_colorInternal = color;
|
|
43
|
+
this._private_paddingInternal = new UIInsets(options.padding);
|
|
44
|
+
this.commonStyle = new UITextStyle(options.commonStyle);
|
|
45
|
+
this._private_maxLineWidthInternal = options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
|
|
46
|
+
this._private_resizeModeInternal = options.resizeMode ?? TEXT_DEFAULT_RESIZE_MODE;
|
|
47
|
+
this._private_canvas = canvas;
|
|
48
|
+
this._private_context = context;
|
|
49
|
+
this._private_texture = texture;
|
|
50
|
+
this.content = content;
|
|
51
|
+
this._private_lastWidth = this.width;
|
|
52
|
+
this._private_lastHeight = this.height;
|
|
53
|
+
if (options.padding === undefined) {
|
|
54
|
+
this._private_paddingInternal.setUnified(this.content.reduce((a, b) => Math.max(a, b.style.calculatePadding()), this.commonStyle.calculatePadding()));
|
|
55
|
+
}
|
|
56
|
+
switch (this._private_resizeModeInternal) {
|
|
57
|
+
case UITextResizeMode.SCALE:
|
|
58
|
+
this._private_tryToRenderTextScaleMode();
|
|
59
|
+
break;
|
|
60
|
+
case UITextResizeMode.BREAK:
|
|
61
|
+
this._private_tryToRenderTextBreakMode();
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
66
|
+
get color() {
|
|
67
|
+
return this._private_colorInternal;
|
|
68
|
+
}
|
|
69
|
+
/** Text content as array of styled spans */
|
|
70
|
+
get content() {
|
|
71
|
+
return this._private_contentInternal;
|
|
72
|
+
}
|
|
73
|
+
/** Maximum line width before wrapping in pixels */
|
|
74
|
+
get maxLineWidth() {
|
|
75
|
+
return this._private_maxLineWidthInternal;
|
|
76
|
+
}
|
|
77
|
+
/** Text padding in world units */
|
|
78
|
+
get padding() {
|
|
79
|
+
return this._private_paddingInternal;
|
|
80
|
+
}
|
|
81
|
+
/** Controls how text adapts to element size */
|
|
82
|
+
get resizeMode() {
|
|
83
|
+
return this._private_resizeModeInternal;
|
|
84
|
+
}
|
|
85
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
86
|
+
set color(value) {
|
|
87
|
+
this._private_colorInternal.set(value);
|
|
88
|
+
}
|
|
89
|
+
/** Text content as string, span config, or array */
|
|
90
|
+
set content(value) {
|
|
91
|
+
if (this._private_contentInternal !== value) {
|
|
92
|
+
if (typeof value === "string") {
|
|
93
|
+
this._private_contentInternal = [new UITextSpan({ text: value, style: new UITextStyle() })];
|
|
94
|
+
}
|
|
95
|
+
else if (Array.isArray(value)) {
|
|
96
|
+
this._private_contentInternal = value.map((span) => typeof span === "string"
|
|
97
|
+
? new UITextSpan({ text: span, style: new UITextStyle() })
|
|
98
|
+
: new UITextSpan({
|
|
99
|
+
text: span.text,
|
|
100
|
+
style: new UITextStyle(span.style),
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this._private_contentInternal = [
|
|
105
|
+
new UITextSpan({
|
|
106
|
+
text: value.text,
|
|
107
|
+
style: new UITextStyle(value.style),
|
|
108
|
+
}),
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
this._private_contentDirty = true;
|
|
112
|
+
this._private_textChunksDirty = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** Maximum line width before wrapping in pixels */
|
|
116
|
+
set maxLineWidth(value) {
|
|
117
|
+
if (this._private_maxLineWidthInternal !== value) {
|
|
118
|
+
this._private_maxLineWidthInternal = value;
|
|
119
|
+
this._private_maxLineWidthDirty = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** Text padding in world units */
|
|
123
|
+
set padding(value) {
|
|
124
|
+
this._private_paddingInternal.set(value);
|
|
125
|
+
}
|
|
126
|
+
/** Controls how text adapts to size constraints */
|
|
127
|
+
set resizeMode(value) {
|
|
128
|
+
if (this._private_resizeModeInternal !== value) {
|
|
129
|
+
this._private_resizeModeInternal = value;
|
|
130
|
+
this._private_resizeModeDirty = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** Removes element and frees resources */
|
|
134
|
+
destroy() {
|
|
135
|
+
this._private_texture.dispose();
|
|
136
|
+
super.destroy();
|
|
137
|
+
}
|
|
138
|
+
onWillRender(renderer, deltaTime) {
|
|
139
|
+
switch (this._private_resizeModeInternal) {
|
|
140
|
+
case UITextResizeMode.SCALE:
|
|
141
|
+
this._private_tryToRenderTextScaleMode();
|
|
142
|
+
break;
|
|
143
|
+
case UITextResizeMode.BREAK:
|
|
144
|
+
this._private_tryToRenderTextBreakMode();
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
super.onWillRender(renderer, deltaTime);
|
|
148
|
+
}
|
|
149
|
+
_private_tryToRenderTextScaleMode() {
|
|
150
|
+
if (!this._private_colorInternal.dirty &&
|
|
151
|
+
!this._private_resizeModeDirty &&
|
|
152
|
+
!this._private_maxLineWidthDirty &&
|
|
153
|
+
!this._private_paddingInternal.dirty &&
|
|
154
|
+
!(this.solverWrapper.dirty &&
|
|
155
|
+
this._private_lastWidth / this._private_lastHeight !== Math.round(this.width) / Math.round(this.height)) &&
|
|
156
|
+
!this._private_checkContentDirty()) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const textChunks = this._private_buildTextChunks();
|
|
160
|
+
const { lines, size } = calculateTextContentParameters(textChunks, this._private_maxLineWidthInternal);
|
|
161
|
+
const paddingV = this._private_paddingInternal.top + this._private_paddingInternal.bottom;
|
|
162
|
+
const paddingH = this._private_paddingInternal.left + this._private_paddingInternal.right;
|
|
163
|
+
const desiredHeight = size.height + paddingV;
|
|
164
|
+
const desiredWidth = size.width + paddingH;
|
|
165
|
+
// Two calculation passes are required to cover both cases -
|
|
166
|
+
// when the width is specified by a constraint and cannot be changed,
|
|
167
|
+
// or when the height is specified by a constraint and cannot be changed,
|
|
168
|
+
// but the width still has priority, because it is specified first and last.
|
|
169
|
+
this.width = desiredWidth;
|
|
170
|
+
this.height = (desiredHeight / desiredWidth) * Math.round(this.width);
|
|
171
|
+
this.width = (desiredWidth / desiredHeight) * Math.round(this.height);
|
|
172
|
+
const resolutionDirty = this._private_lastWidth !== desiredHeight || this._private_lastHeight !== desiredWidth;
|
|
173
|
+
if (resolutionDirty) {
|
|
174
|
+
this._private_canvas.height = desiredHeight;
|
|
175
|
+
this._private_canvas.width = desiredWidth;
|
|
176
|
+
}
|
|
177
|
+
renderTextLines(this._private_paddingInternal.top, this._private_paddingInternal.left, lines, this._private_context);
|
|
178
|
+
this._private_updateProperties(resolutionDirty);
|
|
179
|
+
this._private_resizeModeDirty = false;
|
|
180
|
+
this._private_maxLineWidthDirty = false;
|
|
181
|
+
this._private_paddingInternal.setDirtyFalse();
|
|
182
|
+
this._private_setDimensionsDirtyFalse();
|
|
183
|
+
this._private_setContentDirtyFalse();
|
|
184
|
+
}
|
|
185
|
+
_private_tryToRenderTextBreakMode() {
|
|
186
|
+
if (!this._private_colorInternal.dirty &&
|
|
187
|
+
!this._private_resizeModeDirty &&
|
|
188
|
+
!this._private_maxLineWidthDirty &&
|
|
189
|
+
!this._private_paddingInternal.dirty &&
|
|
190
|
+
!this._private_checkDimensionsDirty() &&
|
|
191
|
+
!this._private_checkContentDirty()) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const textChunks = this._private_buildTextChunks();
|
|
195
|
+
// Two passes of text size calculation are needed to first
|
|
196
|
+
// suggest the desired sizes to the solver, and then
|
|
197
|
+
// adjust our expectations based on the result obtained.
|
|
198
|
+
const { size: desiredTextSize } = calculateTextContentParameters(textChunks, this._private_maxLineWidthInternal);
|
|
199
|
+
const paddingV = this._private_paddingInternal.top + this._private_paddingInternal.bottom;
|
|
200
|
+
const paddingH = this._private_paddingInternal.left + this._private_paddingInternal.right;
|
|
201
|
+
this.height = desiredTextSize.height + paddingV;
|
|
202
|
+
this.width = desiredTextSize.width + paddingH; // Width should remain a priority, so it is set last.
|
|
203
|
+
const { lines: realTextLines, size: realTextSize } = calculateTextContentParameters(textChunks, Math.round(this.width) - paddingH);
|
|
204
|
+
this.height = realTextSize.height + paddingV;
|
|
205
|
+
this.width = realTextSize.width + paddingH;
|
|
206
|
+
const safeWidth = Math.max(Math.round(this.width), 2);
|
|
207
|
+
const safeHeight = Math.max(Math.round(this.height), 2);
|
|
208
|
+
const resolutionDirty = this._private_lastWidth !== safeWidth || this._private_lastHeight !== safeHeight;
|
|
209
|
+
if (resolutionDirty) {
|
|
210
|
+
this._private_canvas.width = safeWidth;
|
|
211
|
+
this._private_canvas.height = safeHeight;
|
|
212
|
+
}
|
|
213
|
+
renderTextLines(this._private_paddingInternal.top, this._private_paddingInternal.left, realTextLines, this._private_context);
|
|
214
|
+
this._private_updateProperties(resolutionDirty);
|
|
215
|
+
this._private_resizeModeDirty = false;
|
|
216
|
+
this._private_maxLineWidthDirty = false;
|
|
217
|
+
this._private_paddingInternal.setDirtyFalse();
|
|
218
|
+
this._private_setDimensionsDirtyFalse();
|
|
219
|
+
this._private_setContentDirtyFalse();
|
|
220
|
+
}
|
|
221
|
+
_private_updateProperties(resolutionDirty) {
|
|
222
|
+
let properties;
|
|
223
|
+
if (this._private_colorInternal.dirty) {
|
|
224
|
+
properties ?? (properties = {});
|
|
225
|
+
properties["color"] = this._private_colorInternal;
|
|
226
|
+
this._private_colorInternal.setDirtyFalse();
|
|
227
|
+
}
|
|
228
|
+
if (resolutionDirty) {
|
|
229
|
+
this._private_texture.dispose();
|
|
230
|
+
this._private_texture = createCanvasTexture(this._private_canvas);
|
|
231
|
+
this._private_texture.needsUpdate = true;
|
|
232
|
+
properties ?? (properties = {});
|
|
233
|
+
properties["texture"] = this._private_texture;
|
|
234
|
+
}
|
|
235
|
+
if (properties) {
|
|
236
|
+
this.sceneWrapper.setProperties(this.planeHandler, properties);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
_private_buildTextChunks() {
|
|
240
|
+
if (this._private_textChunksDirty) {
|
|
241
|
+
this._private_textChunks = buildTextChunks(this._private_context, this._private_contentInternal, this.commonStyle);
|
|
242
|
+
this._private_textChunksDirty = false;
|
|
243
|
+
}
|
|
244
|
+
return this._private_textChunks;
|
|
245
|
+
}
|
|
246
|
+
_private_checkDimensionsDirty() {
|
|
247
|
+
return (this.solverWrapper.dirty &&
|
|
248
|
+
(this._private_lastWidth !== Math.round(this.width) || this._private_lastHeight !== Math.round(this.height)));
|
|
249
|
+
}
|
|
250
|
+
_private_setDimensionsDirtyFalse() {
|
|
251
|
+
this._private_lastWidth = Math.round(this.width);
|
|
252
|
+
this._private_lastHeight = Math.round(this.height);
|
|
253
|
+
}
|
|
254
|
+
_private_checkContentDirty() {
|
|
255
|
+
return this._private_contentDirty || this.content.some((span) => span.dirty);
|
|
256
|
+
}
|
|
257
|
+
_private_setContentDirtyFalse() {
|
|
258
|
+
this._private_contentDirty = false;
|
|
259
|
+
for (const span of this.content) {
|
|
260
|
+
span.setDirtyFalse();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export { UIText };
|
|
@@ -2,23 +2,20 @@ import type { UIResizePolicy } from "../../miscellaneous/resize-policy/UIResizeP
|
|
|
2
2
|
import { UIResizePolicyNone } from "../../miscellaneous/resize-policy/UIResizePolicyNone";
|
|
3
3
|
import type { UILayerOptions } from "../UILayer/UILayer.Internal";
|
|
4
4
|
import type { UIFullscreenLayer } from "./UIFullscreenLayer";
|
|
5
|
-
|
|
6
5
|
/** Fullscreen layer input event data */
|
|
7
6
|
export interface UIFullscreenLayerInputEventData {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
/** X coordinate */
|
|
8
|
+
x: number;
|
|
9
|
+
/** Y coordinate */
|
|
10
|
+
y: number;
|
|
11
|
+
/** Pointer identifier */
|
|
12
|
+
identifier: number;
|
|
13
|
+
/** Layer that emitted the event */
|
|
14
|
+
layer: UIFullscreenLayer;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
/** Configuration for fullscreen layer */
|
|
19
17
|
export interface UIFullscreenLayerOptions extends Omit<UILayerOptions, "width" | "height"> {
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
/** Strategy for handling window resize */
|
|
19
|
+
resizePolicy: UIResizePolicy;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
export const FULLSCREEN_LAYER_DEFAULT_RESIZE_POLICY = new UIResizePolicyNone();
|
|
21
|
+
export declare const FULLSCREEN_LAYER_DEFAULT_RESIZE_POLICY: UIResizePolicyNone;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { FerrsignView1 } from "ferrsign";
|
|
2
|
+
import type { Camera, Vector2, WebGLRenderer } from "three";
|
|
3
|
+
import { Ray, Vector3 } from "three";
|
|
4
|
+
import type { UIResizePolicy } from "../../miscellaneous/resize-policy/UIResizePolicy";
|
|
5
|
+
import { UILayer } from "../UILayer/UILayer";
|
|
6
|
+
import type { UIFullscreenLayerInputEventData, UIFullscreenLayerOptions } from "./UIFullscreenLayer.Internal";
|
|
7
|
+
/** Layer that automatically handles browser window resizing and input events */
|
|
8
|
+
export declare class UIFullscreenLayer extends UILayer {
|
|
9
|
+
private resizePolicyInternal;
|
|
10
|
+
private resizePolicyDirty;
|
|
11
|
+
private readonly signalPointerPressedInternal;
|
|
12
|
+
private readonly signalPointerMovedInternal;
|
|
13
|
+
private readonly signalPointerReleasedInternal;
|
|
14
|
+
constructor(options?: Partial<UIFullscreenLayerOptions>);
|
|
15
|
+
/** Current resize policy */
|
|
16
|
+
get resizePolicy(): UIResizePolicy;
|
|
17
|
+
/** Signal fired when pointer is pressed */
|
|
18
|
+
get signalPointerPressed(): FerrsignView1<UIFullscreenLayerInputEventData>;
|
|
19
|
+
/** Signal fired when pointer is moved */
|
|
20
|
+
get signalPointerMoved(): FerrsignView1<UIFullscreenLayerInputEventData>;
|
|
21
|
+
/** Signal fired when pointer is released */
|
|
22
|
+
get signalPointerReleased(): FerrsignView1<UIFullscreenLayerInputEventData>;
|
|
23
|
+
/** Updates resize policy */
|
|
24
|
+
set resizePolicy(value: UIResizePolicy);
|
|
25
|
+
/** Removes event listeners and frees resources */
|
|
26
|
+
destroy(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Renders layer and all visible elements
|
|
29
|
+
* @param renderer Three.js WebGL renderer
|
|
30
|
+
* @param deltaTime Time since last frame in seconds
|
|
31
|
+
*/
|
|
32
|
+
render(renderer: WebGLRenderer, deltaTime: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Projects 3D world position to 2D layer coordinates
|
|
35
|
+
* @param position World position
|
|
36
|
+
* @param camera Three.js camera
|
|
37
|
+
* @param result Reusable vector instance
|
|
38
|
+
* @returns Layer coordinates
|
|
39
|
+
*/
|
|
40
|
+
projectWorldPosition(position: Vector3, camera: Camera, result?: Vector3): Vector3;
|
|
41
|
+
/**
|
|
42
|
+
* Projects 2D layer coordinates to 3D world position
|
|
43
|
+
* @param position Layer coordinates
|
|
44
|
+
* @param camera Three.js camera
|
|
45
|
+
* @param z Depth coordinate
|
|
46
|
+
* @param result Reusable vector instance
|
|
47
|
+
* @returns World position
|
|
48
|
+
*/
|
|
49
|
+
projectLayerPosition(position: Vector2, camera: Camera, z?: number, result?: Vector3): Vector3;
|
|
50
|
+
/**
|
|
51
|
+
* Builds ray from layer position through camera
|
|
52
|
+
* @param position Layer coordinates
|
|
53
|
+
* @param camera Three.js camera
|
|
54
|
+
* @param result Reusable ray instance
|
|
55
|
+
* @returns Ray from near to far plane
|
|
56
|
+
*/
|
|
57
|
+
buildRay(position: Vector2, camera: Camera, result?: Ray): Ray;
|
|
58
|
+
private readonly onResize;
|
|
59
|
+
private readonly onPointerDown;
|
|
60
|
+
private readonly onPointerMove;
|
|
61
|
+
private readonly onPointerUp;
|
|
62
|
+
private handleWindowInput;
|
|
63
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Ferrsign1 } from 'ferrsign';
|
|
2
|
+
import { Vector3, MathUtils, Ray } from 'three';
|
|
3
|
+
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
4
|
+
import { isUIModeInteractive } from '../../miscellaneous/UIMode.js';
|
|
5
|
+
import { UILayer } from '../UILayer/UILayer.js';
|
|
6
|
+
import { FULLSCREEN_LAYER_DEFAULT_RESIZE_POLICY } from './UIFullscreenLayer.Internal.js';
|
|
7
|
+
|
|
8
|
+
/** Layer that automatically handles browser window resizing and input events */
|
|
9
|
+
class UIFullscreenLayer extends UILayer {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
const resizePolicy = options?.resizePolicy ?? FULLSCREEN_LAYER_DEFAULT_RESIZE_POLICY;
|
|
12
|
+
const scale = resizePolicy.calculateScale(window.innerWidth, window.innerHeight);
|
|
13
|
+
super({
|
|
14
|
+
width: window.innerWidth * scale,
|
|
15
|
+
height: window.innerHeight * scale,
|
|
16
|
+
...options,
|
|
17
|
+
});
|
|
18
|
+
this._private_resizePolicyDirty = false;
|
|
19
|
+
this._private_signalPointerPressedInternal = new Ferrsign1();
|
|
20
|
+
this._private_signalPointerMovedInternal = new Ferrsign1();
|
|
21
|
+
this._private_signalPointerReleasedInternal = new Ferrsign1();
|
|
22
|
+
this._private_onResize = () => {
|
|
23
|
+
const scale = this.resizePolicy.calculateScale(window.innerWidth, window.innerHeight);
|
|
24
|
+
this.resizePolicy.dirty = false;
|
|
25
|
+
this._private_resizePolicyDirty = false;
|
|
26
|
+
this.resizeInternal(window.innerWidth * scale, window.innerHeight * scale);
|
|
27
|
+
};
|
|
28
|
+
this._private_onPointerDown = (event) => {
|
|
29
|
+
this._private_handleWindowInput(event, "onPointerDown", this._private_signalPointerPressedInternal);
|
|
30
|
+
};
|
|
31
|
+
this._private_onPointerMove = (event) => {
|
|
32
|
+
this._private_handleWindowInput(event, "onPointerMove", this._private_signalPointerMovedInternal);
|
|
33
|
+
};
|
|
34
|
+
this._private_onPointerUp = (event) => {
|
|
35
|
+
this._private_handleWindowInput(event, "onPointerUp", this._private_signalPointerReleasedInternal);
|
|
36
|
+
};
|
|
37
|
+
this._private_resizePolicyInternal = resizePolicy;
|
|
38
|
+
window.addEventListener("resize", this._private_onResize);
|
|
39
|
+
window.addEventListener("pointerdown", this._private_onPointerDown);
|
|
40
|
+
window.addEventListener("pointermove", this._private_onPointerMove);
|
|
41
|
+
window.addEventListener("pointerup", this._private_onPointerUp);
|
|
42
|
+
}
|
|
43
|
+
/** Current resize policy */
|
|
44
|
+
get resizePolicy() {
|
|
45
|
+
return this._private_resizePolicyInternal;
|
|
46
|
+
}
|
|
47
|
+
/** Signal fired when pointer is pressed */
|
|
48
|
+
get signalPointerPressed() {
|
|
49
|
+
return this._private_signalPointerPressedInternal;
|
|
50
|
+
}
|
|
51
|
+
/** Signal fired when pointer is moved */
|
|
52
|
+
get signalPointerMoved() {
|
|
53
|
+
return this._private_signalPointerMovedInternal;
|
|
54
|
+
}
|
|
55
|
+
/** Signal fired when pointer is released */
|
|
56
|
+
get signalPointerReleased() {
|
|
57
|
+
return this._private_signalPointerReleasedInternal;
|
|
58
|
+
}
|
|
59
|
+
/** Updates resize policy */
|
|
60
|
+
set resizePolicy(value) {
|
|
61
|
+
if (this._private_resizePolicyInternal !== value) {
|
|
62
|
+
this._private_resizePolicyInternal = value;
|
|
63
|
+
this._private_resizePolicyDirty = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Removes event listeners and frees resources */
|
|
67
|
+
destroy() {
|
|
68
|
+
window.removeEventListener("resize", this._private_onResize);
|
|
69
|
+
window.removeEventListener("pointerdown", this._private_onPointerDown);
|
|
70
|
+
window.removeEventListener("pointermove", this._private_onPointerMove);
|
|
71
|
+
window.removeEventListener("pointerup", this._private_onPointerUp);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Renders layer and all visible elements
|
|
75
|
+
* @param renderer Three.js WebGL renderer
|
|
76
|
+
* @param deltaTime Time since last frame in seconds
|
|
77
|
+
*/
|
|
78
|
+
render(renderer, deltaTime) {
|
|
79
|
+
assertValidNumber(deltaTime, "UIFullscreenLayer.render.deltaTime");
|
|
80
|
+
if (this.resizePolicy.dirty || this._private_resizePolicyDirty) {
|
|
81
|
+
this._private_onResize();
|
|
82
|
+
}
|
|
83
|
+
super.renderInternal(renderer, deltaTime);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Projects 3D world position to 2D layer coordinates
|
|
87
|
+
* @param position World position
|
|
88
|
+
* @param camera Three.js camera
|
|
89
|
+
* @param result Reusable vector instance
|
|
90
|
+
* @returns Layer coordinates
|
|
91
|
+
*/
|
|
92
|
+
projectWorldPosition(position, camera, result = new Vector3()) {
|
|
93
|
+
result.copy(position).project(camera);
|
|
94
|
+
result.x = MathUtils.mapLinear(result.x, -1, 1, this.x, this.width);
|
|
95
|
+
result.y = MathUtils.mapLinear(result.y, -1, 1, this.y, this.height);
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Projects 2D layer coordinates to 3D world position
|
|
100
|
+
* @param position Layer coordinates
|
|
101
|
+
* @param camera Three.js camera
|
|
102
|
+
* @param z Depth coordinate
|
|
103
|
+
* @param result Reusable vector instance
|
|
104
|
+
* @returns World position
|
|
105
|
+
*/
|
|
106
|
+
projectLayerPosition(position, camera, z = -1, result = new Vector3()) {
|
|
107
|
+
return result
|
|
108
|
+
.set(MathUtils.mapLinear(position.x, this.x, this.width, -1, 1), MathUtils.mapLinear(position.y, this.y, this.height, -1, 1), z)
|
|
109
|
+
.unproject(camera);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Builds ray from layer position through camera
|
|
113
|
+
* @param position Layer coordinates
|
|
114
|
+
* @param camera Three.js camera
|
|
115
|
+
* @param result Reusable ray instance
|
|
116
|
+
* @returns Ray from near to far plane
|
|
117
|
+
*/
|
|
118
|
+
buildRay(position, camera, result = new Ray()) {
|
|
119
|
+
const near = new Vector3(MathUtils.mapLinear(position.x, this.x, this.width, -1, 1), MathUtils.mapLinear(position.y, this.y, this.height, -1, 1), -1).unproject(camera);
|
|
120
|
+
const far = new Vector3(MathUtils.mapLinear(position.x, this.x, this.width, -1, 1), MathUtils.mapLinear(position.y, this.y, this.height, -1, 1), 1).unproject(camera);
|
|
121
|
+
const direction = far.sub(near).normalize();
|
|
122
|
+
return result.set(near, direction);
|
|
123
|
+
}
|
|
124
|
+
_private_handleWindowInput(event, pointerFunctionName, signal) {
|
|
125
|
+
const rect = event.target instanceof HTMLElement
|
|
126
|
+
? event.target.getBoundingClientRect()
|
|
127
|
+
: null;
|
|
128
|
+
const x = rect ? event.clientX - rect.left : event.clientX;
|
|
129
|
+
const y = rect
|
|
130
|
+
? rect.bottom - event.clientY
|
|
131
|
+
: window.innerHeight - event.clientY;
|
|
132
|
+
const scale = this.resizePolicy.calculateScale(window.innerWidth, window.innerHeight);
|
|
133
|
+
const scaledX = x * scale;
|
|
134
|
+
const scaledY = y * scale;
|
|
135
|
+
if (isUIModeInteractive(this.mode)) {
|
|
136
|
+
signal.emit({
|
|
137
|
+
x: scaledX,
|
|
138
|
+
y: scaledY,
|
|
139
|
+
identifier: event.pointerId,
|
|
140
|
+
layer: this,
|
|
141
|
+
});
|
|
142
|
+
this.inputWrapperInternal[pointerFunctionName](scaledX, scaledY, event.pointerId);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { UIFullscreenLayer };
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { UIMode } from "../../miscellaneous/UIMode";
|
|
2
2
|
import type { UIOrientation } from "../../miscellaneous/UIOrientation";
|
|
3
|
-
|
|
4
3
|
/** Layer visibility and interactivity state */
|
|
5
4
|
export type UILayerMode = UIMode.HIDDEN | UIMode.VISIBLE | UIMode.INTERACTIVE;
|
|
6
|
-
|
|
7
5
|
/** Layer orientation state */
|
|
8
6
|
export type UILayerOrientation = UIOrientation.VERTICAL | UIOrientation.HORIZONTAL;
|
|
9
|
-
|
|
10
7
|
/** Configuration options for UILayer */
|
|
11
8
|
export interface UILayerOptions {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
/** Initial width */
|
|
10
|
+
width: number;
|
|
11
|
+
/** Initial height */
|
|
12
|
+
height: number;
|
|
13
|
+
/** Optional layer name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Initial visibility and interactivity mode */
|
|
16
|
+
mode: UILayerMode;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
24
|
-
export const LAYER_DEFAULT_MODE: UILayerMode = UIMode.VISIBLE;
|
|
18
|
+
export declare const LAYER_DEFAULT_SIZE = 1024;
|
|
19
|
+
export declare const LAYER_DEFAULT_NAME = "";
|
|
20
|
+
export declare const LAYER_DEFAULT_MODE: UILayerMode;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { FerrsignView2, FerrsignView3 } from "ferrsign";
|
|
2
|
+
import type { WebGLRenderer } from "three";
|
|
3
|
+
import type { UIPlaneElement } from "../../miscellaneous/shared";
|
|
4
|
+
import { UIInputWrapper } from "../../wrappers/UIInputWrapper/UIInputWrapper";
|
|
5
|
+
import type { UILayerMode, UILayerOptions, UILayerOrientation } from "./UILayer.Internal";
|
|
6
|
+
/** Base layer for UI rendering and layout management */
|
|
7
|
+
export declare abstract class UILayer implements UIPlaneElement {
|
|
8
|
+
/** Optional layer name */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Solver variable for x coordinate */
|
|
11
|
+
readonly xVariable: number;
|
|
12
|
+
/** Solver variable for y coordinate */
|
|
13
|
+
readonly yVariable: number;
|
|
14
|
+
/** Solver variable for width */
|
|
15
|
+
readonly wVariable: number;
|
|
16
|
+
/** Solver variable for height */
|
|
17
|
+
readonly hVariable: number;
|
|
18
|
+
protected readonly inputWrapperInternal: UIInputWrapper;
|
|
19
|
+
private readonly solverWrapperInternal;
|
|
20
|
+
private readonly sceneWrapperInternal;
|
|
21
|
+
private modeInternal;
|
|
22
|
+
private orientationInternal;
|
|
23
|
+
private readonly signalOrientationChangedInternal;
|
|
24
|
+
private readonly signalModeChangedInternal;
|
|
25
|
+
private readonly signalRenderingInternal;
|
|
26
|
+
constructor(options: Partial<UILayerOptions>);
|
|
27
|
+
/** X coordinate in world units (always 0 for layers) */
|
|
28
|
+
get x(): number;
|
|
29
|
+
/** Y coordinate in world units (always 0 for layers) */
|
|
30
|
+
get y(): number;
|
|
31
|
+
/** Layer width in world units */
|
|
32
|
+
get width(): number;
|
|
33
|
+
/** Layer height in world units */
|
|
34
|
+
get height(): number;
|
|
35
|
+
/** Current visibility and interactivity mode */
|
|
36
|
+
get mode(): UILayerMode;
|
|
37
|
+
/** Current orientation based on aspect ratio */
|
|
38
|
+
get orientation(): UILayerOrientation;
|
|
39
|
+
/** Signal fired when orientation changes */
|
|
40
|
+
get signalOrientationChanged(): FerrsignView2<UILayerOrientation, UILayer>;
|
|
41
|
+
/** Signal fired when mode changes */
|
|
42
|
+
get signalModeChanged(): FerrsignView2<UILayerMode, UILayer>;
|
|
43
|
+
/** Signal fired during rendering */
|
|
44
|
+
get signalRendering(): FerrsignView3<WebGLRenderer, number, UILayer>;
|
|
45
|
+
/** Updates visibility and interactivity mode */
|
|
46
|
+
set mode(value: UILayerMode);
|
|
47
|
+
protected resizeInternal(width: number, height: number): void;
|
|
48
|
+
protected renderInternal(renderer: WebGLRenderer, deltaTime: number): void;
|
|
49
|
+
}
|