laymur 0.23.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/README.md +1 -1
  2. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
  3. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.js +1 -0
  4. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +3 -3
  5. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +14 -16
  6. package/dist/core/constraints/UIConstraint.d.ts +22 -2
  7. package/dist/core/constraints/UIConstraint.js +26 -3
  8. package/dist/core/constraints/UICustomConstraint.d.ts +4 -4
  9. package/dist/core/constraints/UICustomConstraint.js +15 -15
  10. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
  11. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.js +1 -0
  12. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +3 -3
  13. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +11 -13
  14. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
  15. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +1 -3
  16. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +3 -3
  17. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +30 -30
  18. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
  19. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +2 -4
  20. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +3 -3
  21. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +40 -39
  22. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
  23. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js +1 -0
  24. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +3 -3
  25. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +13 -15
  26. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +3 -3
  27. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js +1 -0
  28. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +13 -7
  29. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +37 -30
  30. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
  31. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +1 -3
  32. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +3 -3
  33. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +30 -30
  34. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
  35. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +2 -4
  36. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +3 -3
  37. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +40 -39
  38. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
  39. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js +1 -0
  40. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +3 -3
  41. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +13 -15
  42. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
  43. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.js +1 -0
  44. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +3 -3
  45. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +11 -13
  46. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +3 -3
  47. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +1 -3
  48. package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +11 -11
  49. package/dist/core/constraints/builders/UIConstraint2DBuilder.js +10 -13
  50. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +1 -1
  51. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +1 -3
  52. package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +7 -7
  53. package/dist/core/constraints/builders/UICoverConstraintBuilder.js +10 -13
  54. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +1 -1
  55. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +1 -3
  56. package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +7 -7
  57. package/dist/core/constraints/builders/UIFitConstraintBuilder.js +10 -13
  58. package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +3 -5
  59. package/dist/core/elements/UIAnchor/UIAnchor.d.ts +23 -5
  60. package/dist/core/elements/UIAnchor/UIAnchor.js +42 -8
  61. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +2 -2
  62. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +4 -6
  63. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +10 -10
  64. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +108 -111
  65. package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +4 -4
  66. package/dist/core/elements/UIDummy/UIDummy.Internal.js +5 -8
  67. package/dist/core/elements/UIDummy/UIDummy.d.ts +19 -11
  68. package/dist/core/elements/UIDummy/UIDummy.js +59 -42
  69. package/dist/core/elements/UIElement/UIElement.Internal.d.ts +5 -5
  70. package/dist/core/elements/UIElement/UIElement.Internal.js +9 -12
  71. package/dist/core/elements/UIElement/UIElement.d.ts +11 -11
  72. package/dist/core/elements/UIElement/UIElement.js +57 -60
  73. package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +3 -3
  74. package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +4 -7
  75. package/dist/core/elements/UIGraphics/UIGraphics.d.ts +7 -7
  76. package/dist/core/elements/UIGraphics/UIGraphics.js +44 -47
  77. package/dist/core/elements/UIImage/UIImage.Internal.d.ts +2 -2
  78. package/dist/core/elements/UIImage/UIImage.Internal.js +1 -0
  79. package/dist/core/elements/UIImage/UIImage.d.ts +9 -9
  80. package/dist/core/elements/UIImage/UIImage.js +21 -24
  81. package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +3 -3
  82. package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +3 -5
  83. package/dist/core/elements/UINineSlice/UINineSlice.d.ts +12 -12
  84. package/dist/core/elements/UINineSlice/UINineSlice.js +71 -73
  85. package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +3 -4
  86. package/dist/core/elements/UIProgress/UIProgress.Internal.js +1 -3
  87. package/dist/core/elements/UIProgress/UIProgress.d.ts +10 -10
  88. package/dist/core/elements/UIProgress/UIProgress.js +59 -62
  89. package/dist/core/elements/UIScene/UIScene.Internal.d.ts +3 -3
  90. package/dist/core/elements/UIScene/UIScene.Internal.js +11 -14
  91. package/dist/core/elements/UIScene/UIScene.d.ts +8 -8
  92. package/dist/core/elements/UIScene/UIScene.js +68 -69
  93. package/dist/core/elements/UIText/UIText.Bidi.d.ts +2 -2
  94. package/dist/core/elements/UIText/UIText.Bidi.js +3 -5
  95. package/dist/core/elements/UIText/UIText.Interfaces.d.ts +6 -2
  96. package/dist/core/elements/UIText/UIText.Interfaces.js +1 -0
  97. package/dist/core/elements/UIText/UIText.Internal.d.ts +4 -4
  98. package/dist/core/elements/UIText/UIText.Internal.js +5 -7
  99. package/dist/core/elements/UIText/UIText.Measuring.d.ts +14 -7
  100. package/dist/core/elements/UIText/UIText.Measuring.js +115 -55
  101. package/dist/core/elements/UIText/UIText.Rendering.d.ts +3 -3
  102. package/dist/core/elements/UIText/UIText.Rendering.js +6 -9
  103. package/dist/core/elements/UIText/UIText.d.ts +28 -14
  104. package/dist/core/elements/UIText/UIText.js +181 -141
  105. package/dist/core/index.d.ts +55 -54
  106. package/dist/core/index.js +53 -0
  107. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +4 -4
  108. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +2 -5
  109. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +4 -4
  110. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +43 -42
  111. package/dist/core/layers/UILayer/UILayer.Internal.d.ts +2 -2
  112. package/dist/core/layers/UILayer/UILayer.Internal.js +4 -7
  113. package/dist/core/layers/UILayer/UILayer.d.ts +19 -4
  114. package/dist/core/layers/UILayer/UILayer.js +125 -62
  115. package/dist/core/miscellaneous/UIBlendMode.js +1 -3
  116. package/dist/core/miscellaneous/UIExpression.js +16 -19
  117. package/dist/core/miscellaneous/UIMode.js +3 -5
  118. package/dist/core/miscellaneous/UIOrientation.js +2 -4
  119. package/dist/core/miscellaneous/UIPriority.js +5 -8
  120. package/dist/core/miscellaneous/UIRelation.js +5 -8
  121. package/dist/core/miscellaneous/UITransparencyMode.js +1 -3
  122. package/dist/core/miscellaneous/area/UIArea.js +1 -3
  123. package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -1
  124. package/dist/core/miscellaneous/area/UIAreaCircle.js +3 -6
  125. package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +2 -2
  126. package/dist/core/miscellaneous/area/UIAreaPolygon.js +3 -6
  127. package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -1
  128. package/dist/core/miscellaneous/area/UIAreaRectangle.js +3 -6
  129. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -1
  130. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +3 -6
  131. package/dist/core/miscellaneous/asserts.d.ts +30 -1
  132. package/dist/core/miscellaneous/asserts.js +87 -19
  133. package/dist/core/miscellaneous/canvas.js +13 -7
  134. package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +1 -1
  135. package/dist/core/miscellaneous/color/UIColor.Internal.js +1 -3
  136. package/dist/core/miscellaneous/color/UIColor.d.ts +1 -1
  137. package/dist/core/miscellaneous/color/UIColor.js +202 -205
  138. package/dist/core/miscellaneous/computeTransform.d.ts +1 -1
  139. package/dist/core/miscellaneous/computeTransform.js +4 -7
  140. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +10 -5
  141. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +63 -58
  142. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.d.ts +52 -0
  143. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.js +110 -0
  144. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +181 -261
  145. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +3 -3
  146. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.js +1 -0
  147. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +209 -115
  148. package/dist/core/miscellaneous/generic-plane/shared.d.ts +12 -12
  149. package/dist/core/miscellaneous/generic-plane/shared.js +28 -23
  150. package/dist/core/miscellaneous/insets/UIInsets.Internal.js +1 -3
  151. package/dist/core/miscellaneous/insets/UIInsets.d.ts +1 -1
  152. package/dist/core/miscellaneous/insets/UIInsets.js +96 -99
  153. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +1 -3
  154. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +1 -1
  155. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +14 -17
  156. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -2
  157. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +13 -16
  158. package/dist/core/miscellaneous/math.js +3 -5
  159. package/dist/core/miscellaneous/micro/UIMicro.Internal.js +6 -8
  160. package/dist/core/miscellaneous/micro/UIMicro.d.ts +1 -1
  161. package/dist/core/miscellaneous/micro/UIMicro.js +91 -94
  162. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +1 -3
  163. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +1 -1
  164. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +12 -15
  165. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +1 -1
  166. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +13 -16
  167. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +1 -1
  168. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +13 -16
  169. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +1 -1
  170. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +12 -15
  171. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +1 -1
  172. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +13 -16
  173. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +1 -1
  174. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +13 -16
  175. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +1 -1
  176. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +3 -6
  177. package/dist/core/miscellaneous/shared.d.ts +1 -1
  178. package/dist/core/miscellaneous/shared.js +4 -7
  179. package/dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts +1 -1
  180. package/dist/core/miscellaneous/text-span/UITextSpan.Internal.js +1 -0
  181. package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +2 -2
  182. package/dist/core/miscellaneous/text-span/UITextSpan.js +10 -13
  183. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +15 -17
  184. package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +13 -2
  185. package/dist/core/miscellaneous/text-style/UITextStyle.js +222 -207
  186. package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +7 -0
  187. package/dist/core/miscellaneous/texture/UITextureView.Internal.js +16 -6
  188. package/dist/core/miscellaneous/texture/UITextureView.d.ts +1 -1
  189. package/dist/core/miscellaneous/texture/UITextureView.js +113 -117
  190. package/dist/core/miscellaneous/webglCapabilities.js +3 -4
  191. package/dist/core/shaders/UIImage.d.ts +9 -0
  192. package/dist/core/shaders/UIImage.js +14 -0
  193. package/dist/core/shaders/UINineSlice.d.ts +11 -0
  194. package/dist/core/shaders/UINineSlice.js +57 -0
  195. package/dist/core/shaders/UIProgress.d.ts +14 -0
  196. package/dist/core/shaders/UIProgress.js +21 -0
  197. package/dist/core/shaders/UIProgressMaskFunctionCircular.d.ts +2 -0
  198. package/dist/core/shaders/UIProgressMaskFunctionCircular.js +16 -0
  199. package/dist/core/shaders/UIProgressMaskFunctionDirectional.d.ts +2 -0
  200. package/dist/core/shaders/UIProgressMaskFunctionDirectional.js +15 -0
  201. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +4 -0
  202. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.js +1 -0
  203. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +7 -1
  204. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +50 -47
  205. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +5 -2
  206. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.js +1 -0
  207. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +11 -3
  208. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +42 -26
  209. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +5 -3
  210. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.js +1 -0
  211. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +20 -4
  212. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +138 -117
  213. package/dist/debug/UIAspectDebug.d.ts +3 -3
  214. package/dist/debug/UIAspectDebug.js +64 -68
  215. package/dist/debug/UIConstraintDebug.d.ts +1 -1
  216. package/dist/debug/UIConstraintDebug.js +1 -0
  217. package/dist/debug/UIHeightDebug.d.ts +3 -3
  218. package/dist/debug/UIHeightDebug.js +63 -67
  219. package/dist/debug/UIHorizontalDistanceDebug.d.ts +3 -3
  220. package/dist/debug/UIHorizontalDistanceDebug.js +76 -81
  221. package/dist/debug/UIHorizontalInterpolationDebug.d.ts +3 -3
  222. package/dist/debug/UIHorizontalInterpolationDebug.js +74 -78
  223. package/dist/debug/UILayerDebug.d.ts +1 -1
  224. package/dist/debug/UILayerDebug.js +55 -64
  225. package/dist/debug/UIVerticalDistanceDebug.d.ts +3 -3
  226. package/dist/debug/UIVerticalDistanceDebug.js +76 -81
  227. package/dist/debug/UIVerticalInterpolationDebug.d.ts +3 -3
  228. package/dist/debug/UIVerticalInterpolationDebug.js +74 -78
  229. package/dist/debug/UIWidthDebug.d.ts +3 -3
  230. package/dist/debug/UIWidthDebug.js +63 -67
  231. package/dist/debug/index.d.ts +8 -8
  232. package/dist/debug/index.js +8 -8
  233. package/dist/debug/miscellaneous.js +8 -11
  234. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +3 -3
  235. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +13 -16
  236. package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +1 -1
  237. package/dist/particles/behaviorModules/UIBehaviorModule.js +1 -3
  238. package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +3 -3
  239. package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +37 -40
  240. package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +41 -0
  241. package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +87 -0
  242. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +2 -2
  243. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +17 -20
  244. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
  245. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +13 -16
  246. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +2 -2
  247. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +21 -24
  248. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +2 -2
  249. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +13 -16
  250. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +2 -2
  251. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +21 -24
  252. package/dist/particles/elements/UIEmitter.Internal.d.ts +2 -2
  253. package/dist/particles/elements/UIEmitter.Internal.js +6 -9
  254. package/dist/particles/elements/UIEmitter.d.ts +17 -11
  255. package/dist/particles/elements/UIEmitter.js +100 -88
  256. package/dist/particles/index.d.ts +20 -18
  257. package/dist/particles/index.js +19 -18
  258. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -1
  259. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +14 -15
  260. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +4 -1
  261. package/dist/particles/instancedParticle/UIInstancedParticle.js +40 -32
  262. package/dist/particles/miscellaneous/miscellaneous.d.ts +3 -3
  263. package/dist/particles/miscellaneous/miscellaneous.js +26 -27
  264. package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +2 -2
  265. package/dist/particles/renderingModules/UIRenderingColorOverLife.js +5 -8
  266. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +2 -2
  267. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +6 -9
  268. package/dist/particles/renderingModules/UIRenderingModule.js +1 -3
  269. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +2 -2
  270. package/dist/particles/renderingModules/UIRenderingTexture.js +4 -7
  271. package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +2 -0
  272. package/dist/particles/shaders/UIRenderingColorOverLife.js +7 -0
  273. package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +9 -0
  274. package/dist/particles/shaders/UIRenderingColorOverVelocity.js +16 -0
  275. package/dist/particles/shaders/UIRenderingTexture.d.ts +2 -0
  276. package/dist/particles/shaders/UIRenderingTexture.js +7 -0
  277. package/dist/particles/spawnModules/UISpawnModule.d.ts +1 -1
  278. package/dist/particles/spawnModules/UISpawnModule.js +1 -3
  279. package/dist/particles/spawnModules/UISpawnOffset.d.ts +3 -3
  280. package/dist/particles/spawnModules/UISpawnOffset.js +12 -15
  281. package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +2 -2
  282. package/dist/particles/spawnModules/UISpawnRandomLifetime.js +13 -16
  283. package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +2 -2
  284. package/dist/particles/spawnModules/UISpawnRandomRotation.js +13 -16
  285. package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +2 -2
  286. package/dist/particles/spawnModules/UISpawnRandomScale.js +19 -22
  287. package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +2 -2
  288. package/dist/particles/spawnModules/UISpawnRandomTorque.js +13 -16
  289. package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +2 -2
  290. package/dist/particles/spawnModules/UISpawnRandomVelocity.js +21 -24
  291. package/dist/particles/spawnModules/UISpawnRectangle.d.ts +3 -3
  292. package/dist/particles/spawnModules/UISpawnRectangle.js +21 -24
  293. package/package.json +13 -17
  294. package/dist/_virtual/2d.js +0 -3
  295. package/dist/_virtual/3d.js +0 -3
  296. package/dist/_virtual/4d.js +0 -3
  297. package/dist/_virtual/mod.js +0 -5
  298. package/dist/_virtual/mod2.js +0 -3
  299. package/dist/core/shaders/UIImage.glsl.js +0 -3
  300. package/dist/core/shaders/UINineSlice.glsl.js +0 -3
  301. package/dist/core/shaders/UIProgress.glsl.js +0 -3
  302. package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +0 -3
  303. package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +0 -3
  304. package/dist/index.js +0 -52
  305. package/dist/node_modules/fast-simplex-noise/lib/2d.js +0 -93
  306. package/dist/node_modules/fast-simplex-noise/lib/3d.js +0 -142
  307. package/dist/node_modules/fast-simplex-noise/lib/4d.js +0 -196
  308. package/dist/node_modules/fast-simplex-noise/lib/mod.js +0 -24
  309. package/dist/node_modules/three/examples/jsm/lines/Line2.js +0 -56
  310. package/dist/node_modules/three/examples/jsm/lines/LineGeometry.js +0 -157
  311. package/dist/node_modules/three/examples/jsm/lines/LineMaterial.js +0 -691
  312. package/dist/node_modules/three/examples/jsm/lines/LineSegments2.js +0 -415
  313. package/dist/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js +0 -289
  314. package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +0 -3
  315. package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +0 -3
  316. package/dist/particles/shaders/UIRenderingTexture.glsl.js +0 -3
