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.
Files changed (266) hide show
  1. package/README.md +84 -208
  2. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
  3. package/dist/{constraints → core/constraints}/UIConstraint.d.ts +2 -2
  4. package/dist/core/constraints/UIConstraint.js +11 -0
  5. package/dist/core/constraints/UICustomConstraint.js +37 -0
  6. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
  7. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
  8. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
  9. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
  10. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
  11. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
  12. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
  13. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
  14. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
  15. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
  16. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
  17. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
  18. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
  19. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
  20. package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
  21. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
  22. package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
  23. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
  24. package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
  25. package/dist/{elements → core/elements}/UIAnchor/UIAnchor.Internal.d.ts +3 -0
  26. package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
  27. package/dist/{elements → core/elements}/UIAnchor/UIAnchor.d.ts +3 -3
  28. package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
  29. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
  30. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
  31. package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
  32. package/dist/{elements → core/elements}/UIDummy/UIDummy.d.ts +2 -2
  33. package/dist/core/elements/UIDummy/UIDummy.js +173 -0
  34. package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
  35. package/dist/{elements → core/elements}/UIElement/UIElement.d.ts +2 -2
  36. package/dist/core/elements/UIElement/UIElement.js +74 -0
  37. package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
  38. package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
  39. package/dist/core/elements/UIImage/UIImage.js +85 -0
  40. package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
  41. package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
  42. package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
  43. package/dist/core/elements/UIProgress/UIProgress.js +165 -0
  44. package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
  45. package/dist/core/elements/UIScene/UIScene.js +157 -0
  46. package/dist/core/elements/UIText/UIText.Internal.js +12 -0
  47. package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
  48. package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
  49. package/dist/core/elements/UIText/UIText.js +265 -0
  50. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
  51. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
  52. package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
  53. package/dist/core/layers/UILayer/UILayer.js +113 -0
  54. package/dist/core/miscellaneous/UIExpression.js +128 -0
  55. package/dist/core/miscellaneous/UIMode.js +30 -0
  56. package/dist/core/miscellaneous/UIOrientation.js +20 -0
  57. package/dist/core/miscellaneous/UIPriority.js +63 -0
  58. package/dist/core/miscellaneous/UIRelation.js +40 -0
  59. package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
  60. package/dist/core/miscellaneous/area/UIArea.js +5 -0
  61. package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
  62. package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
  63. package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
  64. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
  65. package/dist/core/miscellaneous/asserts.js +163 -0
  66. package/dist/core/miscellaneous/canvas.js +37 -0
  67. package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
  68. package/dist/core/miscellaneous/color/UIColor.js +636 -0
  69. package/dist/core/miscellaneous/computeTransform.js +82 -0
  70. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
  71. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
  72. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
  73. package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
  74. package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
  75. package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
  76. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
  77. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
  78. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
  79. package/dist/{miscellaneous → core/miscellaneous}/math.d.ts +2 -0
  80. package/dist/core/miscellaneous/math.js +11 -0
  81. package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
  82. package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
  83. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
  84. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
  85. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
  86. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
  87. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
  88. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
  89. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
  90. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
  91. package/dist/core/miscellaneous/shared.js +37 -0
  92. package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
  93. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
  94. package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
  95. package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
  96. package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
  97. package/dist/core/miscellaneous/webglCapabilities.js +103 -0
  98. package/dist/core/shaders/UIImage.glsl.js +3 -0
  99. package/dist/core/shaders/UINineSlice.glsl.js +3 -0
  100. package/dist/core/shaders/UIProgress.glsl.js +3 -0
  101. package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
  102. package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
  103. package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.Internal.d.ts +1 -1
  104. package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.d.ts +2 -2
  105. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
  106. package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.Internal.d.ts +1 -1
  107. package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.d.ts +2 -2
  108. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
  109. package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.Internal.d.ts +1 -1
  110. package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.d.ts +2 -2
  111. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
  112. package/dist/index.js +51 -9246
  113. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
  114. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
  115. package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
  116. package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
  117. package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
  118. package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
  119. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
  120. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
  121. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
  122. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
  123. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
  124. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
  125. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
  126. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
  127. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
  128. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
  129. package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
  130. package/dist/particles/elements/UIEmitter.Internal.js +11 -0
  131. package/dist/particles/elements/UIEmitter.d.ts +68 -0
  132. package/dist/particles/elements/UIEmitter.js +203 -0
  133. package/dist/particles/index.d.ts +18 -0
  134. package/dist/particles/index.js +18 -0
  135. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
  136. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
  137. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
  138. package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
  139. package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
  140. package/dist/particles/miscellaneous/miscellaneous.js +67 -0
  141. package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
  142. package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
  143. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
  144. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
  145. package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
  146. package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
  147. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
  148. package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
  149. package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
  150. package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
  151. package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
  152. package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
  153. package/dist/particles/spawnModules/UISpawnModule.js +9 -0
  154. package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
  155. package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
  156. package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
  157. package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
  158. package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
  159. package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
  160. package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
  161. package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
  162. package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
  163. package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
  164. package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
  165. package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
  166. package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
  167. package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
  168. package/package.json +27 -36
  169. package/dist/index.js.map +0 -1
  170. package/dist/index.min.js +0 -2
  171. package/dist/index.min.js.map +0 -1
  172. /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +0 -0
  173. /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.d.ts +0 -0
  174. /package/dist/{constraints → core/constraints}/UICustomConstraint.d.ts +0 -0
  175. /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +0 -0
  176. /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.d.ts +0 -0
  177. /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -0
  178. /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -0
  179. /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -0
  180. /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -0
  181. /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +0 -0
  182. /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -0
  183. /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +0 -0
  184. /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -0
  185. /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -0
  186. /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -0
  187. /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -0
  188. /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -0
  189. /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +0 -0
  190. /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -0
  191. /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +0 -0
  192. /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.d.ts +0 -0
  193. /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.Internal.d.ts +0 -0
  194. /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.d.ts +0 -0
  195. /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.Internal.d.ts +0 -0
  196. /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.d.ts +0 -0
  197. /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.Internal.d.ts +0 -0
  198. /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.d.ts +0 -0
  199. /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -0
  200. /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.d.ts +0 -0
  201. /package/dist/{elements → core/elements}/UIDummy/UIDummy.Internal.d.ts +0 -0
  202. /package/dist/{elements → core/elements}/UIElement/UIElement.Internal.d.ts +0 -0
  203. /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.Internal.d.ts +0 -0
  204. /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.d.ts +0 -0
  205. /package/dist/{elements → core/elements}/UIImage/UIImage.Internal.d.ts +0 -0
  206. /package/dist/{elements → core/elements}/UIImage/UIImage.d.ts +0 -0
  207. /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.Internal.d.ts +0 -0
  208. /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.d.ts +0 -0
  209. /package/dist/{elements → core/elements}/UIProgress/UIProgress.Internal.d.ts +0 -0
  210. /package/dist/{elements → core/elements}/UIProgress/UIProgress.d.ts +0 -0
  211. /package/dist/{elements → core/elements}/UIScene/UIScene.Internal.d.ts +0 -0
  212. /package/dist/{elements → core/elements}/UIScene/UIScene.d.ts +0 -0
  213. /package/dist/{elements → core/elements}/UIText/UIText.Interfaces.d.ts +0 -0
  214. /package/dist/{elements → core/elements}/UIText/UIText.Internal.d.ts +0 -0
  215. /package/dist/{elements → core/elements}/UIText/UIText.Measuring.d.ts +0 -0
  216. /package/dist/{elements → core/elements}/UIText/UIText.Rendering.d.ts +0 -0
  217. /package/dist/{elements → core/elements}/UIText/UIText.d.ts +0 -0
  218. /package/dist/{index.d.ts → core/index.d.ts} +0 -0
  219. /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +0 -0
  220. /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -0
  221. /package/dist/{layers → core/layers}/UILayer/UILayer.Internal.d.ts +0 -0
  222. /package/dist/{layers → core/layers}/UILayer/UILayer.d.ts +0 -0
  223. /package/dist/{miscellaneous → core/miscellaneous}/UIExpression.d.ts +0 -0
  224. /package/dist/{miscellaneous → core/miscellaneous}/UIMode.d.ts +0 -0
  225. /package/dist/{miscellaneous → core/miscellaneous}/UIOrientation.d.ts +0 -0
  226. /package/dist/{miscellaneous → core/miscellaneous}/UIPriority.d.ts +0 -0
  227. /package/dist/{miscellaneous → core/miscellaneous}/UIRelation.d.ts +0 -0
  228. /package/dist/{miscellaneous → core/miscellaneous}/UITransparencyMode.d.ts +0 -0
  229. /package/dist/{miscellaneous → core/miscellaneous}/area/UIArea.d.ts +0 -0
  230. /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaCircle.d.ts +0 -0
  231. /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaPolygon.d.ts +0 -0
  232. /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRectangle.d.ts +0 -0
  233. /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRoundedRectangle.d.ts +0 -0
  234. /package/dist/{miscellaneous → core/miscellaneous}/asserts.d.ts +0 -0
  235. /package/dist/{miscellaneous → core/miscellaneous}/canvas.d.ts +0 -0
  236. /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.Internal.d.ts +0 -0
  237. /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.d.ts +0 -0
  238. /package/dist/{miscellaneous → core/miscellaneous}/computeTransform.d.ts +0 -0
  239. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -0
  240. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -0
  241. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +0 -0
  242. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -0
  243. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/shared.d.ts +0 -0
  244. /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.Internal.d.ts +0 -0
  245. /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.d.ts +0 -0
  246. /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunction.d.ts +0 -0
  247. /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -0
  248. /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -0
  249. /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.Internal.d.ts +0 -0
  250. /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.d.ts +0 -0
  251. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicy.d.ts +0 -0
  252. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCover.d.ts +0 -0
  253. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCross.d.ts +0 -0
  254. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -0
  255. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFit.d.ts +0 -0
  256. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -0
  257. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -0
  258. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyNone.d.ts +0 -0
  259. /package/dist/{miscellaneous → core/miscellaneous}/shared.d.ts +0 -0
  260. /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.Internal.d.ts +0 -0
  261. /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.d.ts +0 -0
  262. /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.Internal.d.ts +0 -0
  263. /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.d.ts +0 -0
  264. /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.Internal.d.ts +0 -0
  265. /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.d.ts +0 -0
  266. /package/dist/{miscellaneous → core/miscellaneous}/webglCapabilities.d.ts +0 -0
