laymur 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -208
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
- package/dist/{constraints → core/constraints}/UIConstraint.d.ts +2 -2
- package/dist/core/constraints/UIConstraint.js +11 -0
- package/dist/core/constraints/UICustomConstraint.js +37 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
- package/dist/{elements → core/elements}/UIAnchor/UIAnchor.Internal.d.ts +3 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
- package/dist/{elements → core/elements}/UIAnchor/UIAnchor.d.ts +3 -3
- package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
- package/dist/{elements → core/elements}/UIDummy/UIDummy.d.ts +2 -2
- package/dist/core/elements/UIDummy/UIDummy.js +173 -0
- package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
- package/dist/{elements → core/elements}/UIElement/UIElement.d.ts +2 -2
- package/dist/core/elements/UIElement/UIElement.js +74 -0
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
- package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
- package/dist/core/elements/UIImage/UIImage.js +85 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
- package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
- package/dist/core/elements/UIProgress/UIProgress.js +165 -0
- package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
- package/dist/core/elements/UIScene/UIScene.js +157 -0
- package/dist/core/elements/UIText/UIText.Internal.js +12 -0
- package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
- package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
- package/dist/core/elements/UIText/UIText.js +265 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
- package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
- package/dist/core/layers/UILayer/UILayer.js +113 -0
- package/dist/core/miscellaneous/UIExpression.js +128 -0
- package/dist/core/miscellaneous/UIMode.js +30 -0
- package/dist/core/miscellaneous/UIOrientation.js +20 -0
- package/dist/core/miscellaneous/UIPriority.js +63 -0
- package/dist/core/miscellaneous/UIRelation.js +40 -0
- package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
- package/dist/core/miscellaneous/area/UIArea.js +5 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
- package/dist/core/miscellaneous/asserts.js +163 -0
- package/dist/core/miscellaneous/canvas.js +37 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
- package/dist/core/miscellaneous/color/UIColor.js +636 -0
- package/dist/core/miscellaneous/computeTransform.js +82 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
- package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
- package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
- package/dist/{miscellaneous → core/miscellaneous}/math.d.ts +2 -0
- package/dist/core/miscellaneous/math.js +11 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
- package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
- package/dist/core/miscellaneous/shared.js +37 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
- package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
- package/dist/core/miscellaneous/webglCapabilities.js +103 -0
- package/dist/core/shaders/UIImage.glsl.js +3 -0
- package/dist/core/shaders/UINineSlice.glsl.js +3 -0
- package/dist/core/shaders/UIProgress.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
- package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.d.ts +2 -2
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
- package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.d.ts +2 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
- package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.d.ts +2 -2
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
- package/dist/index.js +51 -9246
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
- package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
- package/dist/particles/elements/UIEmitter.Internal.js +11 -0
- package/dist/particles/elements/UIEmitter.d.ts +68 -0
- package/dist/particles/elements/UIEmitter.js +203 -0
- package/dist/particles/index.d.ts +18 -0
- package/dist/particles/index.js +18 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
- package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
- package/dist/particles/miscellaneous/miscellaneous.js +67 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
- package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
- package/dist/particles/spawnModules/UISpawnModule.js +9 -0
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
- package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
- package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
- package/package.json +27 -36
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UICustomConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIDummy/UIDummy.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIElement/UIElement.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIImage/UIImage.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIImage/UIImage.d.ts +0 -0
- /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIProgress/UIProgress.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIProgress/UIProgress.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIScene/UIScene.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIScene/UIScene.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Interfaces.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Measuring.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Rendering.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.d.ts +0 -0
- /package/dist/{index.d.ts → core/index.d.ts} +0 -0
- /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +0 -0
- /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -0
- /package/dist/{layers → core/layers}/UILayer/UILayer.Internal.d.ts +0 -0
- /package/dist/{layers → core/layers}/UILayer/UILayer.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIExpression.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIMode.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIOrientation.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIPriority.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIRelation.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UITransparencyMode.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIArea.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaCircle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaPolygon.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRectangle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRoundedRectangle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/asserts.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/canvas.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/computeTransform.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/shared.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunction.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicy.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCover.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCross.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFit.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyNone.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/shared.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/webglCapabilities.d.ts +0 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Ferrsign1 } from 'ferrsign';
|
|
2
|
+
import { MathUtils } from 'three';
|
|
3
|
+
import { UIAreaRectangle } from '../../miscellaneous/area/UIAreaRectangle.js';
|
|
4
|
+
import { assertValidPositiveNumber, assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
5
|
+
import { isUIModeInteractive, UIMode } from '../../miscellaneous/UIMode.js';
|
|
6
|
+
import { UIPriority } from '../../miscellaneous/UIPriority.js';
|
|
7
|
+
import { UIAnchor } from '../UIAnchor/UIAnchor.js';
|
|
8
|
+
import { DUMMY_DEFAULT_WIDTH, DUMMY_DEFAULT_HEIGHT, DUMMY_DEFAULT_MODE, DUMMY_DEFAULT_Z_INDEX } from './UIDummy.Internal.js';
|
|
9
|
+
|
|
10
|
+
/** Rectangular area with dimensions but no rendering */
|
|
11
|
+
class UIDummy extends UIAnchor {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new UIDummy instance.
|
|
14
|
+
*
|
|
15
|
+
* @param layer - Layer containing this element
|
|
16
|
+
* @param options - Configuration options
|
|
17
|
+
*/
|
|
18
|
+
constructor(layer, options) {
|
|
19
|
+
const w = options?.width ?? DUMMY_DEFAULT_WIDTH;
|
|
20
|
+
const h = options?.height ?? DUMMY_DEFAULT_HEIGHT;
|
|
21
|
+
assertValidPositiveNumber(w, "UIDummy.constructor.width");
|
|
22
|
+
assertValidPositiveNumber(h, "UIDummy.constructor.height");
|
|
23
|
+
super(layer, options);
|
|
24
|
+
this._private_wasPointerInside = false;
|
|
25
|
+
this._private_signalPointerPressedInternal = new Ferrsign1();
|
|
26
|
+
this._private_signalPointerMovedInternal = new Ferrsign1();
|
|
27
|
+
this._private_signalPointerReleasedInternal = new Ferrsign1();
|
|
28
|
+
this._private_signalPointerEnteredInternal = new Ferrsign1();
|
|
29
|
+
this._private_signalPointerLeftInternal = new Ferrsign1();
|
|
30
|
+
this.catchPointerDown = (x, y, identifier) => {
|
|
31
|
+
return this.handleInputEvent(x, y, identifier, this._private_signalPointerPressedInternal);
|
|
32
|
+
};
|
|
33
|
+
this.catchPointerMove = (x, y, identifier) => {
|
|
34
|
+
return this.handleInputEvent(x, y, identifier, this._private_signalPointerMovedInternal);
|
|
35
|
+
};
|
|
36
|
+
this.catchPointerUp = (x, y, identifier) => {
|
|
37
|
+
return this.handleInputEvent(x, y, identifier, this._private_signalPointerReleasedInternal);
|
|
38
|
+
};
|
|
39
|
+
this.interactionArea = options?.interactionArea ?? new UIAreaRectangle(0, 0, 1, 1);
|
|
40
|
+
this.modeInternal = options?.mode ?? DUMMY_DEFAULT_MODE;
|
|
41
|
+
this.inputWrapper = this.layer.inputWrapper;
|
|
42
|
+
this.wVariable = this.solverWrapper.createVariable(w, UIPriority.P6);
|
|
43
|
+
this.hVariable = this.solverWrapper.createVariable(h, UIPriority.P6);
|
|
44
|
+
this._private_catcherHandler = this.inputWrapper.createInputCatcher(this.catchPointerDown, this.catchPointerMove, this.catchPointerUp, DUMMY_DEFAULT_Z_INDEX);
|
|
45
|
+
this.inputWrapper.setActive(this._private_catcherHandler, isUIModeInteractive(this.modeInternal));
|
|
46
|
+
}
|
|
47
|
+
/** Width in world units */
|
|
48
|
+
get width() {
|
|
49
|
+
return this.solverWrapper.readVariableValue(this.wVariable);
|
|
50
|
+
}
|
|
51
|
+
/** Height in world units */
|
|
52
|
+
get height() {
|
|
53
|
+
return this.solverWrapper.readVariableValue(this.hVariable);
|
|
54
|
+
}
|
|
55
|
+
/** X coordinate of right edge */
|
|
56
|
+
get oppositeX() {
|
|
57
|
+
return this.x + this.width;
|
|
58
|
+
}
|
|
59
|
+
/** Y coordinate of top edge */
|
|
60
|
+
get oppositeY() {
|
|
61
|
+
return this.y + this.height;
|
|
62
|
+
}
|
|
63
|
+
/** X coordinate of horizontal center */
|
|
64
|
+
get centerX() {
|
|
65
|
+
return this.x + this.width / 2;
|
|
66
|
+
}
|
|
67
|
+
/** Y coordinate of vertical center */
|
|
68
|
+
get centerY() {
|
|
69
|
+
return this.y + this.height / 2;
|
|
70
|
+
}
|
|
71
|
+
/** Controls visibility and interactivity */
|
|
72
|
+
get mode() {
|
|
73
|
+
return this.modeInternal;
|
|
74
|
+
}
|
|
75
|
+
/** Rendering and input priority. Higher values on top. */
|
|
76
|
+
get zIndex() {
|
|
77
|
+
return this.inputWrapper.getZIndex(this._private_catcherHandler);
|
|
78
|
+
}
|
|
79
|
+
/** Signal fired when pointer is pressed */
|
|
80
|
+
get signalPointerPressed() {
|
|
81
|
+
return this._private_signalPointerPressedInternal;
|
|
82
|
+
}
|
|
83
|
+
/** Signal fired when pointer is moved */
|
|
84
|
+
get signalPointerMoved() {
|
|
85
|
+
return this._private_signalPointerMovedInternal;
|
|
86
|
+
}
|
|
87
|
+
/** Signal fired when pointer is released */
|
|
88
|
+
get signalPointerReleased() {
|
|
89
|
+
return this._private_signalPointerReleasedInternal;
|
|
90
|
+
}
|
|
91
|
+
/** Signal fired when pointer enters element */
|
|
92
|
+
get signalPointerEntered() {
|
|
93
|
+
return this._private_signalPointerEnteredInternal;
|
|
94
|
+
}
|
|
95
|
+
/** Signal fired when pointer leaves element */
|
|
96
|
+
get signalPointerLeft() {
|
|
97
|
+
return this._private_signalPointerLeftInternal;
|
|
98
|
+
}
|
|
99
|
+
/** Width in world units */
|
|
100
|
+
set width(value) {
|
|
101
|
+
assertValidPositiveNumber(value, "UIDummy.width");
|
|
102
|
+
this.solverWrapper.suggestVariableValue(this.wVariable, value);
|
|
103
|
+
}
|
|
104
|
+
/** Height in world units */
|
|
105
|
+
set height(value) {
|
|
106
|
+
assertValidPositiveNumber(value, "UIDummy.height");
|
|
107
|
+
this.solverWrapper.suggestVariableValue(this.hVariable, value);
|
|
108
|
+
}
|
|
109
|
+
/** X coordinate of right edge */
|
|
110
|
+
set oppositeX(value) {
|
|
111
|
+
assertValidNumber(value, "UIDummy.oppositeX");
|
|
112
|
+
this.x = value - this.width;
|
|
113
|
+
}
|
|
114
|
+
/** Y coordinate of top edge */
|
|
115
|
+
set oppositeY(value) {
|
|
116
|
+
assertValidNumber(value, "UIDummy.oppositeY");
|
|
117
|
+
this.y = value - this.height;
|
|
118
|
+
}
|
|
119
|
+
/** X coordinate of horizontal center */
|
|
120
|
+
set centerX(value) {
|
|
121
|
+
assertValidNumber(value, "UIDummy.centerX");
|
|
122
|
+
this.x = value - this.width / 2;
|
|
123
|
+
}
|
|
124
|
+
/** Y coordinate of vertical center */
|
|
125
|
+
set centerY(value) {
|
|
126
|
+
assertValidNumber(value, "UIDummy.centerY");
|
|
127
|
+
this.y = value - this.height / 2;
|
|
128
|
+
}
|
|
129
|
+
/** Controls visibility and interactivity */
|
|
130
|
+
set mode(value) {
|
|
131
|
+
if (this.modeInternal !== value) {
|
|
132
|
+
const newInteractivity = isUIModeInteractive(value);
|
|
133
|
+
this.inputWrapper.setActive(this._private_catcherHandler, newInteractivity);
|
|
134
|
+
this.modeInternal = value;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Rendering and input priority. Higher values on top. */
|
|
138
|
+
set zIndex(value) {
|
|
139
|
+
assertValidNumber(value, "UIDummy.zIndex");
|
|
140
|
+
this.inputWrapper.setZIndex(this._private_catcherHandler, value);
|
|
141
|
+
}
|
|
142
|
+
/** Removes element and frees resources */
|
|
143
|
+
destroy() {
|
|
144
|
+
this.solverWrapper.removeVariable(this.hVariable);
|
|
145
|
+
this.solverWrapper.removeVariable(this.wVariable);
|
|
146
|
+
this.inputWrapper.destroyInputCatcher(this._private_catcherHandler);
|
|
147
|
+
super.destroy();
|
|
148
|
+
}
|
|
149
|
+
handleInputEvent(x, y, identifier, signal) {
|
|
150
|
+
assertValidNumber(x, "UIDummy.handleInputEvent.x");
|
|
151
|
+
assertValidNumber(y, "UIDummy.handleInputEvent.y");
|
|
152
|
+
assertValidNumber(identifier, "UIDummy.handleInputEvent.identifier");
|
|
153
|
+
const isPointerInside = this.interactionArea.contains(MathUtils.mapLinear(x, this.x, this.oppositeX, 0, 1), MathUtils.mapLinear(y, this.y, this.oppositeY, 0, 1));
|
|
154
|
+
if (isPointerInside) {
|
|
155
|
+
signal.emit({ x, y, identifier, element: this });
|
|
156
|
+
}
|
|
157
|
+
if (this._private_wasPointerInside && !isPointerInside) {
|
|
158
|
+
this._private_signalPointerLeftInternal.emit({ x, y, identifier, element: this });
|
|
159
|
+
}
|
|
160
|
+
else if (!this._private_wasPointerInside && isPointerInside) {
|
|
161
|
+
this._private_signalPointerEnteredInternal.emit({
|
|
162
|
+
x,
|
|
163
|
+
y,
|
|
164
|
+
identifier,
|
|
165
|
+
element: this,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
this._private_wasPointerInside = isPointerInside;
|
|
169
|
+
return this.modeInternal !== UIMode.INTERACTIVE_TRANSPARENT && isPointerInside;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { UIDummy };
|
|
@@ -4,14 +4,14 @@ import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
|
|
|
4
4
|
import { UIMicro } from "../../miscellaneous/micro/UIMicro";
|
|
5
5
|
import type { UIMode } from "../../miscellaneous/UIMode";
|
|
6
6
|
import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode";
|
|
7
|
-
import type {
|
|
7
|
+
import type { UISceneWrapperView } from "../../wrappers/UISceneWrapper/UISceneWrapper.Internal";
|
|
8
8
|
import { UIDummy } from "../UIDummy/UIDummy";
|
|
9
9
|
import type { UIElementOptions } from "./UIElement.Internal";
|
|
10
10
|
/** Base class for renderable UI elements */
|
|
11
11
|
export declare abstract class UIElement extends UIDummy {
|
|
12
12
|
/** Transforms that don't affect constraints */
|
|
13
13
|
readonly micro: UIMicro;
|
|
14
|
-
protected readonly sceneWrapper:
|
|
14
|
+
protected readonly sceneWrapper: UISceneWrapperView;
|
|
15
15
|
protected planeHandler: number;
|
|
16
16
|
private transparencyModeInternal;
|
|
17
17
|
private transparencyModeDirty;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Matrix4 } from 'three';
|
|
2
|
+
import { computeTransformMatrix } from '../../miscellaneous/computeTransform.js';
|
|
3
|
+
import { UIMicro } from '../../miscellaneous/micro/UIMicro.js';
|
|
4
|
+
import { isUIModeVisible } from '../../miscellaneous/UIMode.js';
|
|
5
|
+
import { UIDummy } from '../UIDummy/UIDummy.js';
|
|
6
|
+
import { ELEMENT_DEFAULT_TRANSPARENCY_MODE } from './UIElement.Internal.js';
|
|
7
|
+
|
|
8
|
+
/** Base class for renderable UI elements */
|
|
9
|
+
class UIElement extends UIDummy {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new UIElement instance.
|
|
12
|
+
*
|
|
13
|
+
* @param layer - Layer containing this element
|
|
14
|
+
* @param source - GLSL shader source code
|
|
15
|
+
* @param properties - Shader uniform properties
|
|
16
|
+
* @param options - Configuration options
|
|
17
|
+
*/
|
|
18
|
+
constructor(layer, source, properties, options) {
|
|
19
|
+
super(layer, options);
|
|
20
|
+
this._private_transparencyModeDirty = false;
|
|
21
|
+
this._private_visibilityDirty = false;
|
|
22
|
+
this._private_handleWillRender = (renderer, deltaTime) => {
|
|
23
|
+
this.onWillRender(renderer, deltaTime);
|
|
24
|
+
};
|
|
25
|
+
this.micro = new UIMicro(options?.micro);
|
|
26
|
+
this._private_transparencyModeInternal = options?.transparencyMode ?? ELEMENT_DEFAULT_TRANSPARENCY_MODE;
|
|
27
|
+
this.sceneWrapper = this.layer.sceneWrapper;
|
|
28
|
+
this.planeHandler = this.sceneWrapper.createPlane(source, properties, new Matrix4().identity(), isUIModeVisible(options?.mode ?? this.mode), this._private_transparencyModeInternal);
|
|
29
|
+
this.layer.signalRendering.on(this._private_handleWillRender);
|
|
30
|
+
}
|
|
31
|
+
/** Alpha blending mode */
|
|
32
|
+
get transparencyMode() {
|
|
33
|
+
return this._private_transparencyModeInternal;
|
|
34
|
+
}
|
|
35
|
+
/** Alpha blending mode */
|
|
36
|
+
set transparencyMode(value) {
|
|
37
|
+
if (this._private_transparencyModeInternal !== value) {
|
|
38
|
+
this._private_transparencyModeInternal = value;
|
|
39
|
+
this._private_transparencyModeDirty = true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
set mode(value) {
|
|
43
|
+
if (this.modeInternal !== value) {
|
|
44
|
+
this._private_visibilityDirty = isUIModeVisible(this.modeInternal) !== isUIModeVisible(value);
|
|
45
|
+
super.mode = value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Removes element and frees resources */
|
|
49
|
+
destroy() {
|
|
50
|
+
this.layer.signalRendering.off(this._private_handleWillRender);
|
|
51
|
+
this.sceneWrapper.destroyPlane(this.planeHandler);
|
|
52
|
+
super.destroy();
|
|
53
|
+
}
|
|
54
|
+
setPlaneTransform() {
|
|
55
|
+
if (this.micro.dirty || this.inputWrapper.dirty || this.solverWrapper.dirty) {
|
|
56
|
+
this.sceneWrapper.setTransform(this.planeHandler, computeTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, this.micro.x, this.micro.y, this.micro.anchorX, this.micro.anchorY, this.micro.scaleX, this.micro.scaleY, this.micro.rotation, this.micro.anchorMode));
|
|
57
|
+
this.micro.setDirtyFalse();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Required by UILayer event interface but not used in base implementation
|
|
61
|
+
onWillRender(renderer, deltaTime) {
|
|
62
|
+
if (this._private_transparencyModeDirty) {
|
|
63
|
+
this.sceneWrapper.setTransparency(this.planeHandler, this._private_transparencyModeInternal);
|
|
64
|
+
this._private_transparencyModeDirty = false;
|
|
65
|
+
}
|
|
66
|
+
if (this._private_visibilityDirty) {
|
|
67
|
+
this.sceneWrapper.setVisibility(this.planeHandler, isUIModeVisible(this.modeInternal));
|
|
68
|
+
this._private_visibilityDirty = false;
|
|
69
|
+
}
|
|
70
|
+
this.setPlaneTransform();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { UIElement };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UIColor } from '../../miscellaneous/color/UIColor.js';
|
|
2
|
+
|
|
3
|
+
const GRAPHICS_DEFAULT_WIDTH = 2;
|
|
4
|
+
const GRAPHICS_DEFAULT_HEIGHT = 2;
|
|
5
|
+
const GRAPHICS_TEMP_COLOR = new UIColor();
|
|
6
|
+
|
|
7
|
+
export { GRAPHICS_DEFAULT_HEIGHT, GRAPHICS_DEFAULT_WIDTH, GRAPHICS_TEMP_COLOR };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Matrix3 } from 'three';
|
|
2
|
+
import { createCanvas, createCanvasTexture } from '../../miscellaneous/canvas.js';
|
|
3
|
+
import { UIColor } from '../../miscellaneous/color/UIColor.js';
|
|
4
|
+
import source from '../../shaders/UIImage.glsl.js';
|
|
5
|
+
import { UIElement } from '../UIElement/UIElement.js';
|
|
6
|
+
import { GRAPHICS_DEFAULT_WIDTH, GRAPHICS_DEFAULT_HEIGHT, GRAPHICS_TEMP_COLOR } from './UIGraphics.Internal.js';
|
|
7
|
+
|
|
8
|
+
/** Canvas-based 2D drawing element */
|
|
9
|
+
class UIGraphics extends UIElement {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new UIGraphics instance.
|
|
12
|
+
*
|
|
13
|
+
* @param layer - Layer containing this element
|
|
14
|
+
* @param options - Configuration options
|
|
15
|
+
*/
|
|
16
|
+
constructor(layer, options) {
|
|
17
|
+
const w = options?.width ?? GRAPHICS_DEFAULT_WIDTH;
|
|
18
|
+
const h = options?.height ?? GRAPHICS_DEFAULT_HEIGHT;
|
|
19
|
+
const color = new UIColor(options?.color);
|
|
20
|
+
const canvas = createCanvas(w, h);
|
|
21
|
+
const context = canvas.getContext("2d");
|
|
22
|
+
if (!context) {
|
|
23
|
+
throw new Error("UIGraphics.constructor: failed to get 2D context from canvas");
|
|
24
|
+
}
|
|
25
|
+
const texture = createCanvasTexture(canvas);
|
|
26
|
+
texture.needsUpdate = true;
|
|
27
|
+
super(layer, source, {
|
|
28
|
+
texture: texture,
|
|
29
|
+
textureTransform: new Matrix3(),
|
|
30
|
+
color,
|
|
31
|
+
}, options);
|
|
32
|
+
this._private_canvas = canvas;
|
|
33
|
+
this._private_context = context;
|
|
34
|
+
this._private_texture = texture;
|
|
35
|
+
this._private_colorInternal = color;
|
|
36
|
+
}
|
|
37
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
38
|
+
get color() {
|
|
39
|
+
return this._private_colorInternal;
|
|
40
|
+
}
|
|
41
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
42
|
+
set color(value) {
|
|
43
|
+
this._private_colorInternal.set(value);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Clears canvas. Optionally fills with color.
|
|
47
|
+
*
|
|
48
|
+
* @param color - Fill color after clearing
|
|
49
|
+
*/
|
|
50
|
+
clear(color) {
|
|
51
|
+
this._private_context.clearRect(0, 0, this._private_canvas.width, this._private_canvas.height);
|
|
52
|
+
if (color !== undefined) {
|
|
53
|
+
this._private_context.fillStyle = GRAPHICS_TEMP_COLOR.set(color).toCSSColor();
|
|
54
|
+
this._private_context.fillRect(0, 0, this._private_canvas.width, this._private_canvas.height);
|
|
55
|
+
}
|
|
56
|
+
this._private_texture.needsUpdate = true;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
/** Draws filled rectangle */
|
|
60
|
+
drawRect(x, y, width, height, color) {
|
|
61
|
+
this._private_context.fillStyle = GRAPHICS_TEMP_COLOR.set(color).toCSSColor();
|
|
62
|
+
this._private_context.fillRect(x, y, width, height);
|
|
63
|
+
this._private_texture.needsUpdate = true;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
/** Draws filled circle */
|
|
67
|
+
drawCircle(x, y, radius, color) {
|
|
68
|
+
this._private_context.fillStyle = GRAPHICS_TEMP_COLOR.set(color).toCSSColor();
|
|
69
|
+
this._private_context.beginPath();
|
|
70
|
+
this._private_context.arc(x, y, radius, 0, Math.PI * 2);
|
|
71
|
+
this._private_context.fill();
|
|
72
|
+
this._private_texture.needsUpdate = true;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Draws filled arc.
|
|
77
|
+
*
|
|
78
|
+
* @param startAngle - Start angle in radians
|
|
79
|
+
* @param endAngle - End angle in radians
|
|
80
|
+
*/
|
|
81
|
+
drawArc(x, y, radius, startAngle, endAngle, color) {
|
|
82
|
+
this._private_context.fillStyle = GRAPHICS_TEMP_COLOR.set(color).toCSSColor();
|
|
83
|
+
this._private_context.beginPath();
|
|
84
|
+
this._private_context.arc(x, y, radius, startAngle, endAngle);
|
|
85
|
+
this._private_context.fill();
|
|
86
|
+
this._private_texture.needsUpdate = true;
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Draws connected line segments.
|
|
91
|
+
*
|
|
92
|
+
* @param points - Array of [x, y] pairs
|
|
93
|
+
* @param lineWidth - Line width in pixels
|
|
94
|
+
*/
|
|
95
|
+
drawPolyline(points, color, lineWidth = 1) {
|
|
96
|
+
if (points.length < 2) {
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
this._private_context.strokeStyle = GRAPHICS_TEMP_COLOR.set(color).toCSSColor();
|
|
100
|
+
this._private_context.lineWidth = lineWidth;
|
|
101
|
+
this._private_context.beginPath();
|
|
102
|
+
this._private_context.moveTo(points[0][0], points[0][1]);
|
|
103
|
+
for (let i = 1; i < points.length; i++) {
|
|
104
|
+
this._private_context.lineTo(points[i][0], points[i][1]);
|
|
105
|
+
}
|
|
106
|
+
this._private_context.stroke();
|
|
107
|
+
this._private_texture.needsUpdate = true;
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
/** Removes element and frees resources */
|
|
111
|
+
destroy() {
|
|
112
|
+
this._private_texture.dispose();
|
|
113
|
+
super.destroy();
|
|
114
|
+
}
|
|
115
|
+
onWillRender(renderer, deltaTime) {
|
|
116
|
+
if (this._private_colorInternal.dirty) {
|
|
117
|
+
this.sceneWrapper.setProperties(this.planeHandler, {
|
|
118
|
+
color: this._private_colorInternal,
|
|
119
|
+
});
|
|
120
|
+
this._private_colorInternal.setDirtyFalse();
|
|
121
|
+
}
|
|
122
|
+
super.onWillRender(renderer, deltaTime);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { UIGraphics };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { UIColor } from '../../miscellaneous/color/UIColor.js';
|
|
2
|
+
import { computeTrimmedTransformMatrix } from '../../miscellaneous/computeTransform.js';
|
|
3
|
+
import { UITextureView } from '../../miscellaneous/texture/UITextureView.js';
|
|
4
|
+
import source from '../../shaders/UIImage.glsl.js';
|
|
5
|
+
import { UIElement } from '../UIElement/UIElement.js';
|
|
6
|
+
|
|
7
|
+
/** Textured image element */
|
|
8
|
+
class UIImage extends UIElement {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new UIImage instance.
|
|
11
|
+
*
|
|
12
|
+
* Defaults size to texture dimensions if width and height not provided.
|
|
13
|
+
*
|
|
14
|
+
* @param layer - Layer containing this image
|
|
15
|
+
* @param texture - Texture to display
|
|
16
|
+
* @param options - Configuration options
|
|
17
|
+
*/
|
|
18
|
+
constructor(layer, texture, options = {}) {
|
|
19
|
+
const color = new UIColor(options.color);
|
|
20
|
+
const textureView = new UITextureView(texture);
|
|
21
|
+
const textureTransform = textureView.calculateUVTransform();
|
|
22
|
+
options.width = options.width ?? textureView.width;
|
|
23
|
+
options.height = options.height ?? textureView.height;
|
|
24
|
+
super(layer, source, {
|
|
25
|
+
texture: textureView.texture,
|
|
26
|
+
textureTransform: textureTransform,
|
|
27
|
+
color,
|
|
28
|
+
}, options);
|
|
29
|
+
this._private_onTextureDimensionsChanged = (width, height) => {
|
|
30
|
+
this.width = width;
|
|
31
|
+
this.height = height;
|
|
32
|
+
};
|
|
33
|
+
this.texture = textureView;
|
|
34
|
+
this._private_textureTransform = textureTransform;
|
|
35
|
+
this._private_colorInternal = color;
|
|
36
|
+
this.texture.signalDiminsionsChanged.on(this._private_onTextureDimensionsChanged);
|
|
37
|
+
}
|
|
38
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
39
|
+
get color() {
|
|
40
|
+
return this._private_colorInternal;
|
|
41
|
+
}
|
|
42
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
43
|
+
set color(value) {
|
|
44
|
+
this._private_colorInternal.set(value);
|
|
45
|
+
}
|
|
46
|
+
/** Removes image and frees resources */
|
|
47
|
+
destroy() {
|
|
48
|
+
this.texture.signalDiminsionsChanged.off(this._private_onTextureDimensionsChanged);
|
|
49
|
+
super.destroy();
|
|
50
|
+
}
|
|
51
|
+
setPlaneTransform() {
|
|
52
|
+
let properties;
|
|
53
|
+
if (this._private_colorInternal.dirty) {
|
|
54
|
+
properties ?? (properties = {});
|
|
55
|
+
properties["color"] = this._private_colorInternal;
|
|
56
|
+
this._private_colorInternal.setDirtyFalse();
|
|
57
|
+
}
|
|
58
|
+
if (this.texture.textureDirty) {
|
|
59
|
+
properties ?? (properties = {});
|
|
60
|
+
properties["texture"] = this.texture.texture;
|
|
61
|
+
this.texture.setTextureDirtyFalse();
|
|
62
|
+
}
|
|
63
|
+
if (this.texture.uvTransformDirty) {
|
|
64
|
+
properties ?? (properties = {});
|
|
65
|
+
properties["textureTransform"] = this.texture.calculateUVTransform(this._private_textureTransform);
|
|
66
|
+
this.texture.setUVTransformDirtyFalse();
|
|
67
|
+
}
|
|
68
|
+
if (properties) {
|
|
69
|
+
this.sceneWrapper.setProperties(this.planeHandler, properties);
|
|
70
|
+
}
|
|
71
|
+
const isTransformDirty = this.micro.dirty ||
|
|
72
|
+
this.texture.trimDirty ||
|
|
73
|
+
this.inputWrapper.dirty ||
|
|
74
|
+
this.solverWrapper.dirty;
|
|
75
|
+
if (isTransformDirty) {
|
|
76
|
+
const micro = this.micro;
|
|
77
|
+
const textureTrim = this.texture.trim;
|
|
78
|
+
this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
|
|
79
|
+
this.micro.setDirtyFalse();
|
|
80
|
+
this.texture.setTrimDirtyFalse();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { UIImage };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Controls how sliceRegions values are interpreted */
|
|
2
|
+
var UINineSliceRegionMode;
|
|
3
|
+
(function (UINineSliceRegionMode) {
|
|
4
|
+
/** sliceRegions in normalized coordinates (0 to 1) */
|
|
5
|
+
UINineSliceRegionMode[UINineSliceRegionMode["NORMALIZED"] = 0] = "NORMALIZED";
|
|
6
|
+
/** sliceRegions in world units */
|
|
7
|
+
UINineSliceRegionMode[UINineSliceRegionMode["WORLD"] = 1] = "WORLD";
|
|
8
|
+
})(UINineSliceRegionMode || (UINineSliceRegionMode = {}));
|
|
9
|
+
const NINE_SLICE_DEFAULT_BORDER = 0.1;
|
|
10
|
+
const NINE_SLICE_DEFAULT_REGION_MODE = UINineSliceRegionMode.WORLD;
|
|
11
|
+
|
|
12
|
+
export { NINE_SLICE_DEFAULT_BORDER, NINE_SLICE_DEFAULT_REGION_MODE, UINineSliceRegionMode };
|