@@ -1,7 +1,6 @@
1
- import { TEXT_STYLE_DEFAULT_ALIGN } from '../../miscellaneous/text-style/UITextStyle.Internal.js';
2
- import { reorderChunksVisually } from './UIText.Bidi.js';
3
- import { applyFontStyle } from './UIText.Measuring.js';
4
-
1
+ import { TEXT_STYLE_DEFAULT_ALIGN } from "../../miscellaneous/text-style/UITextStyle.Internal.js";
2
+ import { reorderChunksVisually } from "./UIText.Bidi.js";
3
+ import { applyFontStyle } from "./UIText.Measuring.js";
5
4
  /**
6
5
  * Resolves logical alignment into a physical one.
7
6
  * @param align Alignment to resolve
@@ -25,7 +24,7 @@ function resolveAlign(align, isRTL) {
25
24
  * @param style Resolved text style
26
25
  * @param context Canvas rendering context
27
26
  */
28
- function renderTextChunk(x, y, text, style, context) {
27
+ export function renderTextChunk(x, y, text, style, context) {
29
28
  applyFontStyle(context, style);
30
29
  if (style.enableShadow) {
31
30
  context.shadowOffsetX = style.shadowOffsetX;
@@ -53,7 +52,7 @@ function renderTextChunk(x, y, text, style, context) {
53
52
  * @param isRTL Whether the paragraph reads right to left
54
53
  * @param context Canvas rendering context
55
54
  */
56
- function renderTextLines(paddingTop, paddingLeft, lines, isRTL, context) {
55
+ export function renderTextLines(paddingTop, paddingLeft, lines, isRTL, context) {
57
56
  context.clearRect(0, 0, context.canvas.width, context.canvas.height);
58
57
  context.direction = isRTL ? "rtl" : "ltr";
59
58
  context.textAlign = "left";
@@ -74,7 +73,7 @@ function renderTextLines(paddingTop, paddingLeft, lines, isRTL, context) {
74
73
  else if (lineAlign === "right") {
75
74
  offsetX = textWidth - line.width;
76
75
  }
77
- let currentX = paddingLeft + offsetX;
76
+ let currentX = paddingLeft + offsetX + line.overhangLeft;
78
77
  currentY += i === 0 ? line.baseline : line.lineHeight;
79
78
  for (const chunk of reorderChunksVisually(line.chunks, isRTL)) {
80
79
  renderTextChunk(currentX, currentY, chunk.text, chunk.style, context);
@@ -82,5 +81,3 @@ function renderTextLines(paddingTop, paddingLeft, lines, isRTL, context) {
82
81
  }
83
82
  }
84
83
  }
85
-
86
- export { renderTextChunk, renderTextLines };
@@ -1,21 +1,24 @@
1
1
  import type { WebGLRenderer } from "three";
2
- import type { UILayer } from "../../layers/UILayer/UILayer";
3
- import { UIColor } from "../../miscellaneous/color/UIColor";
4
- import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
5
- import { UIInsets } from "../../miscellaneous/insets/UIInsets";
6
- import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal";
7
- import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan";
8
- import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle";
9
- import { UIElement } from "../UIElement/UIElement";
10
- import type { UITextContent } from "./UIText.Interfaces";
11
- import type { UITextOptions } from "./UIText.Internal";
12
- import { UITextDirection, UITextResizeMode } from "./UIText.Internal";
2
+ import type { UILayer } from "../../layers/UILayer/UILayer.js";
3
+ import { UIColor } from "../../miscellaneous/color/UIColor.js";
4
+ import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal.js";
5
+ import { UIInsets } from "../../miscellaneous/insets/UIInsets.js";
6
+ import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal.js";
7
+ import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan.js";
8
+ import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle.js";
9
+ import { UIElement } from "../UIElement/UIElement.js";
10
+ import type { UITextContent } from "./UIText.Interfaces.js";
11
+ import type { UITextOptions } from "./UIText.Internal.js";
12
+ import { UITextDirection, UITextResizeMode } from "./UIText.Internal.js";
13
13
  /** Canvas-based text rendering element */
14
14
  export declare class UIText extends UIElement {
15
15
  /** Default style applied to all text spans */
16
16
  readonly commonStyle: UITextStyle;
17
17
  private readonly colorInternal;
18
18
  private readonly paddingInternal;
19
+ private autoPaddingInternal;
20
+ /** Padding last set by auto padding; any other value means it was changed by hand */
21
+ private lastAutoPadding;
19
22
  private readonly canvas;
20
23
  private readonly context;
21
24
  private texture;
@@ -47,6 +50,11 @@ export declare class UIText extends UIElement {
47
50
  get maxLineWidth(): number;
48
51
  /** Text padding in world units */
49
52
  get padding(): UIInsets;
53
+ /**
54
+ * Whether the padding follows the stroke and shadow of the styles. On by default, off once
55
+ * the padding is set by hand.
56
+ */
57
+ get autoPadding(): boolean;
50
58
  /** Controls how text adapts to element size */
51
59
  get resizeMode(): UITextResizeMode;
52
60
  /** Base direction used for bidirectional text reordering */
@@ -57,18 +65,24 @@ export declare class UIText extends UIElement {
57
65
  set content(value: UITextContent);
58
66
  /** Maximum line width before wrapping in pixels */
59
67
  set maxLineWidth(value: number);
60
- /** Text padding in world units */
68
+ /** Text padding in world units. Turns auto padding off. */
61
69
  set padding(value: UIInsetsConfig);
70
+ /**
71
+ * Whether the padding follows the stroke and shadow of the styles. On by default, off once
72
+ * the padding is set by hand.
73
+ */
74
+ set autoPadding(value: boolean);
62
75
  /** Controls how text adapts to size constraints */
63
76
  set resizeMode(value: UITextResizeMode);
64
77
  /** Base direction used for bidirectional text reordering */
65
78
  set direction(value: UITextDirection);
66
- /** Removes element and frees resources */
67
- destroy(): void;
79
+ /** Frees resources of the text */
80
+ protected destroyInternal(): void;
68
81
  protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
69
82
  private tryToRenderTextScaleMode;
70
83
  private tryToRenderTextBreakMode;
71
84
  private updateProperties;
85
+ private updateAutoPadding;
72
86
  private buildTextChunks;
73
87
  private checkDimensionsDirty;
74
88
  private setDimensionsDirtyFalse;
@@ -1,18 +1,17 @@
1
- import { Matrix3 } from 'three';
2
- import { createCanvas, createCanvasTexture } from '../../miscellaneous/canvas.js';
3
- import { UIColor } from '../../miscellaneous/color/UIColor.js';
4
- import { UIInsets } from '../../miscellaneous/insets/UIInsets.js';
5
- import { UITextSpan } from '../../miscellaneous/text-span/UITextSpan.js';
6
- import { UITextStyle } from '../../miscellaneous/text-style/UITextStyle.js';
7
- import source from '../../shaders/UIImage.glsl.js';
8
- import { UIElement } from '../UIElement/UIElement.js';
9
- import { detectIsRTL } from './UIText.Bidi.js';
10
- import { TEXT_DEFAULT_MAX_LINE_WIDTH, TEXT_DEFAULT_RESIZE_MODE, TEXT_DEFAULT_DIRECTION, UITextResizeMode, UITextDirection } from './UIText.Internal.js';
11
- import { calculateTextContentParameters, buildTextChunks } from './UIText.Measuring.js';
12
- import { renderTextLines } from './UIText.Rendering.js';
13
-
1
+ import { Matrix3 } from "three";
2
+ import { createCanvas, createCanvasTexture } from "../../miscellaneous/canvas.js";
3
+ import { UIColor } from "../../miscellaneous/color/UIColor.js";
4
+ import { UIInsets } from "../../miscellaneous/insets/UIInsets.js";
5
+ import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan.js";
6
+ import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle.js";
7
+ import source from "../../shaders/UIImage.js";
8
+ import { UIElement } from "../UIElement/UIElement.js";
9
+ import { detectIsRTL } from "./UIText.Bidi.js";
10
+ import { TEXT_DEFAULT_DIRECTION, TEXT_DEFAULT_MAX_LINE_WIDTH, TEXT_DEFAULT_RESIZE_MODE, UITextDirection, UITextResizeMode, } from "./UIText.Internal.js";
11
+ import { buildTextChunks, calculateTextContentParameters } from "./UIText.Measuring.js";
12
+ import { renderTextLines } from "./UIText.Rendering.js";
14
13
  /** Canvas-based text rendering element */
15
- class UIText extends UIElement {
14
+ export class UIText extends UIElement {
16
15
  /**
17
16
  * Creates a new UIText instance.
18
17
  *
@@ -34,73 +33,81 @@ class UIText extends UIElement {
34
33
  textureTransform: new Matrix3(),
35
34
  color,
36
35
  }, options);
37
- this._private_contentInternal = [];
38
- this._private_contentDirty = false;
39
- this._private_maxLineWidthDirty = false;
40
- this._private_resizeModeDirty = false;
41
- this._private_directionDirty = false;
42
- this._private_isRTL = false;
43
- this._private_textChunks = [];
44
- this._private_colorInternal = color;
45
- this._private_paddingInternal = new UIInsets(options.padding);
36
+ /** Padding last set by auto padding; any other value means it was changed by hand */
37
+ this.lastAutoPadding = 0;
38
+ this.contentInternal = [];
39
+ this.contentDirty = false;
40
+ this.maxLineWidthDirty = false;
41
+ this.resizeModeDirty = false;
42
+ this.directionDirty = false;
43
+ this.isRTL = false;
44
+ this.textChunks = [];
45
+ this.colorInternal = color;
46
+ this.paddingInternal = new UIInsets(options.padding);
47
+ this.autoPaddingInternal = options.padding === undefined;
46
48
  this.commonStyle = new UITextStyle(options.commonStyle);
47
- this._private_maxLineWidthInternal = options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
48
- this._private_resizeModeInternal = options.resizeMode ?? TEXT_DEFAULT_RESIZE_MODE;
49
- this._private_directionInternal = options.direction ?? TEXT_DEFAULT_DIRECTION;
50
- this._private_canvas = canvas;
51
- this._private_context = context;
52
- this._private_texture = texture;
49
+ this.maxLineWidthInternal = options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
50
+ this.resizeModeInternal = options.resizeMode ?? TEXT_DEFAULT_RESIZE_MODE;
51
+ this.directionInternal = options.direction ?? TEXT_DEFAULT_DIRECTION;
52
+ this.canvas = canvas;
53
+ this.context = context;
54
+ this.texture = texture;
53
55
  this.content = content;
54
- this._private_lastWidth = this.width;
55
- this._private_lastHeight = this.height;
56
- if (options.padding === undefined) {
57
- this._private_paddingInternal.setUnified(this.content.reduce((a, b) => Math.max(a, b.style.calculatePadding()), this.commonStyle.calculatePadding()));
58
- }
59
- switch (this._private_resizeModeInternal) {
56
+ this.lastWidth = this.width;
57
+ this.lastHeight = this.height;
58
+ this.updateAutoPadding();
59
+ switch (this.resizeModeInternal) {
60
60
  case UITextResizeMode.SCALE:
61
- this._private_tryToRenderTextScaleMode();
61
+ this.tryToRenderTextScaleMode();
62
62
  break;
63
63
  case UITextResizeMode.BREAK:
64
- this._private_tryToRenderTextBreakMode();
64
+ this.tryToRenderTextBreakMode();
65
65
  break;
66
66
  }
67
67
  }
68
68
  /** Multiplicative tint. Alpha channel controls opacity. */
69
69
  get color() {
70
- return this._private_colorInternal;
70
+ return this.colorInternal;
71
71
  }
72
72
  /** Text content as array of styled spans */
73
73
  get content() {
74
- return this._private_contentInternal;
74
+ return this.contentInternal;
75
75
  }
76
76
  /** Maximum line width before wrapping in pixels */
77
77
  get maxLineWidth() {
78
- return this._private_maxLineWidthInternal;
78
+ return this.maxLineWidthInternal;
79
79
  }
80
80
  /** Text padding in world units */
81
81
  get padding() {
82
- return this._private_paddingInternal;
82
+ return this.paddingInternal;
83
+ }
84
+ /**
85
+ * Whether the padding follows the stroke and shadow of the styles. On by default, off once
86
+ * the padding is set by hand.
87
+ */
88
+ get autoPadding() {
89
+ return this.autoPaddingInternal;
83
90
  }
84
91
  /** Controls how text adapts to element size */
85
92
  get resizeMode() {
86
- return this._private_resizeModeInternal;
93
+ return this.resizeModeInternal;
87
94
  }
88
95
  /** Base direction used for bidirectional text reordering */
89
96
  get direction() {
90
- return this._private_directionInternal;
97
+ return this.directionInternal;
91
98
  }
92
99
  /** Multiplicative tint. Alpha channel controls opacity. */
93
100
  set color(value) {
94
- this._private_colorInternal.set(value);
101
+ this.colorInternal.set(value);
95
102
  }
96
103
  /** Text content as string, span config, or array */
97
104
  set content(value) {
98
- if (this._private_contentInternal !== value) {
105
+ if (this.contentInternal !== value) {
99
106
  if (typeof value === "string") {
100
- this._private_contentInternal = [new UITextSpan({ text: value, style: new UITextStyle() })];
107
+ this.contentInternal = [new UITextSpan({ text: value, style: new UITextStyle() })];
101
108
  }
102
109
  else if (Array.isArray(value)) {
103
- this._private_contentInternal = value.map((span) => typeof span === "string"
110
+ this.contentInternal = value.map((span) => typeof span === "string"
104
111
  ? new UITextSpan({ text: span, style: new UITextStyle() })
105
112
  : new UITextSpan({
106
113
  text: span.text,
@@ -108,72 +115,89 @@ class UIText extends UIElement {
108
115
  }));
109
116
  }
110
117
  else {
111
- this._private_contentInternal = [
118
+ this.contentInternal = [
112
119
  new UITextSpan({
113
120
  text: value.text,
114
121
  style: new UITextStyle(value.style),
115
122
  }),
116
123
  ];
117
124
  }
118
- this._private_contentDirty = true;
125
+ this.contentDirty = true;
119
126
  }
120
127
  }
121
128
  /** Maximum line width before wrapping in pixels */
122
129
  set maxLineWidth(value) {
123
- if (this._private_maxLineWidthInternal !== value) {
124
- this._private_maxLineWidthInternal = value;
125
- this._private_maxLineWidthDirty = true;
130
+ if (this.maxLineWidthInternal !== value) {
131
+ this.maxLineWidthInternal = value;
132
+ this.maxLineWidthDirty = true;
126
133
  }
127
134
  }
128
- /** Text padding in world units */
135
+ /** Text padding in world units. Turns auto padding off. */
129
136
  set padding(value) {
130
- this._private_paddingInternal.set(value);
137
+ this.autoPaddingInternal = false;
138
+ this.paddingInternal.set(value);
139
+ }
140
+ /**
141
+ * Whether the padding follows the stroke and shadow of the styles. On by default, off once
142
+ * the padding is set by hand.
143
+ */
144
+ set autoPadding(value) {
145
+ if (this.autoPaddingInternal !== value) {
146
+ this.autoPaddingInternal = value;
147
+ if (value) {
148
+ this.lastAutoPadding = Number.NaN;
149
+ this.updateAutoPadding();
150
+ }
151
+ }
131
152
  }
132
153
  /** Controls how text adapts to size constraints */
133
154
  set resizeMode(value) {
134
- if (this._private_resizeModeInternal !== value) {
135
- this._private_resizeModeInternal = value;
136
- this._private_resizeModeDirty = true;
155
+ if (this.resizeModeInternal !== value) {
156
+ this.resizeModeInternal = value;
157
+ this.resizeModeDirty = true;
137
158
  }
138
159
  }
139
160
  /** Base direction used for bidirectional text reordering */
140
161
  set direction(value) {
141
- if (this._private_directionInternal !== value) {
142
- this._private_directionInternal = value;
143
- this._private_directionDirty = true;
162
+ if (this.directionInternal !== value) {
163
+ this.directionInternal = value;
164
+ this.directionDirty = true;
144
165
  }
145
166
  }
146
- /** Removes element and frees resources */
147
- destroy() {
148
- this._private_texture.dispose();
149
- super.destroy();
167
+ /** Frees resources of the text */
168
+ destroyInternal() {
169
+ this.texture.dispose();
170
+ super.destroyInternal();
150
171
  }
151
172
  onWillRender(renderer, deltaTime) {
152
- switch (this._private_resizeModeInternal) {
173
+ switch (this.resizeModeInternal) {
153
174
  case UITextResizeMode.SCALE:
154
- this._private_tryToRenderTextScaleMode();
175
+ this.tryToRenderTextScaleMode();
155
176
  break;
156
177
  case UITextResizeMode.BREAK:
157
- this._private_tryToRenderTextBreakMode();
178
+ this.tryToRenderTextBreakMode();
158
179
  break;
159
180
  }
160
181
  super.onWillRender(renderer, deltaTime);
161
182
  }
162
- _private_tryToRenderTextScaleMode() {
163
- if (!this._private_colorInternal.dirty &&
164
- !this._private_resizeModeDirty &&
165
- !this._private_directionDirty &&
166
- !this._private_maxLineWidthDirty &&
167
- !this._private_paddingInternal.dirty &&
183
+ tryToRenderTextScaleMode() {
184
+ if (this.checkContentDirty()) {
185
+ this.updateAutoPadding();
186
+ }
187
+ if (!this.colorInternal.dirty &&
188
+ !this.resizeModeDirty &&
189
+ !this.directionDirty &&
190
+ !this.maxLineWidthDirty &&
191
+ !this.paddingInternal.dirty &&
168
192
  !(this.solverWrapper.dirty &&
169
- this._private_lastWidth / this._private_lastHeight !== Math.round(this.width) / Math.round(this.height)) &&
170
- !this._private_checkContentDirty()) {
193
+ this.lastWidth / this.lastHeight !== Math.round(this.width) / Math.round(this.height)) &&
194
+ !this.checkContentDirty()) {
171
195
  return;
172
196
  }
173
- const textChunks = this._private_buildTextChunks();
174
- const { lines, size } = calculateTextContentParameters(textChunks, this._private_maxLineWidthInternal);
175
- const paddingV = this._private_paddingInternal.top + this._private_paddingInternal.bottom;
176
- const paddingH = this._private_paddingInternal.left + this._private_paddingInternal.right;
197
+ const textChunks = this.buildTextChunks();
198
+ const { lines, size } = calculateTextContentParameters(textChunks, this.maxLineWidthInternal, this.isRTL);
199
+ const paddingV = this.paddingInternal.top + this.paddingInternal.bottom;
200
+ const paddingH = this.paddingInternal.left + this.paddingInternal.right;
177
201
  const desiredHeight = size.height + paddingV;
178
202
  const desiredWidth = size.width + paddingH;
179
203
  this.width = desiredWidth;
@@ -181,103 +205,119 @@ class UIText extends UIElement {
181
205
  this.width = (desiredWidth / desiredHeight) * Math.round(this.height);
182
206
  const safeWidth = Math.max(Math.round(desiredWidth), 2);
183
207
  const safeHeight = Math.max(Math.round(desiredHeight), 2);
184
- const resolutionDirty = this._private_canvas.width !== safeWidth || this._private_canvas.height !== safeHeight;
208
+ const resolutionDirty = this.canvas.width !== safeWidth || this.canvas.height !== safeHeight;
185
209
  if (resolutionDirty) {
186
- this._private_canvas.width = safeWidth;
187
- this._private_canvas.height = safeHeight;
210
+ this.canvas.width = safeWidth;
211
+ this.canvas.height = safeHeight;
188
212
  }
189
- renderTextLines(this._private_paddingInternal.top, this._private_paddingInternal.left, lines, this._private_isRTL, this._private_context);
190
- this._private_updateProperties(resolutionDirty);
191
- this._private_resizeModeDirty = false;
192
- this._private_directionDirty = false;
193
- this._private_maxLineWidthDirty = false;
194
- this._private_paddingInternal.setDirtyFalse();
195
- this._private_setDimensionsDirtyFalse();
196
- this._private_setContentDirtyFalse();
213
+ renderTextLines(this.paddingInternal.top, this.paddingInternal.left, lines, this.isRTL, this.context);
214
+ this.updateProperties(resolutionDirty);
215
+ this.resizeModeDirty = false;
216
+ this.directionDirty = false;
217
+ this.maxLineWidthDirty = false;
218
+ this.paddingInternal.setDirtyFalse();
219
+ this.setDimensionsDirtyFalse();
220
+ this.setContentDirtyFalse();
197
221
  }
198
- _private_tryToRenderTextBreakMode() {
199
- if (!this._private_colorInternal.dirty &&
200
- !this._private_resizeModeDirty &&
201
- !this._private_directionDirty &&
202
- !this._private_maxLineWidthDirty &&
203
- !this._private_paddingInternal.dirty &&
204
- !this._private_checkDimensionsDirty() &&
205
- !this._private_checkContentDirty()) {
222
+ tryToRenderTextBreakMode() {
223
+ if (this.checkContentDirty()) {
224
+ this.updateAutoPadding();
225
+ }
226
+ if (!this.colorInternal.dirty &&
227
+ !this.resizeModeDirty &&
228
+ !this.directionDirty &&
229
+ !this.maxLineWidthDirty &&
230
+ !this.paddingInternal.dirty &&
231
+ !this.checkDimensionsDirty() &&
232
+ !this.checkContentDirty()) {
206
233
  return;
207
234
  }
208
- const textChunks = this._private_buildTextChunks();
209
- const { size: desiredTextSize } = calculateTextContentParameters(textChunks, this._private_maxLineWidthInternal);
210
- const paddingV = this._private_paddingInternal.top + this._private_paddingInternal.bottom;
211
- const paddingH = this._private_paddingInternal.left + this._private_paddingInternal.right;
235
+ const textChunks = this.buildTextChunks();
236
+ const { size: desiredTextSize } = calculateTextContentParameters(textChunks, this.maxLineWidthInternal, this.isRTL);
237
+ const paddingV = this.paddingInternal.top + this.paddingInternal.bottom;
238
+ const paddingH = this.paddingInternal.left + this.paddingInternal.right;
212
239
  this.height = desiredTextSize.height + paddingV;
213
240
  this.width = desiredTextSize.width + paddingH;
214
- const { lines: realTextLines, size: realTextSize } = calculateTextContentParameters(textChunks, Math.round(this.width) - paddingH);
241
+ const { lines: realTextLines, size: realTextSize } = calculateTextContentParameters(textChunks, Math.round(this.width) - paddingH, this.isRTL);
215
242
  this.height = realTextSize.height + paddingV;
216
243
  this.width = realTextSize.width + paddingH;
217
244
  const safeWidth = Math.max(Math.round(this.width), 2);
218
245
  const safeHeight = Math.max(Math.round(this.height), 2);
219
- const resolutionDirty = this._private_canvas.width !== safeWidth || this._private_canvas.height !== safeHeight;
246
+ const resolutionDirty = this.canvas.width !== safeWidth || this.canvas.height !== safeHeight;
220
247
  if (resolutionDirty) {
221
- this._private_canvas.width = safeWidth;
222
- this._private_canvas.height = safeHeight;
248
+ this.canvas.width = safeWidth;
249
+ this.canvas.height = safeHeight;
223
250
  }
224
- renderTextLines(this._private_paddingInternal.top, this._private_paddingInternal.left, realTextLines, this._private_isRTL, this._private_context);
225
- this._private_updateProperties(resolutionDirty);
226
- this._private_resizeModeDirty = false;
227
- this._private_directionDirty = false;
228
- this._private_maxLineWidthDirty = false;
229
- this._private_paddingInternal.setDirtyFalse();
230
- this._private_setDimensionsDirtyFalse();
231
- this._private_setContentDirtyFalse();
251
+ renderTextLines(this.paddingInternal.top, this.paddingInternal.left, realTextLines, this.isRTL, this.context);
252
+ this.updateProperties(resolutionDirty);
253
+ this.resizeModeDirty = false;
254
+ this.directionDirty = false;
255
+ this.maxLineWidthDirty = false;
256
+ this.paddingInternal.setDirtyFalse();
257
+ this.setDimensionsDirtyFalse();
258
+ this.setContentDirtyFalse();
232
259
  }
233
- _private_updateProperties(resolutionDirty) {
260
+ updateProperties(resolutionDirty) {
234
261
  let properties;
235
- if (this._private_colorInternal.dirty) {
262
+ if (this.colorInternal.dirty) {
236
263
  properties ?? (properties = {});
237
- properties["color"] = this._private_colorInternal;
238
- this._private_colorInternal.setDirtyFalse();
264
+ properties["color"] = this.colorInternal;
265
+ this.colorInternal.setDirtyFalse();
239
266
  }
240
267
  if (resolutionDirty) {
241
- this._private_texture.dispose();
242
- this._private_texture = createCanvasTexture(this._private_canvas);
268
+ this.texture.dispose();
269
+ this.texture = createCanvasTexture(this.canvas);
243
270
  properties ?? (properties = {});
244
- properties["texture"] = this._private_texture;
271
+ properties["texture"] = this.texture;
245
272
  }
246
- this._private_texture.needsUpdate = true;
273
+ this.texture.needsUpdate = true;
247
274
  if (properties) {
248
275
  this.sceneWrapper.setProperties(this.planeHandler, properties);
249
276
  }
250
277
  }
251
- _private_buildTextChunks() {
252
- if (this._private_directionDirty || this._private_checkContentDirty()) {
253
- this._private_isRTL =
254
- this._private_directionInternal === UITextDirection.AUTO
255
- ? detectIsRTL(this._private_contentInternal)
256
- : this._private_directionInternal === UITextDirection.RTL;
257
- this._private_textChunks = buildTextChunks(this._private_context, this._private_contentInternal, this.commonStyle, this._private_isRTL);
278
+ updateAutoPadding() {
279
+ if (!this.autoPaddingInternal) {
280
+ return;
281
+ }
282
+ const { left, right, top, bottom } = this.paddingInternal;
283
+ const last = this.lastAutoPadding;
284
+ if (!Number.isNaN(last) &&
285
+ (left !== last || right !== last || top !== last || bottom !== last)) {
286
+ this.autoPaddingInternal = false;
287
+ return;
288
+ }
289
+ const padding = this.content.reduce((result, span) => Math.max(result, span.style.calculatePadding(this.commonStyle)), this.commonStyle.calculatePadding());
290
+ this.paddingInternal.setUnified(padding);
291
+ this.lastAutoPadding = padding;
292
+ }
293
+ buildTextChunks() {
294
+ if (this.directionDirty || this.checkContentDirty()) {
295
+ this.isRTL =
296
+ this.directionInternal === UITextDirection.AUTO
297
+ ? detectIsRTL(this.contentInternal)
298
+ : this.directionInternal === UITextDirection.RTL;
299
+ this.textChunks = buildTextChunks(this.context, this.contentInternal, this.commonStyle, this.isRTL);
258
300
  }
259
- return this._private_textChunks;
301
+ return this.textChunks;
260
302
  }
261
- _private_checkDimensionsDirty() {
303
+ checkDimensionsDirty() {
262
304
  return (this.solverWrapper.dirty &&
263
- (this._private_lastWidth !== Math.round(this.width) || this._private_lastHeight !== Math.round(this.height)));
305
+ (this.lastWidth !== Math.round(this.width) || this.lastHeight !== Math.round(this.height)));
264
306
  }
265
- _private_setDimensionsDirtyFalse() {
266
- this._private_lastWidth = Math.round(this.width);
267
- this._private_lastHeight = Math.round(this.height);
307
+ setDimensionsDirtyFalse() {
308
+ this.lastWidth = Math.round(this.width);
309
+ this.lastHeight = Math.round(this.height);
268
310
  }
269
- _private_checkContentDirty() {
270
- return (this._private_contentDirty ||
311
+ checkContentDirty() {
312
+ return (this.contentDirty ||
271
313
  this.commonStyle.dirty ||
272
314
  this.content.some((span) => span.dirty));
273
315
  }
274
- _private_setContentDirtyFalse() {
275
- this._private_contentDirty = false;
316
+ setContentDirtyFalse() {
317
+ this.contentDirty = false;
276
318
  this.commonStyle.setDirtyFalse();
277
319
  for (const span of this.content) {
278
320
  span.setDirtyFalse();
279
321
  }
280
322
  }
281
323
  }
282
-
283
- export { UIText };