laymur 0.17.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 (395) hide show
  1. package/{src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts → dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts} +2 -3
  2. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +22 -0
  3. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
  4. package/dist/core/constraints/UIConstraint.d.ts +12 -0
  5. package/dist/core/constraints/UIConstraint.js +11 -0
  6. package/dist/core/constraints/UICustomConstraint.d.ts +28 -0
  7. package/dist/core/constraints/UICustomConstraint.js +37 -0
  8. package/{src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts → dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts} +2 -3
  9. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +20 -0
  10. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
  11. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +11 -0
  12. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
  13. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +36 -0
  14. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
  15. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +14 -0
  16. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
  17. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +44 -0
  18. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
  19. package/{src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts → dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts} +2 -3
  20. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +22 -0
  21. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
  22. package/{src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts → dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts} +8 -9
  23. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +43 -0
  24. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
  25. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +11 -0
  26. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
  27. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +32 -0
  28. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
  29. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +14 -0
  30. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
  31. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +44 -0
  32. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
  33. package/{src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts → dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts} +2 -3
  34. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +22 -0
  35. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
  36. package/{src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts → dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts} +2 -3
  37. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +20 -0
  38. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
  39. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +64 -0
  40. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
  41. package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +46 -0
  42. package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
  43. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +13 -0
  44. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
  45. package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +29 -0
  46. package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
  47. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +13 -0
  48. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
  49. package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +29 -0
  50. package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
  51. package/dist/core/elements/UIAnchor/UIAnchor.Internal.d.ts +12 -0
  52. package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
  53. package/dist/core/elements/UIAnchor/UIAnchor.d.ts +32 -0
  54. package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
  55. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +27 -0
  56. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
  57. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +77 -0
  58. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
  59. package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +30 -0
  60. package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
  61. package/dist/core/elements/UIDummy/UIDummy.d.ts +82 -0
  62. package/dist/core/elements/UIDummy/UIDummy.js +173 -0
  63. package/{src/core/elements/UIElement/UIElement.Internal.ts → dist/core/elements/UIElement/UIElement.Internal.d.ts} +5 -7
  64. package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
  65. package/dist/core/elements/UIElement/UIElement.d.ts +38 -0
  66. package/dist/core/elements/UIElement/UIElement.js +74 -0
  67. package/{src/core/elements/UIGraphics/UIGraphics.Internal.ts → dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts} +5 -7
  68. package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
  69. package/dist/core/elements/UIGraphics/UIGraphics.d.ts +51 -0
  70. package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
  71. package/{src/core/elements/UIImage/UIImage.Internal.ts → dist/core/elements/UIImage/UIImage.Internal.d.ts} +2 -3
  72. package/dist/core/elements/UIImage/UIImage.d.ts +32 -0
  73. package/dist/core/elements/UIImage/UIImage.js +85 -0
  74. package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +23 -0
  75. package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
  76. package/dist/core/elements/UINineSlice/UINineSlice.d.ts +60 -0
  77. package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
  78. package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +14 -0
  79. package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
  80. package/dist/core/elements/UIProgress/UIProgress.d.ts +45 -0
  81. package/dist/core/elements/UIProgress/UIProgress.js +165 -0
  82. package/dist/core/elements/UIScene/UIScene.Internal.d.ts +43 -0
  83. package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
  84. package/dist/core/elements/UIScene/UIScene.d.ts +59 -0
  85. package/dist/core/elements/UIScene/UIScene.js +157 -0
  86. package/{src/core/elements/UIText/UIText.Interfaces.ts → dist/core/elements/UIText/UIText.Interfaces.d.ts} +16 -21
  87. package/dist/core/elements/UIText/UIText.Internal.d.ts +26 -0
  88. package/dist/core/elements/UIText/UIText.Internal.js +12 -0
  89. package/dist/core/elements/UIText/UIText.Measuring.d.ts +50 -0
  90. package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
  91. package/dist/core/elements/UIText/UIText.Rendering.d.ts +20 -0
  92. package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
  93. package/dist/core/elements/UIText/UIText.d.ts +71 -0
  94. package/dist/core/elements/UIText/UIText.js +265 -0
  95. package/{src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts → dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts} +11 -14
  96. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
  97. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +63 -0
  98. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
  99. package/{src/core/layers/UILayer/UILayer.Internal.ts → dist/core/layers/UILayer/UILayer.Internal.d.ts} +11 -15
  100. package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
  101. package/dist/core/layers/UILayer/UILayer.d.ts +49 -0
  102. package/dist/core/layers/UILayer/UILayer.js +113 -0
  103. package/dist/core/miscellaneous/UIExpression.d.ts +69 -0
  104. package/dist/core/miscellaneous/UIExpression.js +128 -0
  105. package/dist/core/miscellaneous/UIMode.d.ts +23 -0
  106. package/dist/core/miscellaneous/UIMode.js +30 -0
  107. package/dist/core/miscellaneous/UIOrientation.d.ts +15 -0
  108. package/dist/core/miscellaneous/UIOrientation.js +20 -0
  109. package/dist/core/miscellaneous/UIPriority.d.ts +32 -0
  110. package/dist/core/miscellaneous/UIPriority.js +63 -0
  111. package/dist/core/miscellaneous/UIRelation.d.ts +23 -0
  112. package/dist/core/miscellaneous/UIRelation.js +40 -0
  113. package/dist/core/miscellaneous/UITransparencyMode.d.ts +9 -0
  114. package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
  115. package/dist/core/miscellaneous/area/UIArea.d.ts +3 -0
  116. package/dist/core/miscellaneous/area/UIArea.js +5 -0
  117. package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +15 -0
  118. package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
  119. package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +12 -0
  120. package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
  121. package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +17 -0
  122. package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
  123. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +21 -0
  124. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
  125. package/dist/core/miscellaneous/asserts.d.ts +43 -0
  126. package/dist/core/miscellaneous/asserts.js +163 -0
  127. package/dist/core/miscellaneous/canvas.d.ts +31 -0
  128. package/dist/core/miscellaneous/canvas.js +37 -0
  129. package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +7 -0
  130. package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
  131. package/dist/core/miscellaneous/color/UIColor.d.ts +234 -0
  132. package/dist/core/miscellaneous/color/UIColor.js +636 -0
  133. package/dist/core/miscellaneous/computeTransform.d.ts +18 -0
  134. package/dist/core/miscellaneous/computeTransform.js +82 -0
  135. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +19 -0
  136. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
  137. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +1 -0
  138. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
  139. package/{src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts → dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts} +8 -10
  140. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +1 -0
  141. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
  142. package/dist/core/miscellaneous/generic-plane/shared.d.ts +38 -0
  143. package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
  144. package/dist/core/miscellaneous/insets/UIInsets.Internal.d.ts +11 -0
  145. package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
  146. package/dist/core/miscellaneous/insets/UIInsets.d.ts +48 -0
  147. package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
  148. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +9 -0
  149. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
  150. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +21 -0
  151. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
  152. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +16 -0
  153. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
  154. package/dist/core/miscellaneous/math.d.ts +7 -0
  155. package/dist/core/miscellaneous/math.js +11 -0
  156. package/dist/core/miscellaneous/micro/UIMicro.Internal.d.ts +31 -0
  157. package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
  158. package/dist/core/miscellaneous/micro/UIMicro.d.ts +59 -0
  159. package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
  160. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.d.ts +3 -0
  161. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
  162. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +22 -0
  163. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
  164. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +22 -0
  165. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
  166. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +22 -0
  167. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
  168. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +22 -0
  169. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
  170. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +22 -0
  171. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
  172. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +22 -0
  173. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
  174. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +5 -0
  175. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
  176. package/dist/core/miscellaneous/shared.d.ts +46 -0
  177. package/dist/core/miscellaneous/shared.js +37 -0
  178. package/{src/core/miscellaneous/text-span/UITextSpan.Internal.ts → dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts} +4 -5
  179. package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +14 -0
  180. package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
  181. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.d.ts +48 -0
  182. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
  183. package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +85 -0
  184. package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
  185. package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +49 -0
  186. package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
  187. package/dist/core/miscellaneous/texture/UITextureView.d.ts +67 -0
  188. package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
  189. package/dist/core/miscellaneous/webglCapabilities.d.ts +2 -0
  190. package/dist/core/miscellaneous/webglCapabilities.js +103 -0
  191. package/dist/core/shaders/UIImage.glsl.js +3 -0
  192. package/dist/core/shaders/UINineSlice.glsl.js +3 -0
  193. package/dist/core/shaders/UIProgress.glsl.js +3 -0
  194. package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
  195. package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
  196. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +17 -0
  197. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +13 -0
  198. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
  199. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +13 -0
  200. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +20 -0
  201. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
  202. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +49 -0
  203. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +215 -0
  204. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
  205. package/dist/index.js +51 -0
  206. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
  207. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
  208. package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
  209. package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
  210. package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
  211. package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
  212. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
  213. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
  214. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
  215. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
  216. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
  217. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
  218. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
  219. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
  220. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
  221. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
  222. package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
  223. package/dist/particles/elements/UIEmitter.Internal.js +11 -0
  224. package/dist/particles/elements/UIEmitter.d.ts +68 -0
  225. package/dist/particles/elements/UIEmitter.js +203 -0
  226. package/dist/particles/index.js +18 -0
  227. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
  228. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
  229. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
  230. package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
  231. package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
  232. package/dist/particles/miscellaneous/miscellaneous.js +67 -0
  233. package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
  234. package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
  235. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
  236. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
  237. package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
  238. package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
  239. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
  240. package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
  241. package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
  242. package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
  243. package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
  244. package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
  245. package/dist/particles/spawnModules/UISpawnModule.js +9 -0
  246. package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
  247. package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
  248. package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
  249. package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
  250. package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
  251. package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
  252. package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
  253. package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
  254. package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
  255. package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
  256. package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
  257. package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
  258. package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
  259. package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
  260. package/package.json +8 -1
  261. package/.claude/settings.local.json +0 -9
  262. package/.editorconfig +0 -14
  263. package/CLAUDE.md +0 -181
  264. package/assets/logotype.png +0 -0
  265. package/eslint.config.js +0 -111
  266. package/rollup.config.js +0 -52
  267. package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +0 -60
  268. package/src/core/constraints/UIConstraint.ts +0 -20
  269. package/src/core/constraints/UICustomConstraint.ts +0 -62
  270. package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +0 -52
  271. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +0 -13
  272. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +0 -139
  273. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +0 -16
  274. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +0 -189
  275. package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +0 -68
  276. package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +0 -94
  277. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +0 -13
  278. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +0 -135
  279. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +0 -16
  280. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +0 -189
  281. package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +0 -68
  282. package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +0 -52
  283. package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +0 -84
  284. package/src/core/constraints/builders/UIConstraint2DBuilder.ts +0 -168
  285. package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +0 -15
  286. package/src/core/constraints/builders/UICoverConstraintBuilder.ts +0 -84
  287. package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +0 -15
  288. package/src/core/constraints/builders/UIFitConstraintBuilder.ts +0 -84
  289. package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +0 -13
  290. package/src/core/elements/UIAnchor/UIAnchor.ts +0 -70
  291. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +0 -30
  292. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +0 -355
  293. package/src/core/elements/UIDummy/UIDummy.Internal.ts +0 -33
  294. package/src/core/elements/UIDummy/UIDummy.ts +0 -244
  295. package/src/core/elements/UIElement/UIElement.ts +0 -127
  296. package/src/core/elements/UIGraphics/UIGraphics.ts +0 -168
  297. package/src/core/elements/UIImage/UIImage.ts +0 -138
  298. package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +0 -26
  299. package/src/core/elements/UINineSlice/UINineSlice.ts +0 -296
  300. package/src/core/elements/UIProgress/UIProgress.Internal.ts +0 -24
  301. package/src/core/elements/UIProgress/UIProgress.ts +0 -259
  302. package/src/core/elements/UIScene/UIScene.Internal.ts +0 -46
  303. package/src/core/elements/UIScene/UIScene.ts +0 -259
  304. package/src/core/elements/UIText/UIText.Internal.ts +0 -29
  305. package/src/core/elements/UIText/UIText.Measuring.ts +0 -183
  306. package/src/core/elements/UIText/UIText.Rendering.ts +0 -83
  307. package/src/core/elements/UIText/UIText.ts +0 -376
  308. package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +0 -233
  309. package/src/core/layers/UILayer/UILayer.ts +0 -156
  310. package/src/core/miscellaneous/UIExpression.ts +0 -142
  311. package/src/core/miscellaneous/UIMode.ts +0 -29
  312. package/src/core/miscellaneous/UIOrientation.ts +0 -18
  313. package/src/core/miscellaneous/UIPriority.ts +0 -63
  314. package/src/core/miscellaneous/UIRelation.ts +0 -39
  315. package/src/core/miscellaneous/UITransparencyMode.ts +0 -9
  316. package/src/core/miscellaneous/area/UIArea.ts +0 -5
  317. package/src/core/miscellaneous/area/UIAreaCircle.ts +0 -32
  318. package/src/core/miscellaneous/area/UIAreaPolygon.ts +0 -50
  319. package/src/core/miscellaneous/area/UIAreaRectangle.ts +0 -38
  320. package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +0 -78
  321. package/src/core/miscellaneous/asserts.ts +0 -187
  322. package/src/core/miscellaneous/canvas.ts +0 -73
  323. package/src/core/miscellaneous/color/UIColor.Internal.ts +0 -89
  324. package/src/core/miscellaneous/color/UIColor.ts +0 -844
  325. package/src/core/miscellaneous/computeTransform.ts +0 -127
  326. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +0 -235
  327. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +0 -524
  328. package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +0 -448
  329. package/src/core/miscellaneous/generic-plane/shared.ts +0 -323
  330. package/src/core/miscellaneous/insets/UIInsets.Internal.ts +0 -9
  331. package/src/core/miscellaneous/insets/UIInsets.ts +0 -248
  332. package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +0 -24
  333. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +0 -58
  334. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +0 -52
  335. package/src/core/miscellaneous/math.ts +0 -16
  336. package/src/core/miscellaneous/micro/UIMicro.Internal.ts +0 -33
  337. package/src/core/miscellaneous/micro/UIMicro.ts +0 -222
  338. package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +0 -8
  339. package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +0 -57
  340. package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +0 -65
  341. package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +0 -65
  342. package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +0 -57
  343. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +0 -65
  344. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +0 -65
  345. package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +0 -11
  346. package/src/core/miscellaneous/shared.ts +0 -73
  347. package/src/core/miscellaneous/text-span/UITextSpan.ts +0 -43
  348. package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +0 -52
  349. package/src/core/miscellaneous/text-style/UITextStyle.ts +0 -479
  350. package/src/core/miscellaneous/texture/UITextureView.Internal.ts +0 -55
  351. package/src/core/miscellaneous/texture/UITextureView.ts +0 -308
  352. package/src/core/miscellaneous/webglCapabilities.ts +0 -129
  353. package/src/core/shaders/UIImage.glsl +0 -10
  354. package/src/core/shaders/UINineSlice.glsl +0 -53
  355. package/src/core/shaders/UIProgress.glsl +0 -15
  356. package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +0 -13
  357. package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +0 -12
  358. package/src/core/shaders/glsl.d.ts +0 -27
  359. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +0 -23
  360. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +0 -124
  361. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +0 -22
  362. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +0 -101
  363. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +0 -58
  364. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +0 -605
  365. package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +0 -70
  366. package/src/particles/behaviorModules/UIBehaviorModule.ts +0 -20
  367. package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +0 -173
  368. package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +0 -104
  369. package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +0 -75
  370. package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +0 -115
  371. package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +0 -77
  372. package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +0 -118
  373. package/src/particles/elements/UIEmitter.Internal.ts +0 -22
  374. package/src/particles/elements/UIEmitter.ts +0 -313
  375. package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +0 -263
  376. package/src/particles/instancedParticle/UIInstancedParticle.ts +0 -138
  377. package/src/particles/miscellaneous/miscellaneous.ts +0 -115
  378. package/src/particles/renderingModules/UIRenderingColorOverLife.ts +0 -39
  379. package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +0 -49
  380. package/src/particles/renderingModules/UIRenderingModule.ts +0 -17
  381. package/src/particles/renderingModules/UIRenderingTexture.ts +0 -30
  382. package/src/particles/shaders/UIRenderingColorOverLife.glsl +0 -4
  383. package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +0 -6
  384. package/src/particles/shaders/UIRenderingTexture.glsl +0 -4
  385. package/src/particles/spawnModules/UISpawnModule.ts +0 -22
  386. package/src/particles/spawnModules/UISpawnOffset.ts +0 -62
  387. package/src/particles/spawnModules/UISpawnRandomLifetime.ts +0 -68
  388. package/src/particles/spawnModules/UISpawnRandomRotation.ts +0 -60
  389. package/src/particles/spawnModules/UISpawnRandomScale.ts +0 -81
  390. package/src/particles/spawnModules/UISpawnRandomTorque.ts +0 -62
  391. package/src/particles/spawnModules/UISpawnRandomVelocity.ts +0 -92
  392. package/src/particles/spawnModules/UISpawnRectangle.ts +0 -81
  393. package/tsconfig.json +0 -29
  394. /package/{src/core/index.ts → dist/core/index.d.ts} +0 -0
  395. /package/{src/particles/index.ts → dist/particles/index.d.ts} +0 -0
