laymur 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +3 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +14 -16
- package/dist/core/constraints/UIConstraint.d.ts +22 -2
- package/dist/core/constraints/UIConstraint.js +26 -3
- package/dist/core/constraints/UICustomConstraint.d.ts +4 -4
- package/dist/core/constraints/UICustomConstraint.js +15 -15
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +11 -13
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +13 -15
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +3 -3
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js +1 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +13 -7
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +37 -30
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +13 -15
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +3 -3
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +11 -13
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +3 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +11 -11
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +10 -13
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +10 -13
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +10 -13
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +3 -5
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +23 -5
- package/dist/core/elements/UIAnchor/UIAnchor.js +42 -8
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +4 -6
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +10 -10
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +108 -111
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +4 -4
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +5 -8
- package/dist/core/elements/UIDummy/UIDummy.d.ts +19 -11
- package/dist/core/elements/UIDummy/UIDummy.js +59 -42
- package/dist/core/elements/UIElement/UIElement.Internal.d.ts +5 -5
- package/dist/core/elements/UIElement/UIElement.Internal.js +9 -12
- package/dist/core/elements/UIElement/UIElement.d.ts +11 -11
- package/dist/core/elements/UIElement/UIElement.js +57 -60
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +3 -3
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +4 -7
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +7 -7
- package/dist/core/elements/UIGraphics/UIGraphics.js +44 -47
- package/dist/core/elements/UIImage/UIImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIImage/UIImage.Internal.js +1 -0
- package/dist/core/elements/UIImage/UIImage.d.ts +9 -9
- package/dist/core/elements/UIImage/UIImage.js +21 -24
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +3 -3
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +3 -5
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +12 -12
- package/dist/core/elements/UINineSlice/UINineSlice.js +71 -73
- package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +3 -4
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +1 -3
- package/dist/core/elements/UIProgress/UIProgress.d.ts +10 -10
- package/dist/core/elements/UIProgress/UIProgress.js +59 -62
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +3 -3
- package/dist/core/elements/UIScene/UIScene.Internal.js +11 -14
- package/dist/core/elements/UIScene/UIScene.d.ts +8 -8
- package/dist/core/elements/UIScene/UIScene.js +68 -69
- package/dist/core/elements/UIText/UIText.Bidi.d.ts +2 -2
- package/dist/core/elements/UIText/UIText.Bidi.js +3 -5
- package/dist/core/elements/UIText/UIText.Interfaces.d.ts +6 -2
- package/dist/core/elements/UIText/UIText.Interfaces.js +1 -0
- package/dist/core/elements/UIText/UIText.Internal.d.ts +4 -4
- package/dist/core/elements/UIText/UIText.Internal.js +5 -7
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +14 -7
- package/dist/core/elements/UIText/UIText.Measuring.js +115 -55
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +3 -3
- package/dist/core/elements/UIText/UIText.Rendering.js +6 -9
- package/dist/core/elements/UIText/UIText.d.ts +28 -14
- package/dist/core/elements/UIText/UIText.js +181 -141
- package/dist/core/index.d.ts +55 -54
- package/dist/core/index.js +53 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +2 -5
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +43 -42
- package/dist/core/layers/UILayer/UILayer.Internal.d.ts +2 -2
- package/dist/core/layers/UILayer/UILayer.Internal.js +4 -7
- package/dist/core/layers/UILayer/UILayer.d.ts +19 -4
- package/dist/core/layers/UILayer/UILayer.js +125 -62
- package/dist/core/miscellaneous/UIBlendMode.js +1 -3
- package/dist/core/miscellaneous/UIExpression.js +16 -19
- package/dist/core/miscellaneous/UIMode.js +3 -5
- package/dist/core/miscellaneous/UIOrientation.js +2 -4
- package/dist/core/miscellaneous/UIPriority.js +5 -8
- package/dist/core/miscellaneous/UIRelation.js +5 -8
- package/dist/core/miscellaneous/UITransparencyMode.js +1 -3
- package/dist/core/miscellaneous/area/UIArea.js +1 -3
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaCircle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +2 -2
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +3 -6
- package/dist/core/miscellaneous/asserts.d.ts +20 -1
- package/dist/core/miscellaneous/asserts.js +71 -19
- package/dist/core/miscellaneous/canvas.js +13 -7
- package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.Internal.js +1 -3
- package/dist/core/miscellaneous/color/UIColor.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.js +202 -205
- package/dist/core/miscellaneous/computeTransform.d.ts +1 -1
- package/dist/core/miscellaneous/computeTransform.js +4 -7
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +2 -2
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +13 -16
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +115 -118
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +3 -3
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.js +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +208 -114
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +2 -2
- package/dist/core/miscellaneous/generic-plane/shared.js +16 -19
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +1 -3
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +1 -1
- package/dist/core/miscellaneous/insets/UIInsets.js +96 -99
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +1 -3
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +1 -1
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +14 -17
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -2
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +13 -16
- package/dist/core/miscellaneous/math.js +3 -5
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +6 -8
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +1 -1
- package/dist/core/miscellaneous/micro/UIMicro.js +91 -94
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +1 -3
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +3 -6
- package/dist/core/miscellaneous/shared.d.ts +1 -1
- package/dist/core/miscellaneous/shared.js +4 -7
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.js +1 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +2 -2
- package/dist/core/miscellaneous/text-span/UITextSpan.js +10 -13
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +15 -17
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +13 -2
- package/dist/core/miscellaneous/text-style/UITextStyle.js +222 -207
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +7 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +16 -6
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +1 -1
- package/dist/core/miscellaneous/texture/UITextureView.js +113 -117
- package/dist/core/miscellaneous/webglCapabilities.js +3 -4
- package/dist/core/shaders/UIImage.d.ts +9 -0
- package/dist/core/shaders/UIImage.js +14 -0
- package/dist/core/shaders/UINineSlice.d.ts +11 -0
- package/dist/core/shaders/UINineSlice.js +57 -0
- package/dist/core/shaders/UIProgress.d.ts +14 -0
- package/dist/core/shaders/UIProgress.js +21 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.js +16 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.js +15 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +4 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +7 -1
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +50 -47
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +5 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +11 -3
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +42 -26
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +5 -3
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +20 -4
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +138 -117
- package/dist/debug/UIAspectDebug.d.ts +3 -3
- package/dist/debug/UIAspectDebug.js +64 -68
- package/dist/debug/UIConstraintDebug.d.ts +1 -1
- package/dist/debug/UIConstraintDebug.js +1 -0
- package/dist/debug/UIHeightDebug.d.ts +3 -3
- package/dist/debug/UIHeightDebug.js +63 -67
- package/dist/debug/UIHorizontalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalDistanceDebug.js +76 -81
- package/dist/debug/UIHorizontalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalInterpolationDebug.js +74 -78
- package/dist/debug/UILayerDebug.d.ts +1 -1
- package/dist/debug/UILayerDebug.js +55 -64
- package/dist/debug/UIVerticalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIVerticalDistanceDebug.js +76 -81
- package/dist/debug/UIVerticalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIVerticalInterpolationDebug.js +74 -78
- package/dist/debug/UIWidthDebug.d.ts +3 -3
- package/dist/debug/UIWidthDebug.js +63 -67
- package/dist/debug/index.d.ts +8 -8
- package/dist/debug/index.js +8 -8
- package/dist/debug/miscellaneous.js +8 -11
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorModule.js +1 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +37 -40
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +41 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +87 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +17 -20
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +21 -24
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +21 -24
- package/dist/particles/elements/UIEmitter.Internal.d.ts +2 -2
- package/dist/particles/elements/UIEmitter.Internal.js +6 -9
- package/dist/particles/elements/UIEmitter.d.ts +17 -11
- package/dist/particles/elements/UIEmitter.js +100 -88
- package/dist/particles/index.d.ts +20 -18
- package/dist/particles/index.js +19 -18
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +14 -15
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.js +29 -32
- package/dist/particles/miscellaneous/miscellaneous.d.ts +3 -3
- package/dist/particles/miscellaneous/miscellaneous.js +26 -27
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +5 -8
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +6 -9
- package/dist/particles/renderingModules/UIRenderingModule.js +1 -3
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingTexture.js +4 -7
- package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.js +7 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +9 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.js +16 -0
- package/dist/particles/shaders/UIRenderingTexture.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingTexture.js +7 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnModule.js +1 -3
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +3 -3
- package/dist/particles/spawnModules/UISpawnOffset.js +12 -15
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomScale.js +19 -22
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +21 -24
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +3 -3
- package/dist/particles/spawnModules/UISpawnRectangle.js +21 -24
- package/package.json +13 -17
- package/dist/_virtual/2d.js +0 -3
- package/dist/_virtual/3d.js +0 -3
- package/dist/_virtual/4d.js +0 -3
- package/dist/_virtual/mod.js +0 -5
- package/dist/_virtual/mod2.js +0 -3
- package/dist/core/shaders/UIImage.glsl.js +0 -3
- package/dist/core/shaders/UINineSlice.glsl.js +0 -3
- package/dist/core/shaders/UIProgress.glsl.js +0 -3
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +0 -3
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +0 -3
- package/dist/index.js +0 -52
- package/dist/node_modules/fast-simplex-noise/lib/2d.js +0 -93
- package/dist/node_modules/fast-simplex-noise/lib/3d.js +0 -142
- package/dist/node_modules/fast-simplex-noise/lib/4d.js +0 -196
- package/dist/node_modules/fast-simplex-noise/lib/mod.js +0 -24
- package/dist/node_modules/three/examples/jsm/lines/Line2.js +0 -56
- package/dist/node_modules/three/examples/jsm/lines/LineGeometry.js +0 -157
- package/dist/node_modules/three/examples/jsm/lines/LineMaterial.js +0 -691
- package/dist/node_modules/three/examples/jsm/lines/LineSegments2.js +0 -415
- package/dist/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js +0 -289
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +0 -3
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +0 -3
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +0 -3
|
@@ -1,118 +1,114 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Line2 } from
|
|
3
|
-
import { LineGeometry } from
|
|
4
|
-
import { LineMaterial } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class UIAspectDebug {
|
|
1
|
+
import { CanvasTexture, Object3D, Sprite, SpriteMaterial, Vector3 } from "three";
|
|
2
|
+
import { Line2 } from "three/addons/lines/Line2.js";
|
|
3
|
+
import { LineGeometry } from "three/addons/lines/LineGeometry.js";
|
|
4
|
+
import { LineMaterial } from "three/addons/lines/LineMaterial.js";
|
|
5
|
+
import { UIColor, UIOrientation } from "../core/index.js";
|
|
6
|
+
import { DEBUG_BADGE_BACKGROUND_COLOR, DEBUG_BADGE_FONT_FAMILY, DEBUG_BADGE_FONT_SIZE, DEBUG_BADGE_SIZE, DEBUG_LINE_WIDTH, DEBUG_RENDER_ORDER, debugResolutionVector, } from "./miscellaneous.js";
|
|
7
|
+
export class UIAspectDebug {
|
|
10
8
|
constructor(constraint) {
|
|
11
9
|
this.constraint = constraint;
|
|
12
10
|
this.tint = new UIColor("cyan");
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
11
|
+
this.container = new Object3D();
|
|
12
|
+
this.diagonalMaterial = new LineMaterial({
|
|
15
13
|
linewidth: DEBUG_LINE_WIDTH,
|
|
16
14
|
transparent: true,
|
|
17
15
|
depthTest: false,
|
|
18
16
|
depthWrite: false,
|
|
19
17
|
});
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
18
|
+
this.diagonalGeometry = new LineGeometry();
|
|
19
|
+
this.diagonalLine = new Line2(this.diagonalGeometry, this.diagonalMaterial);
|
|
20
|
+
this.visibleInternal = true;
|
|
21
|
+
this.lastRenderedText = "";
|
|
22
|
+
this.onOrientationChanged = () => {
|
|
23
|
+
this.updateContainerVisibility();
|
|
26
24
|
};
|
|
27
|
-
this.
|
|
25
|
+
this.onRendering = (renderer) => {
|
|
28
26
|
const tintDirty = this.tint.dirty;
|
|
29
27
|
if (tintDirty) {
|
|
30
|
-
this.tint.toThreeColor(this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
28
|
+
this.tint.toThreeColor(this.diagonalMaterial.color);
|
|
29
|
+
this.diagonalMaterial.opacity = this.tint.a;
|
|
30
|
+
this.spriteMaterial.opacity = this.tint.a;
|
|
33
31
|
this.tint.setDirtyFalse();
|
|
34
32
|
}
|
|
35
33
|
renderer.getDrawingBufferSize(debugResolutionVector);
|
|
36
|
-
this.
|
|
34
|
+
this.diagonalMaterial.resolution.copy(debugResolutionVector);
|
|
37
35
|
const { x, y, oppositeX, oppositeY, width, height, centerX, centerY } = this.constraint.element;
|
|
38
36
|
if (width <= 0 || height <= 0) {
|
|
39
37
|
return;
|
|
40
38
|
}
|
|
41
|
-
this.
|
|
39
|
+
this.diagonalGeometry.setFromPoints([
|
|
42
40
|
new Vector3(x, y, 0),
|
|
43
41
|
new Vector3(oppositeX, oppositeY, 0),
|
|
44
42
|
]);
|
|
45
43
|
const nextText = this.constraint.aspect.toFixed(2) + " (" + width.toFixed(0) + "x" + height.toFixed(0) + ")";
|
|
46
|
-
if (nextText !== this.
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
44
|
+
if (nextText !== this.lastRenderedText || tintDirty) {
|
|
45
|
+
this.drawText(nextText);
|
|
46
|
+
this.textTexture.needsUpdate = true;
|
|
47
|
+
this.lastRenderedText = nextText;
|
|
50
48
|
}
|
|
51
49
|
const dx = oppositeX - x;
|
|
52
50
|
const dy = oppositeY - y;
|
|
53
51
|
const angle = Math.atan2(dy, dx);
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
52
|
+
this.textSprite.position.set(centerX, centerY, 0);
|
|
53
|
+
this.textSprite.material.rotation = angle;
|
|
56
54
|
};
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
55
|
+
this.diagonalLine.renderOrder = DEBUG_RENDER_ORDER;
|
|
56
|
+
this.container.add(this.diagonalLine);
|
|
59
57
|
const canvas = document.createElement("canvas");
|
|
60
58
|
canvas.width = 256;
|
|
61
59
|
canvas.height = 64;
|
|
62
60
|
const context = canvas.getContext("2d");
|
|
63
61
|
if (context === null) {
|
|
64
|
-
throw new Error("
|
|
62
|
+
throw new Error("UIAspectDebug.constructor: failed to get 2D context for debug text");
|
|
65
63
|
}
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
map: this.
|
|
64
|
+
this.canvas = canvas;
|
|
65
|
+
this.context = context;
|
|
66
|
+
this.drawText("");
|
|
67
|
+
this.textTexture = new CanvasTexture(canvas);
|
|
68
|
+
this.spriteMaterial = new SpriteMaterial({
|
|
69
|
+
map: this.textTexture,
|
|
72
70
|
transparent: true,
|
|
73
71
|
depthTest: false,
|
|
74
72
|
depthWrite: false,
|
|
75
73
|
});
|
|
76
|
-
this.
|
|
77
|
-
this.
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
80
|
-
this.constraint.layer.signalRendering.on(this.
|
|
81
|
-
this.constraint.layer.signalOrientationChanged.on(this.
|
|
82
|
-
this.constraint.layer.sceneWrapper.insertCustomObject(this.
|
|
83
|
-
this.
|
|
74
|
+
this.textSprite = new Sprite(this.spriteMaterial);
|
|
75
|
+
this.textSprite.renderOrder = DEBUG_RENDER_ORDER;
|
|
76
|
+
this.textSprite.scale.set(DEBUG_BADGE_SIZE, DEBUG_BADGE_SIZE * 0.25, 1);
|
|
77
|
+
this.container.add(this.textSprite);
|
|
78
|
+
this.constraint.layer.signalRendering.on(this.onRendering);
|
|
79
|
+
this.constraint.layer.signalOrientationChanged.on(this.onOrientationChanged);
|
|
80
|
+
this.constraint.layer.sceneWrapper.insertCustomObject(this.container);
|
|
81
|
+
this.updateContainerVisibility();
|
|
84
82
|
}
|
|
85
83
|
get visible() {
|
|
86
|
-
return this.
|
|
84
|
+
return this.visibleInternal;
|
|
87
85
|
}
|
|
88
86
|
set visible(value) {
|
|
89
|
-
if (value !== this.
|
|
90
|
-
this.
|
|
91
|
-
this.
|
|
87
|
+
if (value !== this.visibleInternal) {
|
|
88
|
+
this.visibleInternal = value;
|
|
89
|
+
this.updateContainerVisibility();
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
92
|
destroy() {
|
|
95
|
-
this.constraint.layer.signalRendering.off(this.
|
|
96
|
-
this.constraint.layer.signalOrientationChanged.off(this.
|
|
97
|
-
this.constraint.layer.sceneWrapper.removeCustomObject(this.
|
|
98
|
-
this.
|
|
99
|
-
this.
|
|
93
|
+
this.constraint.layer.signalRendering.off(this.onRendering);
|
|
94
|
+
this.constraint.layer.signalOrientationChanged.off(this.onOrientationChanged);
|
|
95
|
+
this.constraint.layer.sceneWrapper.removeCustomObject(this.container);
|
|
96
|
+
this.diagonalGeometry.dispose();
|
|
97
|
+
this.textTexture.dispose();
|
|
100
98
|
}
|
|
101
|
-
|
|
99
|
+
updateContainerVisibility() {
|
|
102
100
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
103
101
|
this.constraint.orientation === this.constraint.layer.orientation;
|
|
104
|
-
this.
|
|
102
|
+
this.container.visible = this.visibleInternal && orientationActive;
|
|
105
103
|
}
|
|
106
|
-
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
111
|
-
this.
|
|
112
|
-
this.
|
|
113
|
-
this.
|
|
114
|
-
this.
|
|
104
|
+
drawText(text) {
|
|
105
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
106
|
+
this.context.fillStyle = DEBUG_BADGE_BACKGROUND_COLOR;
|
|
107
|
+
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
108
|
+
this.context.fillStyle = this.tint.getHexStringRGB();
|
|
109
|
+
this.context.font = `${DEBUG_BADGE_FONT_SIZE}px ${DEBUG_BADGE_FONT_FAMILY}`;
|
|
110
|
+
this.context.textAlign = "center";
|
|
111
|
+
this.context.textBaseline = "middle";
|
|
112
|
+
this.context.fillText(text, this.canvas.width / 2, this.canvas.height / 2);
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
|
-
|
|
118
|
-
export { UIAspectDebug };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UIHeightConstraint } from "../core";
|
|
2
|
-
import { UIColor } from "../core";
|
|
3
|
-
import type { UIConstraintDebug } from "./UIConstraintDebug";
|
|
1
|
+
import type { UIHeightConstraint } from "../core/index.js";
|
|
2
|
+
import { UIColor } from "../core/index.js";
|
|
3
|
+
import type { UIConstraintDebug } from "./UIConstraintDebug.js";
|
|
4
4
|
export declare class UIHeightDebug implements UIConstraintDebug {
|
|
5
5
|
readonly constraint: UIHeightConstraint;
|
|
6
6
|
readonly tint: UIColor;
|
|
@@ -1,111 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Line2 } from
|
|
3
|
-
import { LineGeometry } from
|
|
4
|
-
import { LineMaterial } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class UIHeightDebug {
|
|
1
|
+
import { CanvasTexture, Object3D, Sprite, SpriteMaterial, Vector3 } from "three";
|
|
2
|
+
import { Line2 } from "three/addons/lines/Line2.js";
|
|
3
|
+
import { LineGeometry } from "three/addons/lines/LineGeometry.js";
|
|
4
|
+
import { LineMaterial } from "three/addons/lines/LineMaterial.js";
|
|
5
|
+
import { UIColor, UIOrientation } from "../core/index.js";
|
|
6
|
+
import { DEBUG_BADGE_BACKGROUND_COLOR, DEBUG_BADGE_FONT_FAMILY, DEBUG_BADGE_FONT_SIZE, DEBUG_BADGE_SIZE, DEBUG_LINE_WIDTH, DEBUG_RENDER_ORDER, debugResolutionVector, } from "./miscellaneous.js";
|
|
7
|
+
export class UIHeightDebug {
|
|
10
8
|
constructor(constraint) {
|
|
11
9
|
this.constraint = constraint;
|
|
12
10
|
this.tint = new UIColor("cyan");
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
11
|
+
this.container = new Object3D();
|
|
12
|
+
this.lineMaterial = new LineMaterial({
|
|
15
13
|
linewidth: DEBUG_LINE_WIDTH,
|
|
16
14
|
transparent: true,
|
|
17
15
|
depthTest: false,
|
|
18
16
|
depthWrite: false,
|
|
19
17
|
});
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
18
|
+
this.lineGeometry = new LineGeometry();
|
|
19
|
+
this.line = new Line2(this.lineGeometry, this.lineMaterial);
|
|
20
|
+
this.visibleInternal = true;
|
|
21
|
+
this.lastRenderedText = "";
|
|
22
|
+
this.onOrientationChanged = () => {
|
|
23
|
+
this.updateContainerVisibility();
|
|
26
24
|
};
|
|
27
|
-
this.
|
|
25
|
+
this.onRendering = (renderer) => {
|
|
28
26
|
const tintDirty = this.tint.dirty;
|
|
29
27
|
if (tintDirty) {
|
|
30
|
-
this.tint.toThreeColor(this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
28
|
+
this.tint.toThreeColor(this.lineMaterial.color);
|
|
29
|
+
this.lineMaterial.opacity = this.tint.a;
|
|
30
|
+
this.spriteMaterial.opacity = this.tint.a;
|
|
33
31
|
this.tint.setDirtyFalse();
|
|
34
32
|
}
|
|
35
33
|
renderer.getDrawingBufferSize(debugResolutionVector);
|
|
36
|
-
this.
|
|
34
|
+
this.lineMaterial.resolution.copy(debugResolutionVector);
|
|
37
35
|
const { x, y, oppositeY, height, centerX, centerY } = this.constraint.element;
|
|
38
36
|
if (height <= 0) {
|
|
39
37
|
return;
|
|
40
38
|
}
|
|
41
|
-
this.
|
|
39
|
+
this.lineGeometry.setFromPoints([new Vector3(x, y, 0), new Vector3(x, oppositeY, 0)]);
|
|
42
40
|
const nextText = "H: " + height.toFixed(0);
|
|
43
|
-
if (nextText !== this.
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
41
|
+
if (nextText !== this.lastRenderedText || tintDirty) {
|
|
42
|
+
this.drawText(nextText);
|
|
43
|
+
this.textTexture.needsUpdate = true;
|
|
44
|
+
this.lastRenderedText = nextText;
|
|
47
45
|
}
|
|
48
|
-
this.
|
|
46
|
+
this.textSprite.position.set(centerX - 20, centerY, 0);
|
|
49
47
|
};
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
48
|
+
this.line.renderOrder = DEBUG_RENDER_ORDER;
|
|
49
|
+
this.container.add(this.line);
|
|
52
50
|
const canvas = document.createElement("canvas");
|
|
53
51
|
canvas.width = 256;
|
|
54
52
|
canvas.height = 64;
|
|
55
53
|
const context = canvas.getContext("2d");
|
|
56
54
|
if (context === null) {
|
|
57
|
-
throw new Error("
|
|
55
|
+
throw new Error("UIHeightDebug.constructor: failed to get 2D context for debug text");
|
|
58
56
|
}
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
map: this.
|
|
57
|
+
this.canvas = canvas;
|
|
58
|
+
this.context = context;
|
|
59
|
+
this.drawText("");
|
|
60
|
+
this.textTexture = new CanvasTexture(canvas);
|
|
61
|
+
this.spriteMaterial = new SpriteMaterial({
|
|
62
|
+
map: this.textTexture,
|
|
65
63
|
transparent: true,
|
|
66
64
|
depthTest: false,
|
|
67
65
|
depthWrite: false,
|
|
68
66
|
});
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.constraint.layer.signalRendering.on(this.
|
|
74
|
-
this.constraint.layer.signalOrientationChanged.on(this.
|
|
75
|
-
this.constraint.layer.sceneWrapper.insertCustomObject(this.
|
|
76
|
-
this.
|
|
67
|
+
this.textSprite = new Sprite(this.spriteMaterial);
|
|
68
|
+
this.textSprite.renderOrder = DEBUG_RENDER_ORDER;
|
|
69
|
+
this.textSprite.scale.set(DEBUG_BADGE_SIZE, DEBUG_BADGE_SIZE * 0.25, 1);
|
|
70
|
+
this.container.add(this.textSprite);
|
|
71
|
+
this.constraint.layer.signalRendering.on(this.onRendering);
|
|
72
|
+
this.constraint.layer.signalOrientationChanged.on(this.onOrientationChanged);
|
|
73
|
+
this.constraint.layer.sceneWrapper.insertCustomObject(this.container);
|
|
74
|
+
this.updateContainerVisibility();
|
|
77
75
|
}
|
|
78
76
|
get visible() {
|
|
79
|
-
return this.
|
|
77
|
+
return this.visibleInternal;
|
|
80
78
|
}
|
|
81
79
|
set visible(value) {
|
|
82
|
-
if (value !== this.
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
80
|
+
if (value !== this.visibleInternal) {
|
|
81
|
+
this.visibleInternal = value;
|
|
82
|
+
this.updateContainerVisibility();
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
destroy() {
|
|
88
|
-
this.constraint.layer.signalRendering.off(this.
|
|
89
|
-
this.constraint.layer.signalOrientationChanged.off(this.
|
|
90
|
-
this.constraint.layer.sceneWrapper.removeCustomObject(this.
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
86
|
+
this.constraint.layer.signalRendering.off(this.onRendering);
|
|
87
|
+
this.constraint.layer.signalOrientationChanged.off(this.onOrientationChanged);
|
|
88
|
+
this.constraint.layer.sceneWrapper.removeCustomObject(this.container);
|
|
89
|
+
this.lineGeometry.dispose();
|
|
90
|
+
this.textTexture.dispose();
|
|
93
91
|
}
|
|
94
|
-
|
|
92
|
+
updateContainerVisibility() {
|
|
95
93
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
96
94
|
this.constraint.orientation === this.constraint.layer.orientation;
|
|
97
|
-
this.
|
|
95
|
+
this.container.visible = this.visibleInternal && orientationActive;
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
103
|
-
this.
|
|
104
|
-
this.
|
|
105
|
-
this.
|
|
106
|
-
this.
|
|
107
|
-
this.
|
|
97
|
+
drawText(text) {
|
|
98
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
99
|
+
this.context.fillStyle = DEBUG_BADGE_BACKGROUND_COLOR;
|
|
100
|
+
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
101
|
+
this.context.fillStyle = this.tint.getHexStringRGB();
|
|
102
|
+
this.context.font = `${DEBUG_BADGE_FONT_SIZE}px ${DEBUG_BADGE_FONT_FAMILY}`;
|
|
103
|
+
this.context.textAlign = "center";
|
|
104
|
+
this.context.textBaseline = "middle";
|
|
105
|
+
this.context.fillText(text, this.canvas.width / 2, this.canvas.height / 2);
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
|
-
|
|
111
|
-
export { UIHeightDebug };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UIHorizontalDistanceConstraint } from "../core";
|
|
2
|
-
import { UIColor } from "../core";
|
|
3
|
-
import type { UIConstraintDebug } from "./UIConstraintDebug";
|
|
1
|
+
import type { UIHorizontalDistanceConstraint } from "../core/index.js";
|
|
2
|
+
import { UIColor } from "../core/index.js";
|
|
3
|
+
import type { UIConstraintDebug } from "./UIConstraintDebug.js";
|
|
4
4
|
export declare class UIHorizontalDistanceDebug implements UIConstraintDebug {
|
|
5
5
|
readonly constraint: UIHorizontalDistanceConstraint;
|
|
6
6
|
readonly tint: UIColor;
|
|
@@ -1,54 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Line2 } from
|
|
3
|
-
import { LineGeometry } from
|
|
4
|
-
import { LineMaterial } from
|
|
5
|
-
import { LineSegments2 } from
|
|
6
|
-
import { LineSegmentsGeometry } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { UILayer } from '../core/layers/UILayer/UILayer.js';
|
|
12
|
-
|
|
13
|
-
class UIHorizontalDistanceDebug {
|
|
1
|
+
import { CanvasTexture, Object3D, Sprite, SpriteMaterial, Vector3 } from "three";
|
|
2
|
+
import { Line2 } from "three/addons/lines/Line2.js";
|
|
3
|
+
import { LineGeometry } from "three/addons/lines/LineGeometry.js";
|
|
4
|
+
import { LineMaterial } from "three/addons/lines/LineMaterial.js";
|
|
5
|
+
import { LineSegments2 } from "three/addons/lines/LineSegments2.js";
|
|
6
|
+
import { LineSegmentsGeometry } from "three/addons/lines/LineSegmentsGeometry.js";
|
|
7
|
+
import { UIColor, UILayer, UIOrientation } from "../core/index.js";
|
|
8
|
+
import { isUIPlaneElement } from "../core/miscellaneous/shared.js";
|
|
9
|
+
import { DEBUG_BADGE_BACKGROUND_COLOR, DEBUG_BADGE_FONT_FAMILY, DEBUG_BADGE_FONT_SIZE, DEBUG_BADGE_SIZE, DEBUG_LINE_WIDTH, DEBUG_RENDER_ORDER, debugResolutionVector, } from "./miscellaneous.js";
|
|
10
|
+
export class UIHorizontalDistanceDebug {
|
|
14
11
|
constructor(constraint) {
|
|
15
12
|
this.constraint = constraint;
|
|
16
13
|
this.tint = new UIColor("cyan");
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
14
|
+
this.container = new Object3D();
|
|
15
|
+
this.lineMaterial = new LineMaterial({
|
|
19
16
|
linewidth: DEBUG_LINE_WIDTH,
|
|
20
17
|
transparent: true,
|
|
21
18
|
depthTest: false,
|
|
22
19
|
depthWrite: false,
|
|
23
20
|
});
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
21
|
+
this.lineGeometry = new LineGeometry();
|
|
22
|
+
this.line = new Line2(this.lineGeometry, this.lineMaterial);
|
|
23
|
+
this.tickMaterial = new LineMaterial({
|
|
27
24
|
linewidth: DEBUG_LINE_WIDTH,
|
|
28
25
|
transparent: true,
|
|
29
26
|
depthTest: false,
|
|
30
27
|
depthWrite: false,
|
|
31
28
|
});
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
29
|
+
this.tickGeometry = new LineSegmentsGeometry();
|
|
30
|
+
this.tickLine = new LineSegments2(this.tickGeometry, this.tickMaterial);
|
|
31
|
+
this.visibleInternal = true;
|
|
32
|
+
this.lastRenderedText = "";
|
|
33
|
+
this.onOrientationChanged = () => {
|
|
34
|
+
this.updateContainerVisibility();
|
|
38
35
|
};
|
|
39
|
-
this.
|
|
36
|
+
this.onRendering = (renderer) => {
|
|
40
37
|
const tintDirty = this.tint.dirty;
|
|
41
38
|
if (tintDirty) {
|
|
42
|
-
this.tint.toThreeColor(this.
|
|
43
|
-
this.
|
|
44
|
-
this.tint.toThreeColor(this.
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
39
|
+
this.tint.toThreeColor(this.lineMaterial.color);
|
|
40
|
+
this.lineMaterial.opacity = this.tint.a;
|
|
41
|
+
this.tint.toThreeColor(this.tickMaterial.color);
|
|
42
|
+
this.tickMaterial.opacity = this.tint.a;
|
|
43
|
+
this.spriteMaterial.opacity = this.tint.a;
|
|
47
44
|
this.tint.setDirtyFalse();
|
|
48
45
|
}
|
|
49
46
|
renderer.getDrawingBufferSize(debugResolutionVector);
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
47
|
+
this.lineMaterial.resolution.copy(debugResolutionVector);
|
|
48
|
+
this.tickMaterial.resolution.copy(debugResolutionVector);
|
|
52
49
|
const elementA = this.constraint.a;
|
|
53
50
|
const elementB = this.constraint.b;
|
|
54
51
|
const anchorAX = isUIPlaneElement(elementA)
|
|
@@ -64,12 +61,12 @@ class UIHorizontalDistanceDebug {
|
|
|
64
61
|
: elementB instanceof UILayer
|
|
65
62
|
? anchorAY
|
|
66
63
|
: (anchorAY + anchorBY) / 2;
|
|
67
|
-
this.
|
|
64
|
+
this.lineGeometry.setFromPoints([
|
|
68
65
|
new Vector3(anchorAX, midY, 0),
|
|
69
66
|
new Vector3(anchorBX, midY, 0),
|
|
70
67
|
]);
|
|
71
68
|
const tickSize = 10;
|
|
72
|
-
this.
|
|
69
|
+
this.tickGeometry.setPositions([
|
|
73
70
|
anchorAX,
|
|
74
71
|
midY - tickSize,
|
|
75
72
|
0,
|
|
@@ -84,75 +81,73 @@ class UIHorizontalDistanceDebug {
|
|
|
84
81
|
0,
|
|
85
82
|
]);
|
|
86
83
|
const nextText = "HD: " + this.constraint.distance.toFixed(0);
|
|
87
|
-
if (nextText !== this.
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
84
|
+
if (nextText !== this.lastRenderedText || tintDirty) {
|
|
85
|
+
this.drawText(nextText);
|
|
86
|
+
this.textTexture.needsUpdate = true;
|
|
87
|
+
this.lastRenderedText = nextText;
|
|
91
88
|
}
|
|
92
|
-
this.
|
|
89
|
+
this.textSprite.position.set((anchorAX + anchorBX) / 2, midY + 20, 0);
|
|
93
90
|
};
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
97
|
-
this.
|
|
91
|
+
this.line.renderOrder = DEBUG_RENDER_ORDER;
|
|
92
|
+
this.tickLine.renderOrder = DEBUG_RENDER_ORDER;
|
|
93
|
+
this.container.add(this.line);
|
|
94
|
+
this.container.add(this.tickLine);
|
|
98
95
|
const canvas = document.createElement("canvas");
|
|
99
96
|
canvas.width = 256;
|
|
100
97
|
canvas.height = 64;
|
|
101
98
|
const context = canvas.getContext("2d");
|
|
102
99
|
if (context === null) {
|
|
103
|
-
throw new Error("
|
|
100
|
+
throw new Error("UIHorizontalDistanceDebug.constructor: failed to get 2D context for debug text");
|
|
104
101
|
}
|
|
105
|
-
this.
|
|
106
|
-
this.
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
map: this.
|
|
102
|
+
this.canvas = canvas;
|
|
103
|
+
this.context = context;
|
|
104
|
+
this.drawText("");
|
|
105
|
+
this.textTexture = new CanvasTexture(canvas);
|
|
106
|
+
this.spriteMaterial = new SpriteMaterial({
|
|
107
|
+
map: this.textTexture,
|
|
111
108
|
transparent: true,
|
|
112
109
|
depthTest: false,
|
|
113
110
|
depthWrite: false,
|
|
114
111
|
});
|
|
115
|
-
this.
|
|
116
|
-
this.
|
|
117
|
-
this.
|
|
118
|
-
this.
|
|
119
|
-
this.constraint.layer.signalRendering.on(this.
|
|
120
|
-
this.constraint.layer.signalOrientationChanged.on(this.
|
|
121
|
-
this.constraint.layer.sceneWrapper.insertCustomObject(this.
|
|
122
|
-
this.
|
|
112
|
+
this.textSprite = new Sprite(this.spriteMaterial);
|
|
113
|
+
this.textSprite.renderOrder = DEBUG_RENDER_ORDER;
|
|
114
|
+
this.textSprite.scale.set(DEBUG_BADGE_SIZE, DEBUG_BADGE_SIZE * 0.25, 1);
|
|
115
|
+
this.container.add(this.textSprite);
|
|
116
|
+
this.constraint.layer.signalRendering.on(this.onRendering);
|
|
117
|
+
this.constraint.layer.signalOrientationChanged.on(this.onOrientationChanged);
|
|
118
|
+
this.constraint.layer.sceneWrapper.insertCustomObject(this.container);
|
|
119
|
+
this.updateContainerVisibility();
|
|
123
120
|
}
|
|
124
121
|
get visible() {
|
|
125
|
-
return this.
|
|
122
|
+
return this.visibleInternal;
|
|
126
123
|
}
|
|
127
124
|
set visible(value) {
|
|
128
|
-
if (value !== this.
|
|
129
|
-
this.
|
|
130
|
-
this.
|
|
125
|
+
if (value !== this.visibleInternal) {
|
|
126
|
+
this.visibleInternal = value;
|
|
127
|
+
this.updateContainerVisibility();
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
130
|
destroy() {
|
|
134
|
-
this.constraint.layer.signalRendering.off(this.
|
|
135
|
-
this.constraint.layer.signalOrientationChanged.off(this.
|
|
136
|
-
this.constraint.layer.sceneWrapper.removeCustomObject(this.
|
|
137
|
-
this.
|
|
138
|
-
this.
|
|
139
|
-
this.
|
|
131
|
+
this.constraint.layer.signalRendering.off(this.onRendering);
|
|
132
|
+
this.constraint.layer.signalOrientationChanged.off(this.onOrientationChanged);
|
|
133
|
+
this.constraint.layer.sceneWrapper.removeCustomObject(this.container);
|
|
134
|
+
this.lineGeometry.dispose();
|
|
135
|
+
this.tickGeometry.dispose();
|
|
136
|
+
this.textTexture.dispose();
|
|
140
137
|
}
|
|
141
|
-
|
|
138
|
+
updateContainerVisibility() {
|
|
142
139
|
const orientationActive = this.constraint.orientation === UIOrientation.ALWAYS ||
|
|
143
140
|
this.constraint.orientation === this.constraint.layer.orientation;
|
|
144
|
-
this.
|
|
141
|
+
this.container.visible = this.visibleInternal && orientationActive;
|
|
145
142
|
}
|
|
146
|
-
|
|
147
|
-
this.
|
|
148
|
-
this.
|
|
149
|
-
this.
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
143
|
+
drawText(text) {
|
|
144
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
145
|
+
this.context.fillStyle = DEBUG_BADGE_BACKGROUND_COLOR;
|
|
146
|
+
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
147
|
+
this.context.fillStyle = this.tint.getHexStringRGB();
|
|
148
|
+
this.context.font = `${DEBUG_BADGE_FONT_SIZE}px ${DEBUG_BADGE_FONT_FAMILY}`;
|
|
149
|
+
this.context.textAlign = "center";
|
|
150
|
+
this.context.textBaseline = "middle";
|
|
151
|
+
this.context.fillText(text, this.canvas.width / 2, this.canvas.height / 2);
|
|
155
152
|
}
|
|
156
153
|
}
|
|
157
|
-
|
|
158
|
-
export { UIHorizontalDistanceDebug };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UIHorizontalInterpolationConstraint } from "../core";
|
|
2
|
-
import { UIColor } from "../core";
|
|
3
|
-
import type { UIConstraintDebug } from "./UIConstraintDebug";
|
|
1
|
+
import type { UIHorizontalInterpolationConstraint } from "../core/index.js";
|
|
2
|
+
import { UIColor } from "../core/index.js";
|
|
3
|
+
import type { UIConstraintDebug } from "./UIConstraintDebug.js";
|
|
4
4
|
export declare class UIHorizontalInterpolationDebug implements UIConstraintDebug {
|
|
5
5
|
readonly constraint: UIHorizontalInterpolationConstraint;
|
|
6
6
|
readonly tint: UIColor;
|