@@ -0,0 +1,372 @@
1
+ import { assertValidPositiveNumber, assertValidNumber, assertValidNonNegativeNumber } from '../asserts.js';
2
+ import { TEXT_STYLE_DEFAULT_FONT_SIZE, TEXT_STYLE_DEFAULT_STROKE_THICKNESS, TEXT_STYLE_DEFAULT_STROKE_COLOR, TEXT_STYLE_DEFAULT_ENABLE_STROKE, TEXT_STYLE_DEFAULT_SHADOW_COLOR, TEXT_STYLE_DEFAULT_SHADOW_BLUR, TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y, TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X, TEXT_STYLE_DEFAULT_ENABLE_SHADOW, TEXT_STYLE_DEFAULT_FONT_WEIGHT, TEXT_STYLE_DEFAULT_FONT_STYLE, TEXT_STYLE_DEFAULT_FONT_FAMILY, TEXT_STYLE_DEFAULT_ALIGN, TEXT_STYLE_DEFAULT_COLOR, TEXT_STYLE_DEFAULT_LINE_HEIGHT } from './UITextStyle.Internal.js';
3
+
4
+ /** Text style configuration for UI text rendering */
5
+ class UITextStyle {
6
+ /** @param config Partial style configuration. Unspecified properties remain undefined. */
7
+ constructor(config) {
8
+ this._private_dirtyInternal = true;
9
+ this._private_colorInternal = config?.color;
10
+ this._private_alignInternal = config?.align;
11
+ this._private_fontFamilyInternal = config?.fontFamily;
12
+ this._private_fontSizeInternal = config?.fontSize;
13
+ this._private_fontStyleInternal = config?.fontStyle;
14
+ this._private_fontWeightInternal = config?.fontWeight;
15
+ this._private_lineHeightInternal = config?.lineHeight;
16
+ this._private_enableShadowInternal = config?.enableShadow;
17
+ this._private_shadowOffsetXInternal = config?.shadowOffsetX;
18
+ this._private_shadowOffsetYInternal = config?.shadowOffsetY;
19
+ this._private_shadowBlurInternal = config?.shadowBlur;
20
+ this._private_shadowColorInternal = config?.shadowColor;
21
+ this._private_enableStrokeInternal = config?.enableStroke;
22
+ this._private_strokeColorInternal = config?.strokeColor;
23
+ this._private_strokeThicknessInternal = config?.strokeThickness;
24
+ }
25
+ /** Text color */
26
+ get color() {
27
+ return this._private_colorInternal;
28
+ }
29
+ /** Text alignment */
30
+ get align() {
31
+ return this._private_alignInternal;
32
+ }
33
+ /** Font family name */
34
+ get fontFamily() {
35
+ return this._private_fontFamilyInternal;
36
+ }
37
+ /** Font size in pixels */
38
+ get fontSize() {
39
+ return this._private_fontSizeInternal;
40
+ }
41
+ /** Font style */
42
+ get fontStyle() {
43
+ return this._private_fontStyleInternal;
44
+ }
45
+ /** Font weight */
46
+ get fontWeight() {
47
+ return this._private_fontWeightInternal;
48
+ }
49
+ /** Line height in pixels */
50
+ get lineHeight() {
51
+ return this._private_lineHeightInternal;
52
+ }
53
+ /** Whether shadow is enabled */
54
+ get enableShadow() {
55
+ return this._private_enableShadowInternal;
56
+ }
57
+ /** Shadow horizontal offset in pixels */
58
+ get shadowOffsetX() {
59
+ return this._private_shadowOffsetXInternal;
60
+ }
61
+ /** Shadow vertical offset in pixels */
62
+ get shadowOffsetY() {
63
+ return this._private_shadowOffsetYInternal;
64
+ }
65
+ /** Shadow blur radius in pixels */
66
+ get shadowBlur() {
67
+ return this._private_shadowBlurInternal;
68
+ }
69
+ /** Shadow color */
70
+ get shadowColor() {
71
+ return this._private_shadowColorInternal;
72
+ }
73
+ /** Whether stroke is enabled */
74
+ get enableStroke() {
75
+ return this._private_enableStrokeInternal;
76
+ }
77
+ /** Stroke color */
78
+ get strokeColor() {
79
+ return this._private_strokeColorInternal;
80
+ }
81
+ /** Stroke thickness in pixels */
82
+ get strokeThickness() {
83
+ return this._private_strokeThicknessInternal;
84
+ }
85
+ /**
86
+ * Indicates whether any property has been modified.
87
+ * Must be reset to `false` externally by the owner.
88
+ * @internal
89
+ */
90
+ get dirty() {
91
+ return this._private_dirtyInternal;
92
+ }
93
+ set color(value) {
94
+ if (value !== this._private_colorInternal) {
95
+ this._private_colorInternal = value;
96
+ this._private_dirtyInternal = true;
97
+ }
98
+ }
99
+ set align(value) {
100
+ if (value !== this._private_alignInternal) {
101
+ this._private_alignInternal = value;
102
+ this._private_dirtyInternal = true;
103
+ }
104
+ }
105
+ set fontFamily(value) {
106
+ if (value !== this._private_fontFamilyInternal) {
107
+ this._private_fontFamilyInternal = value;
108
+ this._private_dirtyInternal = true;
109
+ }
110
+ }
111
+ set fontSize(value) {
112
+ if (value !== undefined) {
113
+ assertValidPositiveNumber(value, "UITextStyle.fontSize");
114
+ }
115
+ if (value !== this._private_fontSizeInternal) {
116
+ this._private_fontSizeInternal = value;
117
+ this._private_dirtyInternal = true;
118
+ }
119
+ }
120
+ set fontStyle(value) {
121
+ if (value !== this._private_fontStyleInternal) {
122
+ this._private_fontStyleInternal = value;
123
+ this._private_dirtyInternal = true;
124
+ }
125
+ }
126
+ set fontWeight(value) {
127
+ if (typeof value === "number") {
128
+ assertValidPositiveNumber(value, "UITextStyle.fontWeight");
129
+ }
130
+ if (value !== this._private_fontWeightInternal) {
131
+ this._private_fontWeightInternal = value;
132
+ this._private_dirtyInternal = true;
133
+ }
134
+ }
135
+ set lineHeight(value) {
136
+ if (value !== undefined) {
137
+ assertValidNumber(value, "UITextStyle.lineHeight");
138
+ }
139
+ if (value !== this._private_lineHeightInternal) {
140
+ this._private_lineHeightInternal = value;
141
+ this._private_dirtyInternal = true;
142
+ }
143
+ }
144
+ set enableShadow(value) {
145
+ if (value !== this._private_enableShadowInternal) {
146
+ this._private_enableShadowInternal = value;
147
+ this._private_dirtyInternal = true;
148
+ }
149
+ }
150
+ set shadowOffsetX(value) {
151
+ if (value !== undefined) {
152
+ assertValidNonNegativeNumber(value, "UITextStyle.shadowOffsetX");
153
+ }
154
+ if (value !== this._private_shadowOffsetXInternal) {
155
+ this._private_shadowOffsetXInternal = value;
156
+ this._private_dirtyInternal = true;
157
+ }
158
+ }
159
+ set shadowOffsetY(value) {
160
+ if (value !== undefined) {
161
+ assertValidNonNegativeNumber(value, "UITextStyle.shadowOffsetY");
162
+ }
163
+ if (value !== this._private_shadowOffsetYInternal) {
164
+ this._private_shadowOffsetYInternal = value;
165
+ this._private_dirtyInternal = true;
166
+ }
167
+ }
168
+ set shadowBlur(value) {
169
+ if (value !== undefined) {
170
+ assertValidNonNegativeNumber(value, "UITextStyle.shadowBlur");
171
+ }
172
+ if (value !== this._private_shadowBlurInternal) {
173
+ this._private_shadowBlurInternal = value;
174
+ this._private_dirtyInternal = true;
175
+ }
176
+ }
177
+ set shadowColor(value) {
178
+ if (value !== this._private_shadowColorInternal) {
179
+ this._private_shadowColorInternal = value;
180
+ this._private_dirtyInternal = true;
181
+ }
182
+ }
183
+ set enableStroke(value) {
184
+ if (value !== this._private_enableStrokeInternal) {
185
+ this._private_enableStrokeInternal = value;
186
+ this._private_dirtyInternal = true;
187
+ }
188
+ }
189
+ set strokeColor(value) {
190
+ if (value !== this._private_strokeColorInternal) {
191
+ this._private_strokeColorInternal = value;
192
+ this._private_dirtyInternal = true;
193
+ }
194
+ }
195
+ set strokeThickness(value) {
196
+ if (value !== undefined) {
197
+ assertValidNonNegativeNumber(value, "UITextStyle.strokeThickness");
198
+ }
199
+ if (value !== this._private_strokeThicknessInternal) {
200
+ this._private_strokeThicknessInternal = value;
201
+ this._private_dirtyInternal = true;
202
+ }
203
+ }
204
+ /**
205
+ * Resolves complete style from primary and fallback sources.
206
+ * @param primary First style to check for each property
207
+ * @param fallback Second style to check if primary is undefined
208
+ * @returns Complete style configuration with all defaults applied
209
+ */
210
+ static resolve(primary, fallback) {
211
+ const fontSize = primary._private_fontSizeInternal ?? fallback._private_fontSizeInternal ?? TEXT_STYLE_DEFAULT_FONT_SIZE;
212
+ return {
213
+ color: primary._private_colorInternal ?? fallback._private_colorInternal ?? TEXT_STYLE_DEFAULT_COLOR,
214
+ align: primary._private_alignInternal ?? fallback._private_alignInternal ?? TEXT_STYLE_DEFAULT_ALIGN,
215
+ fontFamily: primary._private_fontFamilyInternal ?? fallback._private_fontFamilyInternal ??
216
+ TEXT_STYLE_DEFAULT_FONT_FAMILY,
217
+ fontSize,
218
+ fontStyle: primary._private_fontStyleInternal ?? fallback._private_fontStyleInternal ?? TEXT_STYLE_DEFAULT_FONT_STYLE,
219
+ fontWeight: primary._private_fontWeightInternal ?? fallback._private_fontWeightInternal ??
220
+ TEXT_STYLE_DEFAULT_FONT_WEIGHT,
221
+ lineHeight: primary._private_lineHeightInternal ?? fallback._private_lineHeightInternal ??
222
+ fontSize * TEXT_STYLE_DEFAULT_LINE_HEIGHT,
223
+ enableShadow: primary._private_enableShadowInternal ?? fallback._private_enableShadowInternal ??
224
+ TEXT_STYLE_DEFAULT_ENABLE_SHADOW,
225
+ shadowOffsetX: primary._private_shadowOffsetXInternal ?? fallback._private_shadowOffsetXInternal ??
226
+ TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X,
227
+ shadowOffsetY: primary._private_shadowOffsetYInternal ?? fallback._private_shadowOffsetYInternal ??
228
+ TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y,
229
+ shadowBlur: primary._private_shadowBlurInternal ?? fallback._private_shadowBlurInternal ??
230
+ TEXT_STYLE_DEFAULT_SHADOW_BLUR,
231
+ shadowColor: primary._private_shadowColorInternal ?? fallback._private_shadowColorInternal ??
232
+ TEXT_STYLE_DEFAULT_SHADOW_COLOR,
233
+ enableStroke: primary._private_enableStrokeInternal ?? fallback._private_enableStrokeInternal ??
234
+ TEXT_STYLE_DEFAULT_ENABLE_STROKE,
235
+ strokeColor: primary._private_strokeColorInternal ?? fallback._private_strokeColorInternal ??
236
+ TEXT_STYLE_DEFAULT_STROKE_COLOR,
237
+ strokeThickness: primary._private_strokeThicknessInternal ?? fallback._private_strokeThicknessInternal ??
238
+ TEXT_STYLE_DEFAULT_STROKE_THICKNESS,
239
+ };
240
+ }
241
+ /** @internal */
242
+ setDirtyFalse() {
243
+ this._private_dirtyInternal = false;
244
+ }
245
+ /** Sets all properties to default values */
246
+ setDefaults() {
247
+ if (this._private_colorInternal !== TEXT_STYLE_DEFAULT_COLOR ||
248
+ this._private_alignInternal !== TEXT_STYLE_DEFAULT_ALIGN ||
249
+ this._private_fontFamilyInternal !== TEXT_STYLE_DEFAULT_FONT_FAMILY ||
250
+ this._private_fontSizeInternal !== TEXT_STYLE_DEFAULT_FONT_SIZE ||
251
+ this._private_fontStyleInternal !== TEXT_STYLE_DEFAULT_FONT_STYLE ||
252
+ this._private_fontWeightInternal !== TEXT_STYLE_DEFAULT_FONT_WEIGHT ||
253
+ this._private_lineHeightInternal !== TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT ||
254
+ this._private_enableShadowInternal !== TEXT_STYLE_DEFAULT_ENABLE_SHADOW ||
255
+ this._private_shadowOffsetXInternal !== TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X ||
256
+ this._private_shadowOffsetYInternal !== TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y ||
257
+ this._private_shadowBlurInternal !== TEXT_STYLE_DEFAULT_SHADOW_BLUR ||
258
+ this._private_shadowColorInternal !== TEXT_STYLE_DEFAULT_SHADOW_COLOR ||
259
+ this._private_enableStrokeInternal !== TEXT_STYLE_DEFAULT_ENABLE_STROKE ||
260
+ this._private_strokeColorInternal !== TEXT_STYLE_DEFAULT_STROKE_COLOR ||
261
+ this._private_strokeThicknessInternal !== TEXT_STYLE_DEFAULT_STROKE_THICKNESS) {
262
+ this._private_colorInternal = TEXT_STYLE_DEFAULT_COLOR;
263
+ this._private_alignInternal = TEXT_STYLE_DEFAULT_ALIGN;
264
+ this._private_fontFamilyInternal = TEXT_STYLE_DEFAULT_FONT_FAMILY;
265
+ this._private_fontSizeInternal = TEXT_STYLE_DEFAULT_FONT_SIZE;
266
+ this._private_fontStyleInternal = TEXT_STYLE_DEFAULT_FONT_STYLE;
267
+ this._private_fontWeightInternal = TEXT_STYLE_DEFAULT_FONT_WEIGHT;
268
+ this._private_lineHeightInternal = TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT;
269
+ this._private_enableShadowInternal = TEXT_STYLE_DEFAULT_ENABLE_SHADOW;
270
+ this._private_shadowOffsetXInternal = TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X;
271
+ this._private_shadowOffsetYInternal = TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y;
272
+ this._private_shadowBlurInternal = TEXT_STYLE_DEFAULT_SHADOW_BLUR;
273
+ this._private_shadowColorInternal = TEXT_STYLE_DEFAULT_SHADOW_COLOR;
274
+ this._private_enableStrokeInternal = TEXT_STYLE_DEFAULT_ENABLE_STROKE;
275
+ this._private_strokeColorInternal = TEXT_STYLE_DEFAULT_STROKE_COLOR;
276
+ this._private_strokeThicknessInternal = TEXT_STYLE_DEFAULT_STROKE_THICKNESS;
277
+ this._private_dirtyInternal = true;
278
+ }
279
+ }
280
+ /** Sets all properties to undefined */
281
+ clear() {
282
+ if (this._private_colorInternal !== undefined ||
283
+ this._private_alignInternal !== undefined ||
284
+ this._private_fontFamilyInternal !== undefined ||
285
+ this._private_fontSizeInternal !== undefined ||
286
+ this._private_fontStyleInternal !== undefined ||
287
+ this._private_fontWeightInternal !== undefined ||
288
+ this._private_lineHeightInternal !== undefined ||
289
+ this._private_enableShadowInternal !== undefined ||
290
+ this._private_shadowOffsetXInternal !== undefined ||
291
+ this._private_shadowOffsetYInternal !== undefined ||
292
+ this._private_shadowBlurInternal !== undefined ||
293
+ this._private_shadowColorInternal !== undefined ||
294
+ this._private_enableStrokeInternal !== undefined ||
295
+ this._private_strokeColorInternal !== undefined ||
296
+ this._private_strokeThicknessInternal !== undefined) {
297
+ this._private_colorInternal = undefined;
298
+ this._private_alignInternal = undefined;
299
+ this._private_fontFamilyInternal = undefined;
300
+ this._private_fontSizeInternal = undefined;
301
+ this._private_fontStyleInternal = undefined;
302
+ this._private_fontWeightInternal = undefined;
303
+ this._private_lineHeightInternal = undefined;
304
+ this._private_enableShadowInternal = undefined;
305
+ this._private_shadowOffsetXInternal = undefined;
306
+ this._private_shadowOffsetYInternal = undefined;
307
+ this._private_shadowBlurInternal = undefined;
308
+ this._private_shadowColorInternal = undefined;
309
+ this._private_enableStrokeInternal = undefined;
310
+ this._private_strokeColorInternal = undefined;
311
+ this._private_strokeThicknessInternal = undefined;
312
+ this._private_dirtyInternal = true;
313
+ }
314
+ }
315
+ /** Copies from another style instance */
316
+ copy(value) {
317
+ if (this._private_colorInternal !== value._private_colorInternal ||
318
+ this._private_alignInternal !== value._private_alignInternal ||
319
+ this._private_fontFamilyInternal !== value._private_fontFamilyInternal ||
320
+ this._private_fontSizeInternal !== value._private_fontSizeInternal ||
321
+ this._private_fontStyleInternal !== value._private_fontStyleInternal ||
322
+ this._private_fontWeightInternal !== value._private_fontWeightInternal ||
323
+ this._private_lineHeightInternal !== value._private_lineHeightInternal ||
324
+ this._private_enableShadowInternal !== value._private_enableShadowInternal ||
325
+ this._private_shadowOffsetXInternal !== value._private_shadowOffsetXInternal ||
326
+ this._private_shadowOffsetYInternal !== value._private_shadowOffsetYInternal ||
327
+ this._private_shadowBlurInternal !== value._private_shadowBlurInternal ||
328
+ this._private_shadowColorInternal !== value._private_shadowColorInternal ||
329
+ this._private_enableStrokeInternal !== value._private_enableStrokeInternal ||
330
+ this._private_strokeColorInternal !== value._private_strokeColorInternal ||
331
+ this._private_strokeThicknessInternal !== value._private_strokeThicknessInternal) {
332
+ this._private_colorInternal = value._private_colorInternal;
333
+ this._private_alignInternal = value._private_alignInternal;
334
+ this._private_fontFamilyInternal = value._private_fontFamilyInternal;
335
+ this._private_fontSizeInternal = value._private_fontSizeInternal;
336
+ this._private_fontStyleInternal = value._private_fontStyleInternal;
337
+ this._private_fontWeightInternal = value._private_fontWeightInternal;
338
+ this._private_lineHeightInternal = value._private_lineHeightInternal;
339
+ this._private_enableShadowInternal = value._private_enableShadowInternal;
340
+ this._private_shadowOffsetXInternal = value._private_shadowOffsetXInternal;
341
+ this._private_shadowOffsetYInternal = value._private_shadowOffsetYInternal;
342
+ this._private_shadowBlurInternal = value._private_shadowBlurInternal;
343
+ this._private_shadowColorInternal = value._private_shadowColorInternal;
344
+ this._private_enableStrokeInternal = value._private_enableStrokeInternal;
345
+ this._private_strokeColorInternal = value._private_strokeColorInternal;
346
+ this._private_strokeThicknessInternal = value._private_strokeThicknessInternal;
347
+ this._private_dirtyInternal = true;
348
+ }
349
+ }
350
+ /**
351
+ * Calculates maximum padding required for stroke and shadow.
352
+ * @returns Padding in pixels needed on all sides
353
+ */
354
+ calculatePadding() {
355
+ let padding = 0;
356
+ if (this._private_enableStrokeInternal !== undefined) {
357
+ padding += this._private_strokeThicknessInternal ?? 0;
358
+ }
359
+ if (this._private_enableShadowInternal !== undefined) {
360
+ const blur = this._private_shadowBlurInternal ?? 0;
361
+ const offsetX = this._private_shadowOffsetXInternal ?? 0;
362
+ const offsetY = this._private_shadowOffsetYInternal ?? 0;
363
+ const shadowSpread = blur * 2;
364
+ const shadowMaxX = Math.abs(offsetX) + shadowSpread;
365
+ const shadowMaxY = Math.abs(offsetY) + shadowSpread;
366
+ padding += Math.max(shadowMaxX, shadowMaxY);
367
+ }
368
+ return Math.ceil(padding);
369
+ }
370
+ }
371
+
372
+ export { UITextStyle };
@@ -0,0 +1,6 @@
1
+ import { Texture } from 'three';
2
+
3
+ const TEXTURE_DEFAULT_TEXTURE = new Texture();
4
+ const TEXTURE_DEFAULT_SIZE = 2;
5
+
6
+ export { TEXTURE_DEFAULT_SIZE, TEXTURE_DEFAULT_TEXTURE };
@@ -0,0 +1,234 @@
1
+ import { Ferrsign3 } from 'ferrsign';
2
+ import { Matrix3, Vector2, Texture } from 'three';
3
+ import { assertValidPositiveNumber, assertValidNonNegativeNumber } from '../asserts.js';
4
+ import { TEXTURE_DEFAULT_TEXTURE, TEXTURE_DEFAULT_SIZE } from './UITextureView.Internal.js';
5
+
6
+ /** Wrapper for Three.js texture with atlas and trim support. Does not own the underlying texture; user must dispose it. */
7
+ class UITextureView {
8
+ /** @param config Texture or atlas configuration */
9
+ constructor(config) {
10
+ this._private_textureInternal = TEXTURE_DEFAULT_TEXTURE;
11
+ this._private_sourceWidth = TEXTURE_DEFAULT_SIZE;
12
+ this._private_sourceHeight = TEXTURE_DEFAULT_SIZE;
13
+ this._private_frameX = 0;
14
+ this._private_frameY = 0;
15
+ this._private_frameWidth = TEXTURE_DEFAULT_SIZE;
16
+ this._private_frameHeight = TEXTURE_DEFAULT_SIZE;
17
+ this._private_rotatedInternal = false;
18
+ this._private_scaleInternal = 1;
19
+ this._private_trimLeft = 0;
20
+ this._private_trimRight = 0;
21
+ this._private_trimTop = 0;
22
+ this._private_trimBottom = 0;
23
+ this._private_textureDirtyInternal = false;
24
+ this._private_uvTransformDirtyInternal = false;
25
+ this._private_trimDirtyInternal = false;
26
+ this._private_signalDiminsionsChangedInternal = new Ferrsign3();
27
+ if (config !== undefined) {
28
+ this.set(config);
29
+ }
30
+ }
31
+ /** Original width before trimming in world units */
32
+ get width() {
33
+ return this._private_sourceWidth / this._private_scaleInternal;
34
+ }
35
+ /** Original height before trimming in world units */
36
+ get height() {
37
+ return this._private_sourceHeight / this._private_scaleInternal;
38
+ }
39
+ /** Visible width after trimming in world units */
40
+ get trimmedWidth() {
41
+ const frameSize = this._private_rotatedInternal ? this._private_frameHeight : this._private_frameWidth;
42
+ return frameSize / this._private_scaleInternal;
43
+ }
44
+ /** Visible height after trimming in world units */
45
+ get trimmedHeight() {
46
+ const frameSize = this._private_rotatedInternal ? this._private_frameWidth : this._private_frameHeight;
47
+ return frameSize / this._private_scaleInternal;
48
+ }
49
+ /** Underlying Three.js texture */
50
+ get texture() {
51
+ return this._private_textureInternal;
52
+ }
53
+ /** Whether sprite is rotated in atlas */
54
+ get rotated() {
55
+ return this._private_rotatedInternal;
56
+ }
57
+ /** Scale factor for resolution independence */
58
+ get scale() {
59
+ return this._private_scaleInternal;
60
+ }
61
+ /** Transparent padding around visible content */
62
+ get trim() {
63
+ const scale = this._private_scaleInternal;
64
+ return {
65
+ left: this._private_trimLeft / scale,
66
+ right: this._private_trimRight / scale,
67
+ top: this._private_trimTop / scale,
68
+ bottom: this._private_trimBottom / scale,
69
+ };
70
+ }
71
+ get textureDirty() {
72
+ return this._private_textureDirtyInternal;
73
+ }
74
+ /** Whether UV transform inputs changed since last check */
75
+ get uvTransformDirty() {
76
+ return this._private_uvTransformDirtyInternal;
77
+ }
78
+ /** Whether trim values changed since last check */
79
+ get trimDirty() {
80
+ return this._private_trimDirtyInternal;
81
+ }
82
+ get signalDiminsionsChanged() {
83
+ return this._private_signalDiminsionsChangedInternal;
84
+ }
85
+ setTextureDirtyFalse() {
86
+ this._private_textureDirtyInternal = false;
87
+ }
88
+ /** Marks UV transform as clean. @internal */
89
+ setUVTransformDirtyFalse() {
90
+ this._private_uvTransformDirtyInternal = false;
91
+ }
92
+ /** Marks trim as clean. @internal */
93
+ setTrimDirtyFalse() {
94
+ this._private_trimDirtyInternal = false;
95
+ }
96
+ /**
97
+ * Calculates UV transform matrix for shader sampling.
98
+ * @param result Matrix to store result in
99
+ * @returns UV transform matrix
100
+ */
101
+ calculateUVTransform(result = new Matrix3()) {
102
+ const atlasWidth = this._private_textureInternal.image?.naturalWidth ?? TEXTURE_DEFAULT_SIZE;
103
+ const atlasHeight = this._private_textureInternal.image?.naturalHeight ?? TEXTURE_DEFAULT_SIZE;
104
+ if (this._private_rotatedInternal) {
105
+ const physicalWidth = this._private_frameHeight;
106
+ const physicalHeight = this._private_frameWidth;
107
+ const u0 = this._private_frameX / atlasWidth;
108
+ const v0 = (atlasHeight - this._private_frameY - physicalHeight) / atlasHeight;
109
+ const uSize = physicalWidth / atlasWidth;
110
+ const vSize = physicalHeight / atlasHeight;
111
+ result.set(0, uSize, u0, -vSize, 0, v0 + vSize, 0, 0, 1);
112
+ }
113
+ else {
114
+ const u0 = this._private_frameX / atlasWidth;
115
+ const v0 = (atlasHeight - this._private_frameY - this._private_frameHeight) / atlasHeight;
116
+ const uSize = this._private_frameWidth / atlasWidth;
117
+ const vSize = this._private_frameHeight / atlasHeight;
118
+ result.set(uSize, 0, u0, 0, vSize, v0, 0, 0, 1);
119
+ }
120
+ return result;
121
+ }
122
+ /**
123
+ * Gets original dimensions before trimming.
124
+ * @param result Vector to store result in
125
+ * @returns Width and height in world units
126
+ */
127
+ getResolution(result = new Vector2()) {
128
+ return result.set(this.width, this.height);
129
+ }
130
+ /**
131
+ * Replaces texture with new configuration.
132
+ * @param config Texture or atlas configuration
133
+ */
134
+ set(config) {
135
+ const lastWidth = this.width;
136
+ const lastHeight = this.height;
137
+ if (config instanceof Texture) {
138
+ this._private_setFromTexture(config);
139
+ }
140
+ else {
141
+ this._private_setFromAtlasConfig(config);
142
+ }
143
+ if (this.width !== lastWidth || this.height !== lastHeight) {
144
+ this._private_signalDiminsionsChangedInternal.emit(this.width, this.height, this);
145
+ }
146
+ }
147
+ _private_setFromTexture(texture) {
148
+ const width = texture.image?.naturalWidth ?? TEXTURE_DEFAULT_SIZE;
149
+ const height = texture.image?.naturalHeight ?? TEXTURE_DEFAULT_SIZE;
150
+ this._private_sourceWidth = width;
151
+ this._private_sourceHeight = height;
152
+ if (this.texture !== texture) {
153
+ this._private_textureInternal = texture;
154
+ this._private_textureDirtyInternal = true;
155
+ }
156
+ if (this._private_frameX !== 0 ||
157
+ this._private_frameY !== 0 ||
158
+ this._private_frameWidth !== width ||
159
+ this._private_frameHeight !== height ||
160
+ this._private_scaleInternal !== 1 || this._private_rotatedInternal) {
161
+ this._private_frameX = 0;
162
+ this._private_frameY = 0;
163
+ this._private_frameWidth = width;
164
+ this._private_frameHeight = height;
165
+ this._private_rotatedInternal = false;
166
+ this._private_scaleInternal = 1;
167
+ this._private_uvTransformDirtyInternal = true;
168
+ }
169
+ if (this._private_trimLeft !== 0 ||
170
+ this._private_trimRight !== 0 ||
171
+ this._private_trimTop !== 0 ||
172
+ this._private_trimBottom !== 0) {
173
+ this._private_trimLeft = 0;
174
+ this._private_trimRight = 0;
175
+ this._private_trimTop = 0;
176
+ this._private_trimBottom = 0;
177
+ this._private_trimDirtyInternal = true;
178
+ }
179
+ }
180
+ _private_setFromAtlasConfig(config) {
181
+ assertValidPositiveNumber(config.sourceSize.w, "UITextureView.setFromAtlasConfig.config.sourceSize.w");
182
+ assertValidPositiveNumber(config.sourceSize.h, "UITextureView.setFromAtlasConfig.config.sourceSize.h");
183
+ assertValidNonNegativeNumber(config.frame.x, "UITextureView.setFromAtlasConfig.config.frame.x");
184
+ assertValidNonNegativeNumber(config.frame.y, "UITextureView.setFromAtlasConfig.config.frame.y");
185
+ assertValidPositiveNumber(config.frame.w, "UITextureView.setFromAtlasConfig.config.frame.w");
186
+ assertValidPositiveNumber(config.frame.h, "UITextureView.setFromAtlasConfig.config.frame.h");
187
+ assertValidNonNegativeNumber(config.spriteSourceSize.x, "UITextureView.setFromAtlasConfig.config.spriteSourceSize.x");
188
+ assertValidNonNegativeNumber(config.spriteSourceSize.y, "UITextureView.setFromAtlasConfig.config.spriteSourceSize.y");
189
+ assertValidPositiveNumber(config.spriteSourceSize.w, "UITextureView.setFromAtlasConfig.config.spriteSourceSize.w");
190
+ assertValidPositiveNumber(config.spriteSourceSize.h, "UITextureView.setFromAtlasConfig.config.spriteSourceSize.h");
191
+ if (config.scale !== undefined) {
192
+ assertValidPositiveNumber(config.scale, "UITextureView.setFromAtlasConfig.config.scale");
193
+ }
194
+ this._private_sourceWidth = config.sourceSize.w;
195
+ this._private_sourceHeight = config.sourceSize.h;
196
+ if (this.texture !== config.texture) {
197
+ this._private_textureInternal = config.texture;
198
+ this._private_textureDirtyInternal = true;
199
+ }
200
+ const scale = config.scale ?? 1;
201
+ const rotated = config.rotated ?? false;
202
+ if (this._private_frameX !== 0 ||
203
+ this._private_frameY !== 0 ||
204
+ this._private_frameWidth !== config.frame.w ||
205
+ this._private_frameHeight !== config.frame.h ||
206
+ this._private_scaleInternal !== scale ||
207
+ this._private_rotatedInternal !== rotated) {
208
+ this._private_frameX = config.frame.x;
209
+ this._private_frameY = config.frame.y;
210
+ this._private_frameWidth = config.frame.w;
211
+ this._private_frameHeight = config.frame.h;
212
+ this._private_scaleInternal = scale;
213
+ this._private_rotatedInternal = rotated;
214
+ this._private_uvTransformDirtyInternal = true;
215
+ }
216
+ const spriteSource = config.spriteSourceSize;
217
+ const trimLeft = spriteSource.x;
218
+ const trimTop = spriteSource.y;
219
+ const trimRight = this._private_sourceWidth - spriteSource.x - spriteSource.w;
220
+ const trimBottom = this._private_sourceHeight - spriteSource.y - spriteSource.h;
221
+ if (this._private_trimLeft !== trimLeft ||
222
+ this._private_trimRight !== trimRight ||
223
+ this._private_trimTop !== trimTop ||
224
+ this._private_trimBottom !== trimBottom) {
225
+ this._private_trimLeft = trimLeft;
226
+ this._private_trimRight = trimRight;
227
+ this._private_trimTop = trimTop;
228
+ this._private_trimBottom = trimBottom;
229
+ this._private_trimDirtyInternal = true;
230
+ }
231
+ }
232
+ }
233
+
234
+ export { UITextureView };