@@ -1,376 +0,0 @@
1
- import type { CanvasTexture, WebGLRenderer } from "three";
2
- import { Matrix3 } from "three";
3
- import type { UILayer } from "../../layers/UILayer/UILayer";
4
- import { UIColor } from "../../miscellaneous/color/UIColor";
5
- import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
6
- import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
7
- import { UIInsets } from "../../miscellaneous/insets/UIInsets";
8
- import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal";
9
- import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan";
10
- import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle";
11
- import source from "../../shaders/UIImage.glsl";
12
- import { UIElement } from "../UIElement/UIElement";
13
- import type { UICanvas, UICanvasRenderingContext2D } from "../../miscellaneous/canvas";
14
- import { createCanvas, createCanvasTexture } from "../../miscellaneous/canvas";
15
- import type { UITextChunk, UITextContent } from "./UIText.Interfaces";
16
- import type { UITextOptions } from "./UIText.Internal";
17
- import {
18
- TEXT_DEFAULT_MAX_LINE_WIDTH,
19
- TEXT_DEFAULT_RESIZE_MODE,
20
- UITextResizeMode,
21
- } from "./UIText.Internal";
22
- import { buildTextChunks, calculateTextContentParameters } from "./UIText.Measuring";
23
- import { renderTextLines } from "./UIText.Rendering";
24
-
25
- /** Canvas-based text rendering element */
26
- export class UIText extends UIElement {
27
- /** Default style applied to all text spans */
28
- public readonly commonStyle: UITextStyle;
29
-
30
- private readonly colorInternal: UIColor;
31
- private readonly paddingInternal: UIInsets;
32
- private readonly canvas: UICanvas;
33
- private readonly context: UICanvasRenderingContext2D;
34
- private texture: CanvasTexture;
35
-
36
- private contentInternal: UITextSpan[] = [];
37
- private contentDirty = false;
38
-
39
- private maxLineWidthInternal: number;
40
- private maxLineWidthDirty = false;
41
-
42
- private resizeModeInternal: UITextResizeMode;
43
- private resizeModeDirty = false;
44
-
45
- private lastWidth: number;
46
- private lastHeight: number;
47
-
48
- private textChunks: UITextChunk[] = [];
49
- private textChunksDirty = false;
50
-
51
- /**
52
- * Creates a new UIText instance.
53
- *
54
- * @param layer - Layer containing this element
55
- * @param content - Text content as string or styled spans
56
- * @param options - Configuration options
57
- */
58
- constructor(layer: UILayer, content: UITextContent, options: Partial<UITextOptions> = {}) {
59
- const canvas = createCanvas(2, 2);
60
- const context = canvas.getContext("2d") as UICanvasRenderingContext2D | null;
61
-
62
- if (!context) {
63
- throw new Error("UIText.constructor: failed to create canvas context");
64
- }
65
-
66
- const texture = createCanvasTexture(canvas);
67
- texture.needsUpdate = true;
68
- const color = new UIColor(options.color);
69
-
70
- super(layer, source, {
71
- texture: texture,
72
- textureTransform: new Matrix3(),
73
- color,
74
- });
75
-
76
- this.colorInternal = color;
77
- this.paddingInternal = new UIInsets(options.padding);
78
- this.commonStyle = new UITextStyle(options.commonStyle);
79
- this.maxLineWidthInternal = options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
80
- this.resizeModeInternal = options.resizeMode ?? TEXT_DEFAULT_RESIZE_MODE;
81
-
82
- this.canvas = canvas;
83
- this.context = context;
84
- this.texture = texture;
85
- this.content = content;
86
-
87
- this.lastWidth = this.width;
88
- this.lastHeight = this.height;
89
-
90
- if (options.padding === undefined) {
91
- this.paddingInternal.setUnified(
92
- this.content.reduce(
93
- (a, b) => Math.max(a, b.style.calculatePadding()),
94
- this.commonStyle.calculatePadding(),
95
- ),
96
- );
97
- }
98
-
99
- switch (this.resizeModeInternal) {
100
- case UITextResizeMode.SCALE:
101
- this.tryToRenderTextScaleMode();
102
- break;
103
-
104
- case UITextResizeMode.BREAK:
105
- this.tryToRenderTextBreakMode();
106
- break;
107
- }
108
- }
109
-
110
- /** Multiplicative tint. Alpha channel controls opacity. */
111
- public get color(): UIColor {
112
- return this.colorInternal;
113
- }
114
-
115
- /** Text content as array of styled spans */
116
- public get content(): UITextSpan[] {
117
- return this.contentInternal;
118
- }
119
-
120
- /** Maximum line width before wrapping in pixels */
121
- public get maxLineWidth(): number {
122
- return this.maxLineWidthInternal;
123
- }
124
-
125
- /** Text padding in world units */
126
- public get padding(): UIInsets {
127
- return this.paddingInternal;
128
- }
129
-
130
- /** Controls how text adapts to element size */
131
- public get resizeMode(): UITextResizeMode {
132
- return this.resizeModeInternal;
133
- }
134
-
135
- /** Multiplicative tint. Alpha channel controls opacity. */
136
- public set color(value: UIColorConfig) {
137
- this.colorInternal.set(value);
138
- }
139
-
140
- /** Text content as string, span config, or array */
141
- public set content(value: UITextContent) {
142
- if (this.contentInternal !== value) {
143
- if (typeof value === "string") {
144
- this.contentInternal = [new UITextSpan({ text: value, style: new UITextStyle() })];
145
- } else if (Array.isArray(value)) {
146
- this.contentInternal = value.map((span) =>
147
- typeof span === "string"
148
- ? new UITextSpan({ text: span, style: new UITextStyle() })
149
- : new UITextSpan({
150
- text: span.text,
151
- style: new UITextStyle(span.style),
152
- }),
153
- );
154
- } else {
155
- this.contentInternal = [
156
- new UITextSpan({
157
- text: value.text,
158
- style: new UITextStyle(value.style),
159
- }),
160
- ];
161
- }
162
- this.contentDirty = true;
163
- this.textChunksDirty = true;
164
- }
165
- }
166
-
167
- /** Maximum line width before wrapping in pixels */
168
- public set maxLineWidth(value: number) {
169
- if (this.maxLineWidthInternal !== value) {
170
- this.maxLineWidthInternal = value;
171
- this.maxLineWidthDirty = true;
172
- }
173
- }
174
-
175
- /** Text padding in world units */
176
- public set padding(value: UIInsetsConfig) {
177
- this.paddingInternal.set(value);
178
- }
179
-
180
- /** Controls how text adapts to size constraints */
181
- public set resizeMode(value: UITextResizeMode) {
182
- if (this.resizeModeInternal !== value) {
183
- this.resizeModeInternal = value;
184
- this.resizeModeDirty = true;
185
- }
186
- }
187
-
188
- /** Removes element and frees resources */
189
- public override destroy(): void {
190
- this.texture.dispose();
191
- super.destroy();
192
- }
193
-
194
- protected override onWillRender(renderer: WebGLRenderer, deltaTime: number): void {
195
- switch (this.resizeModeInternal) {
196
- case UITextResizeMode.SCALE:
197
- this.tryToRenderTextScaleMode();
198
- break;
199
-
200
- case UITextResizeMode.BREAK:
201
- this.tryToRenderTextBreakMode();
202
- break;
203
- }
204
-
205
- super.onWillRender(renderer, deltaTime);
206
- }
207
-
208
- private tryToRenderTextScaleMode(): void {
209
- if (
210
- !this.colorInternal.dirty &&
211
- !this.resizeModeDirty &&
212
- !this.maxLineWidthDirty &&
213
- !this.paddingInternal.dirty &&
214
- !(
215
- this.solverWrapper.dirty &&
216
- this.lastWidth / this.lastHeight !== Math.round(this.width) / Math.round(this.height)
217
- ) &&
218
- !this.checkContentDirty()
219
- ) {
220
- return;
221
- }
222
-
223
- const textChunks = this.buildTextChunks();
224
-
225
- const { lines, size } = calculateTextContentParameters(textChunks, this.maxLineWidthInternal);
226
-
227
- const paddingV = this.paddingInternal.top + this.paddingInternal.bottom;
228
- const paddingH = this.paddingInternal.left + this.paddingInternal.right;
229
-
230
- const desiredHeight = size.height + paddingV;
231
- const desiredWidth = size.width + paddingH;
232
-
233
- // Two calculation passes are required to cover both cases -
234
- // when the width is specified by a constraint and cannot be changed,
235
- // or when the height is specified by a constraint and cannot be changed,
236
- // but the width still has priority, because it is specified first and last.
237
- this.width = desiredWidth;
238
- this.height = (desiredHeight / desiredWidth) * Math.round(this.width);
239
- this.width = (desiredWidth / desiredHeight) * Math.round(this.height);
240
-
241
- const resolutionDirty = this.lastWidth !== desiredHeight || this.lastHeight !== desiredWidth;
242
-
243
- if (resolutionDirty) {
244
- this.canvas.height = desiredHeight;
245
- this.canvas.width = desiredWidth;
246
- }
247
-
248
- renderTextLines(this.paddingInternal.top, this.paddingInternal.left, lines, this.context);
249
-
250
- this.updateProperties(resolutionDirty);
251
-
252
- this.resizeModeDirty = false;
253
- this.maxLineWidthDirty = false;
254
- this.paddingInternal.setDirtyFalse();
255
- this.setDimensionsDirtyFalse();
256
- this.setContentDirtyFalse();
257
- }
258
-
259
- private tryToRenderTextBreakMode(): void {
260
- if (
261
- !this.colorInternal.dirty &&
262
- !this.resizeModeDirty &&
263
- !this.maxLineWidthDirty &&
264
- !this.paddingInternal.dirty &&
265
- !this.checkDimensionsDirty() &&
266
- !this.checkContentDirty()
267
- ) {
268
- return;
269
- }
270
-
271
- const textChunks = this.buildTextChunks();
272
-
273
- // Two passes of text size calculation are needed to first
274
- // suggest the desired sizes to the solver, and then
275
- // adjust our expectations based on the result obtained.
276
-
277
- const { size: desiredTextSize } = calculateTextContentParameters(
278
- textChunks,
279
- this.maxLineWidthInternal,
280
- );
281
-
282
- const paddingV = this.paddingInternal.top + this.paddingInternal.bottom;
283
- const paddingH = this.paddingInternal.left + this.paddingInternal.right;
284
-
285
- this.height = desiredTextSize.height + paddingV;
286
- this.width = desiredTextSize.width + paddingH; // Width should remain a priority, so it is set last.
287
-
288
- const { lines: realTextLines, size: realTextSize } = calculateTextContentParameters(
289
- textChunks,
290
- Math.round(this.width) - paddingH,
291
- );
292
-
293
- this.height = realTextSize.height + paddingV;
294
- this.width = realTextSize.width + paddingH;
295
-
296
- const safeWidth = Math.max(Math.round(this.width), 2);
297
- const safeHeight = Math.max(Math.round(this.height), 2);
298
-
299
- const resolutionDirty = this.lastWidth !== safeWidth || this.lastHeight !== safeHeight;
300
-
301
- if (resolutionDirty) {
302
- this.canvas.width = safeWidth;
303
- this.canvas.height = safeHeight;
304
- }
305
-
306
- renderTextLines(
307
- this.paddingInternal.top,
308
- this.paddingInternal.left,
309
- realTextLines,
310
- this.context,
311
- );
312
-
313
- this.updateProperties(resolutionDirty);
314
-
315
- this.resizeModeDirty = false;
316
- this.maxLineWidthDirty = false;
317
- this.paddingInternal.setDirtyFalse();
318
- this.setDimensionsDirtyFalse();
319
- this.setContentDirtyFalse();
320
- }
321
-
322
- private updateProperties(resolutionDirty: boolean): void {
323
- let properties: Record<string, UIProperty> | undefined;
324
-
325
- if (this.colorInternal.dirty) {
326
- properties ??= {};
327
- properties["color"] = this.colorInternal;
328
- this.colorInternal.setDirtyFalse();
329
- }
330
-
331
- if (resolutionDirty) {
332
- this.texture.dispose();
333
- this.texture = createCanvasTexture(this.canvas);
334
- this.texture.needsUpdate = true;
335
-
336
- properties ??= {};
337
- properties["texture"] = this.texture;
338
- }
339
-
340
- if (properties) {
341
- this.sceneWrapper.setProperties(this.planeHandler, properties);
342
- }
343
- }
344
-
345
- private buildTextChunks(): UITextChunk[] {
346
- if (this.textChunksDirty) {
347
- this.textChunks = buildTextChunks(this.context, this.contentInternal, this.commonStyle);
348
- this.textChunksDirty = false;
349
- }
350
-
351
- return this.textChunks;
352
- }
353
-
354
- private checkDimensionsDirty(): boolean {
355
- return (
356
- this.solverWrapper.dirty &&
357
- (this.lastWidth !== Math.round(this.width) || this.lastHeight !== Math.round(this.height))
358
- );
359
- }
360
-
361
- private setDimensionsDirtyFalse(): void {
362
- this.lastWidth = Math.round(this.width);
363
- this.lastHeight = Math.round(this.height);
364
- }
365
-
366
- private checkContentDirty(): boolean {
367
- return this.contentDirty || this.content.some((span): boolean => span.dirty);
368
- }
369
-
370
- private setContentDirtyFalse(): void {
371
- this.contentDirty = false;
372
- for (const span of this.content) {
373
- span.setDirtyFalse();
374
- }
375
- }
376
- }
@@ -1,233 +0,0 @@
1
- import type { FerrsignView1 } from "ferrsign";
2
- import { Ferrsign1 } from "ferrsign";
3
- import type { Camera, Vector2, WebGLRenderer } from "three";
4
- import { MathUtils, Ray, Vector3 } from "three";
5
- import { assertValidNumber } from "../../miscellaneous/asserts";
6
- import type { UIResizePolicy } from "../../miscellaneous/resize-policy/UIResizePolicy";
7
- import { isUIModeInteractive } from "../../miscellaneous/UIMode";
8
- import { UILayer } from "../UILayer/UILayer";
9
- import type {
10
- UIFullscreenLayerInputEventData,
11
- UIFullscreenLayerOptions,
12
- } from "./UIFullscreenLayer.Internal";
13
- import { FULLSCREEN_LAYER_DEFAULT_RESIZE_POLICY } from "./UIFullscreenLayer.Internal";
14
-
15
- /** Layer that automatically handles browser window resizing and input events */
16
- export class UIFullscreenLayer extends UILayer {
17
- private resizePolicyInternal: UIResizePolicy;
18
- private resizePolicyDirty = false;
19
-
20
- private readonly signalPointerPressedInternal =
21
- new Ferrsign1<UIFullscreenLayerInputEventData>();
22
- private readonly signalPointerMovedInternal =
23
- new Ferrsign1<UIFullscreenLayerInputEventData>();
24
- private readonly signalPointerReleasedInternal =
25
- new Ferrsign1<UIFullscreenLayerInputEventData>();
26
-
27
- constructor(options?: Partial<UIFullscreenLayerOptions>) {
28
- const resizePolicy =
29
- options?.resizePolicy ?? FULLSCREEN_LAYER_DEFAULT_RESIZE_POLICY;
30
-
31
- const scale = resizePolicy.calculateScale(
32
- window.innerWidth,
33
- window.innerHeight,
34
- );
35
-
36
- super({
37
- width: window.innerWidth * scale,
38
- height: window.innerHeight * scale,
39
- ...options,
40
- });
41
-
42
- this.resizePolicyInternal = resizePolicy;
43
- window.addEventListener("resize", this.onResize);
44
- window.addEventListener("pointerdown", this.onPointerDown);
45
- window.addEventListener("pointermove", this.onPointerMove);
46
- window.addEventListener("pointerup", this.onPointerUp);
47
- }
48
-
49
- /** Current resize policy */
50
- public get resizePolicy(): UIResizePolicy {
51
- return this.resizePolicyInternal;
52
- }
53
-
54
- /** Signal fired when pointer is pressed */
55
- public get signalPointerPressed(): FerrsignView1<UIFullscreenLayerInputEventData> {
56
- return this.signalPointerPressedInternal;
57
- }
58
-
59
- /** Signal fired when pointer is moved */
60
- public get signalPointerMoved(): FerrsignView1<UIFullscreenLayerInputEventData> {
61
- return this.signalPointerMovedInternal;
62
- }
63
-
64
- /** Signal fired when pointer is released */
65
- public get signalPointerReleased(): FerrsignView1<UIFullscreenLayerInputEventData> {
66
- return this.signalPointerReleasedInternal;
67
- }
68
-
69
- /** Updates resize policy */
70
- public set resizePolicy(value: UIResizePolicy) {
71
- if (this.resizePolicyInternal !== value) {
72
- this.resizePolicyInternal = value;
73
- this.resizePolicyDirty = true;
74
- }
75
- }
76
-
77
- /** Removes event listeners and frees resources */
78
- public destroy(): void {
79
- window.removeEventListener("resize", this.onResize);
80
- window.removeEventListener("pointerdown", this.onPointerDown);
81
- window.removeEventListener("pointermove", this.onPointerMove);
82
- window.removeEventListener("pointerup", this.onPointerUp);
83
- }
84
-
85
- /**
86
- * Renders layer and all visible elements
87
- * @param renderer Three.js WebGL renderer
88
- * @param deltaTime Time since last frame in seconds
89
- */
90
- public render(renderer: WebGLRenderer, deltaTime: number): void {
91
- assertValidNumber(deltaTime, "UIFullscreenLayer.render.deltaTime");
92
- if (this.resizePolicy.dirty || this.resizePolicyDirty) {
93
- this.onResize();
94
- }
95
- super.renderInternal(renderer, deltaTime);
96
- }
97
-
98
- /**
99
- * Projects 3D world position to 2D layer coordinates
100
- * @param position World position
101
- * @param camera Three.js camera
102
- * @param result Reusable vector instance
103
- * @returns Layer coordinates
104
- */
105
- public projectWorldPosition(
106
- position: Vector3,
107
- camera: Camera,
108
- result = new Vector3(),
109
- ): Vector3 {
110
- result.copy(position).project(camera);
111
- result.x = MathUtils.mapLinear(result.x, -1, 1, this.x, this.width);
112
- result.y = MathUtils.mapLinear(result.y, -1, 1, this.y, this.height);
113
- return result;
114
- }
115
-
116
- /**
117
- * Projects 2D layer coordinates to 3D world position
118
- * @param position Layer coordinates
119
- * @param camera Three.js camera
120
- * @param z Depth coordinate
121
- * @param result Reusable vector instance
122
- * @returns World position
123
- */
124
- public projectLayerPosition(
125
- position: Vector2,
126
- camera: Camera,
127
- z = -1,
128
- result = new Vector3(),
129
- ): Vector3 {
130
- return result
131
- .set(
132
- MathUtils.mapLinear(position.x, this.x, this.width, -1, 1),
133
- MathUtils.mapLinear(position.y, this.y, this.height, -1, 1),
134
- z,
135
- )
136
- .unproject(camera);
137
- }
138
-
139
- /**
140
- * Builds ray from layer position through camera
141
- * @param position Layer coordinates
142
- * @param camera Three.js camera
143
- * @param result Reusable ray instance
144
- * @returns Ray from near to far plane
145
- */
146
- public buildRay(position: Vector2, camera: Camera, result = new Ray()): Ray {
147
- const near = new Vector3(
148
- MathUtils.mapLinear(position.x, this.x, this.width, -1, 1),
149
- MathUtils.mapLinear(position.y, this.y, this.height, -1, 1),
150
- -1,
151
- ).unproject(camera);
152
-
153
- const far = new Vector3(
154
- MathUtils.mapLinear(position.x, this.x, this.width, -1, 1),
155
- MathUtils.mapLinear(position.y, this.y, this.height, -1, 1),
156
- 1,
157
- ).unproject(camera);
158
-
159
- const direction = far.sub(near).normalize();
160
- return result.set(near, direction);
161
- }
162
-
163
- private readonly onResize = (): void => {
164
- const scale = this.resizePolicy.calculateScale(
165
- window.innerWidth,
166
- window.innerHeight,
167
- );
168
- this.resizePolicy.dirty = false;
169
- this.resizePolicyDirty = false;
170
- this.resizeInternal(window.innerWidth * scale, window.innerHeight * scale);
171
- };
172
-
173
- private readonly onPointerDown = (event: PointerEvent): void => {
174
- this.handleWindowInput(
175
- event,
176
- "onPointerDown",
177
- this.signalPointerPressedInternal,
178
- );
179
- };
180
-
181
- private readonly onPointerMove = (event: PointerEvent): void => {
182
- this.handleWindowInput(
183
- event,
184
- "onPointerMove",
185
- this.signalPointerMovedInternal,
186
- );
187
- };
188
-
189
- private readonly onPointerUp = (event: PointerEvent): void => {
190
- this.handleWindowInput(
191
- event,
192
- "onPointerUp",
193
- this.signalPointerReleasedInternal,
194
- );
195
- };
196
-
197
- private handleWindowInput(
198
- event: PointerEvent,
199
- pointerFunctionName: "onPointerDown" | "onPointerMove" | "onPointerUp",
200
- signal: Ferrsign1<UIFullscreenLayerInputEventData>,
201
- ): void {
202
- const rect =
203
- event.target instanceof HTMLElement
204
- ? event.target.getBoundingClientRect()
205
- : null;
206
-
207
- const x = rect ? event.clientX - rect.left : event.clientX;
208
- const y = rect
209
- ? rect.bottom - event.clientY
210
- : window.innerHeight - event.clientY;
211
-
212
- const scale = this.resizePolicy.calculateScale(
213
- window.innerWidth,
214
- window.innerHeight,
215
- );
216
- const scaledX = x * scale;
217
- const scaledY = y * scale;
218
-
219
- if (isUIModeInteractive(this.mode)) {
220
- signal.emit({
221
- x: scaledX,
222
- y: scaledY,
223
- identifier: event.pointerId,
224
- layer: this,
225
- });
226
- this.inputWrapperInternal[pointerFunctionName](
227
- scaledX,
228
- scaledY,
229
- event.pointerId,
230
- );
231
- }
232
- }
233
- }