laymur 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.editorconfig +14 -0
  3. package/CLAUDE.md +181 -0
  4. package/README.md +84 -208
  5. package/assets/logotype.png +0 -0
  6. package/eslint.config.js +111 -0
  7. package/package.json +20 -36
  8. package/rollup.config.js +52 -0
  9. package/{dist/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts → src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts} +3 -2
  10. package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +60 -0
  11. package/src/core/constraints/UIConstraint.ts +20 -0
  12. package/src/core/constraints/UICustomConstraint.ts +62 -0
  13. package/{dist/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts → src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts} +3 -2
  14. package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +52 -0
  15. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +13 -0
  16. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +139 -0
  17. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +16 -0
  18. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +189 -0
  19. package/{dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts → src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts} +3 -2
  20. package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +68 -0
  21. package/{dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts → src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts} +9 -8
  22. package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +94 -0
  23. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +13 -0
  24. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +135 -0
  25. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +16 -0
  26. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +189 -0
  27. package/{dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts → src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts} +3 -2
  28. package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +68 -0
  29. package/{dist/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts → src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts} +3 -2
  30. package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +52 -0
  31. package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +84 -0
  32. package/src/core/constraints/builders/UIConstraint2DBuilder.ts +168 -0
  33. package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +15 -0
  34. package/src/core/constraints/builders/UICoverConstraintBuilder.ts +84 -0
  35. package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +15 -0
  36. package/src/core/constraints/builders/UIFitConstraintBuilder.ts +84 -0
  37. package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +13 -0
  38. package/src/core/elements/UIAnchor/UIAnchor.ts +70 -0
  39. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +30 -0
  40. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +355 -0
  41. package/src/core/elements/UIDummy/UIDummy.Internal.ts +33 -0
  42. package/src/core/elements/UIDummy/UIDummy.ts +244 -0
  43. package/{dist/elements/UIElement/UIElement.Internal.d.ts → src/core/elements/UIElement/UIElement.Internal.ts} +7 -5
  44. package/src/core/elements/UIElement/UIElement.ts +127 -0
  45. package/{dist/elements/UIGraphics/UIGraphics.Internal.d.ts → src/core/elements/UIGraphics/UIGraphics.Internal.ts} +7 -5
  46. package/src/core/elements/UIGraphics/UIGraphics.ts +168 -0
  47. package/{dist/elements/UIImage/UIImage.Internal.d.ts → src/core/elements/UIImage/UIImage.Internal.ts} +3 -2
  48. package/src/core/elements/UIImage/UIImage.ts +138 -0
  49. package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +26 -0
  50. package/src/core/elements/UINineSlice/UINineSlice.ts +296 -0
  51. package/src/core/elements/UIProgress/UIProgress.Internal.ts +24 -0
  52. package/src/core/elements/UIProgress/UIProgress.ts +259 -0
  53. package/src/core/elements/UIScene/UIScene.Internal.ts +46 -0
  54. package/src/core/elements/UIScene/UIScene.ts +259 -0
  55. package/{dist/elements/UIText/UIText.Interfaces.d.ts → src/core/elements/UIText/UIText.Interfaces.ts} +21 -16
  56. package/src/core/elements/UIText/UIText.Internal.ts +29 -0
  57. package/src/core/elements/UIText/UIText.Measuring.ts +183 -0
  58. package/src/core/elements/UIText/UIText.Rendering.ts +83 -0
  59. package/src/core/elements/UIText/UIText.ts +376 -0
  60. package/{dist/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts → src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts} +14 -11
  61. package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +233 -0
  62. package/{dist/layers/UILayer/UILayer.Internal.d.ts → src/core/layers/UILayer/UILayer.Internal.ts} +15 -11
  63. package/src/core/layers/UILayer/UILayer.ts +156 -0
  64. package/src/core/miscellaneous/UIExpression.ts +142 -0
  65. package/src/core/miscellaneous/UIMode.ts +29 -0
  66. package/src/core/miscellaneous/UIOrientation.ts +18 -0
  67. package/src/core/miscellaneous/UIPriority.ts +63 -0
  68. package/src/core/miscellaneous/UIRelation.ts +39 -0
  69. package/src/core/miscellaneous/UITransparencyMode.ts +9 -0
  70. package/src/core/miscellaneous/area/UIArea.ts +5 -0
  71. package/src/core/miscellaneous/area/UIAreaCircle.ts +32 -0
  72. package/src/core/miscellaneous/area/UIAreaPolygon.ts +50 -0
  73. package/src/core/miscellaneous/area/UIAreaRectangle.ts +38 -0
  74. package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +78 -0
  75. package/src/core/miscellaneous/asserts.ts +187 -0
  76. package/src/core/miscellaneous/canvas.ts +73 -0
  77. package/src/core/miscellaneous/color/UIColor.Internal.ts +89 -0
  78. package/src/core/miscellaneous/color/UIColor.ts +844 -0
  79. package/src/core/miscellaneous/computeTransform.ts +127 -0
  80. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +235 -0
  81. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +524 -0
  82. package/{dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts → src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts} +10 -8
  83. package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +448 -0
  84. package/src/core/miscellaneous/generic-plane/shared.ts +323 -0
  85. package/src/core/miscellaneous/insets/UIInsets.Internal.ts +9 -0
  86. package/src/core/miscellaneous/insets/UIInsets.ts +248 -0
  87. package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +24 -0
  88. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +58 -0
  89. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +52 -0
  90. package/src/core/miscellaneous/math.ts +16 -0
  91. package/src/core/miscellaneous/micro/UIMicro.Internal.ts +33 -0
  92. package/src/core/miscellaneous/micro/UIMicro.ts +222 -0
  93. package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +8 -0
  94. package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +57 -0
  95. package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +65 -0
  96. package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +65 -0
  97. package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +57 -0
  98. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +65 -0
  99. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +65 -0
  100. package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +11 -0
  101. package/src/core/miscellaneous/shared.ts +73 -0
  102. package/{dist/miscellaneous/text-span/UITextSpan.Internal.d.ts → src/core/miscellaneous/text-span/UITextSpan.Internal.ts} +5 -4
  103. package/src/core/miscellaneous/text-span/UITextSpan.ts +43 -0
  104. package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +52 -0
  105. package/src/core/miscellaneous/text-style/UITextStyle.ts +479 -0
  106. package/src/core/miscellaneous/texture/UITextureView.Internal.ts +55 -0
  107. package/src/core/miscellaneous/texture/UITextureView.ts +308 -0
  108. package/src/core/miscellaneous/webglCapabilities.ts +129 -0
  109. package/src/core/shaders/UIImage.glsl +10 -0
  110. package/src/core/shaders/UINineSlice.glsl +53 -0
  111. package/src/core/shaders/UIProgress.glsl +15 -0
  112. package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +13 -0
  113. package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +12 -0
  114. package/src/core/shaders/glsl.d.ts +27 -0
  115. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +23 -0
  116. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +124 -0
  117. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +22 -0
  118. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +101 -0
  119. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +58 -0
  120. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +605 -0
  121. package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +70 -0
  122. package/src/particles/behaviorModules/UIBehaviorModule.ts +20 -0
  123. package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +173 -0
  124. package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +104 -0
  125. package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +75 -0
  126. package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +115 -0
  127. package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +77 -0
  128. package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +118 -0
  129. package/src/particles/elements/UIEmitter.Internal.ts +22 -0
  130. package/src/particles/elements/UIEmitter.ts +313 -0
  131. package/src/particles/index.ts +18 -0
  132. package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +263 -0
  133. package/src/particles/instancedParticle/UIInstancedParticle.ts +138 -0
  134. package/src/particles/miscellaneous/miscellaneous.ts +115 -0
  135. package/src/particles/renderingModules/UIRenderingColorOverLife.ts +39 -0
  136. package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +49 -0
  137. package/src/particles/renderingModules/UIRenderingModule.ts +17 -0
  138. package/src/particles/renderingModules/UIRenderingTexture.ts +30 -0
  139. package/src/particles/shaders/UIRenderingColorOverLife.glsl +4 -0
  140. package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +6 -0
  141. package/src/particles/shaders/UIRenderingTexture.glsl +4 -0
  142. package/src/particles/spawnModules/UISpawnModule.ts +22 -0
  143. package/src/particles/spawnModules/UISpawnOffset.ts +62 -0
  144. package/src/particles/spawnModules/UISpawnRandomLifetime.ts +68 -0
  145. package/src/particles/spawnModules/UISpawnRandomRotation.ts +60 -0
  146. package/src/particles/spawnModules/UISpawnRandomScale.ts +81 -0
  147. package/src/particles/spawnModules/UISpawnRandomTorque.ts +62 -0
  148. package/src/particles/spawnModules/UISpawnRandomVelocity.ts +92 -0
  149. package/src/particles/spawnModules/UISpawnRectangle.ts +81 -0
  150. package/tsconfig.json +29 -0
  151. package/dist/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +0 -22
  152. package/dist/constraints/UIConstraint.d.ts +0 -12
  153. package/dist/constraints/UICustomConstraint.d.ts +0 -28
  154. package/dist/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +0 -20
  155. package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -11
  156. package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -36
  157. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -14
  158. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -44
  159. package/dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -22
  160. package/dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -43
  161. package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -11
  162. package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -32
  163. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -14
  164. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -44
  165. package/dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -22
  166. package/dist/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +0 -20
  167. package/dist/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +0 -64
  168. package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +0 -46
  169. package/dist/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +0 -13
  170. package/dist/constraints/builders/UICoverConstraintBuilder.d.ts +0 -29
  171. package/dist/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +0 -13
  172. package/dist/constraints/builders/UIFitConstraintBuilder.d.ts +0 -29
  173. package/dist/elements/UIAnchor/UIAnchor.Internal.d.ts +0 -9
  174. package/dist/elements/UIAnchor/UIAnchor.d.ts +0 -32
  175. package/dist/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -27
  176. package/dist/elements/UIAnimatedImage/UIAnimatedImage.d.ts +0 -77
  177. package/dist/elements/UIDummy/UIDummy.Internal.d.ts +0 -30
  178. package/dist/elements/UIDummy/UIDummy.d.ts +0 -82
  179. package/dist/elements/UIElement/UIElement.d.ts +0 -38
  180. package/dist/elements/UIGraphics/UIGraphics.d.ts +0 -51
  181. package/dist/elements/UIImage/UIImage.d.ts +0 -32
  182. package/dist/elements/UINineSlice/UINineSlice.Internal.d.ts +0 -23
  183. package/dist/elements/UINineSlice/UINineSlice.d.ts +0 -60
  184. package/dist/elements/UIProgress/UIProgress.Internal.d.ts +0 -14
  185. package/dist/elements/UIProgress/UIProgress.d.ts +0 -45
  186. package/dist/elements/UIScene/UIScene.Internal.d.ts +0 -43
  187. package/dist/elements/UIScene/UIScene.d.ts +0 -59
  188. package/dist/elements/UIText/UIText.Internal.d.ts +0 -26
  189. package/dist/elements/UIText/UIText.Measuring.d.ts +0 -50
  190. package/dist/elements/UIText/UIText.Rendering.d.ts +0 -20
  191. package/dist/elements/UIText/UIText.d.ts +0 -71
  192. package/dist/index.js +0 -9246
  193. package/dist/index.js.map +0 -1
  194. package/dist/index.min.js +0 -2
  195. package/dist/index.min.js.map +0 -1
  196. package/dist/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -63
  197. package/dist/layers/UILayer/UILayer.d.ts +0 -49
  198. package/dist/miscellaneous/UIExpression.d.ts +0 -69
  199. package/dist/miscellaneous/UIMode.d.ts +0 -23
  200. package/dist/miscellaneous/UIOrientation.d.ts +0 -15
  201. package/dist/miscellaneous/UIPriority.d.ts +0 -32
  202. package/dist/miscellaneous/UIRelation.d.ts +0 -23
  203. package/dist/miscellaneous/UITransparencyMode.d.ts +0 -9
  204. package/dist/miscellaneous/area/UIArea.d.ts +0 -3
  205. package/dist/miscellaneous/area/UIAreaCircle.d.ts +0 -15
  206. package/dist/miscellaneous/area/UIAreaPolygon.d.ts +0 -12
  207. package/dist/miscellaneous/area/UIAreaRectangle.d.ts +0 -17
  208. package/dist/miscellaneous/area/UIAreaRoundedRectangle.d.ts +0 -21
  209. package/dist/miscellaneous/asserts.d.ts +0 -43
  210. package/dist/miscellaneous/canvas.d.ts +0 -31
  211. package/dist/miscellaneous/color/UIColor.Internal.d.ts +0 -7
  212. package/dist/miscellaneous/color/UIColor.d.ts +0 -234
  213. package/dist/miscellaneous/computeTransform.d.ts +0 -18
  214. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -19
  215. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -1
  216. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -1
  217. package/dist/miscellaneous/generic-plane/shared.d.ts +0 -38
  218. package/dist/miscellaneous/insets/UIInsets.Internal.d.ts +0 -11
  219. package/dist/miscellaneous/insets/UIInsets.d.ts +0 -48
  220. package/dist/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +0 -9
  221. package/dist/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -21
  222. package/dist/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -16
  223. package/dist/miscellaneous/math.d.ts +0 -5
  224. package/dist/miscellaneous/micro/UIMicro.Internal.d.ts +0 -31
  225. package/dist/miscellaneous/micro/UIMicro.d.ts +0 -59
  226. package/dist/miscellaneous/resize-policy/UIResizePolicy.d.ts +0 -3
  227. package/dist/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +0 -22
  228. package/dist/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +0 -22
  229. package/dist/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -22
  230. package/dist/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +0 -22
  231. package/dist/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -22
  232. package/dist/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -22
  233. package/dist/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +0 -5
  234. package/dist/miscellaneous/shared.d.ts +0 -46
  235. package/dist/miscellaneous/text-span/UITextSpan.d.ts +0 -14
  236. package/dist/miscellaneous/text-style/UITextStyle.Internal.d.ts +0 -48
  237. package/dist/miscellaneous/text-style/UITextStyle.d.ts +0 -85
  238. package/dist/miscellaneous/texture/UITextureView.Internal.d.ts +0 -49
  239. package/dist/miscellaneous/texture/UITextureView.d.ts +0 -67
  240. package/dist/miscellaneous/webglCapabilities.d.ts +0 -2
  241. package/dist/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +0 -17
  242. package/dist/wrappers/UIInputWrapper/UIInputWrapper.d.ts +0 -13
  243. package/dist/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +0 -13
  244. package/dist/wrappers/UISceneWrapper/UISceneWrapper.d.ts +0 -20
  245. package/dist/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +0 -49
  246. package/dist/wrappers/UISolverWrapper/UISolverWrapper.d.ts +0 -215
  247. /package/{dist/index.d.ts → src/core/index.ts} +0 -0
@@ -0,0 +1,124 @@
1
+ import type { UIInputWrapperCatcher, UIInputWrapperView } from "./UIInputWrapper.Internal";
2
+
3
+ export class UIInputWrapper implements UIInputWrapperView {
4
+ /** @internal */
5
+ public dirty = false;
6
+
7
+ private zIndicesDirty = false;
8
+ private readonly catchers: UIInputWrapperCatcher[] = [];
9
+ private lastHandler = 0;
10
+
11
+ public createInputCatcher(
12
+ catchPointerDown: (x: number, y: number, identifier: number) => boolean,
13
+ catchPointerMove: (x: number, y: number, identifier: number) => boolean,
14
+ catchPointerUp: (x: number, y: number, identifier: number) => boolean,
15
+ zIndex: number,
16
+ ): number {
17
+ const handler = this.lastHandler++;
18
+ this.catchers.push({
19
+ handler,
20
+ catchPointerDown,
21
+ catchPointerMove,
22
+ catchPointerUp,
23
+ zIndex,
24
+ active: true,
25
+ });
26
+ this.zIndicesDirty = true;
27
+ this.dirty = true;
28
+ return handler;
29
+ }
30
+
31
+ public destroyInputCatcher(handler: number): void {
32
+ const index = this.catchers.findIndex((item) => item.handler === handler);
33
+ if (index === -1) {
34
+ throw new Error("UIInputWrapper.destroyInputCatcher.handler: handler not found");
35
+ }
36
+ this.catchers.splice(index, 1);
37
+ }
38
+
39
+ public getZIndex(handler: number): number {
40
+ this.ensureSorted();
41
+ const found = this.catchers.find((item) => item.handler === handler);
42
+ if (!found) {
43
+ throw new Error("UIInputWrapper.getZIndex.handler: handler not found");
44
+ }
45
+ return found.zIndex;
46
+ }
47
+
48
+ public setZIndex(handler: number, zIndex: number): void {
49
+ const found = this.catchers.find((item) => item.handler === handler);
50
+ if (!found) {
51
+ throw new Error("UIInputWrapper.setZIndex.handler: handler not found");
52
+ }
53
+ if (found.zIndex !== zIndex) {
54
+ found.zIndex = zIndex;
55
+ this.zIndicesDirty = true;
56
+ this.dirty = true;
57
+ }
58
+ }
59
+
60
+ public getActive(handler: number): boolean {
61
+ const found = this.catchers.find((item) => item.handler === handler);
62
+ if (!found) {
63
+ throw new Error("UIInputWrapper.getActive.handler: handler not found");
64
+ }
65
+ return found.active;
66
+ }
67
+
68
+ public setActive(handler: number, active: boolean): void {
69
+ const found = this.catchers.find((item) => item.handler === handler);
70
+ if (!found) {
71
+ throw new Error("UIInputWrapper.setActive.handler: handler not found");
72
+ }
73
+ if (found.active !== active) {
74
+ found.active = active;
75
+ }
76
+ }
77
+
78
+ /** @internal */
79
+ public onPointerDown(x: number, y: number, identifier: number): void {
80
+ this.ensureSorted();
81
+ for (let index = this.catchers.length - 1; index >= 0; index--) {
82
+ const item = this.catchers[index];
83
+ if (item.active && item.catchPointerDown(x, y, identifier)) {
84
+ break;
85
+ }
86
+ }
87
+ }
88
+
89
+ /** @internal */
90
+ public onPointerMove(x: number, y: number, identifier: number): void {
91
+ this.ensureSorted();
92
+ for (let index = this.catchers.length - 1; index >= 0; index--) {
93
+ const item = this.catchers[index];
94
+ if (item.active && item.catchPointerMove(x, y, identifier)) {
95
+ break;
96
+ }
97
+ }
98
+ }
99
+
100
+ /** @internal */
101
+ public onPointerUp(x: number, y: number, identifier: number): void {
102
+ this.ensureSorted();
103
+ for (let index = this.catchers.length - 1; index >= 0; index--) {
104
+ const item = this.catchers[index];
105
+ if (item.active && item.catchPointerUp(x, y, identifier)) {
106
+ break;
107
+ }
108
+ }
109
+ }
110
+
111
+ private ensureSorted(): void {
112
+ if (this.zIndicesDirty) {
113
+ this.catchers.sort((a, b) => a.zIndex - b.zIndex);
114
+
115
+ const count = this.catchers.length;
116
+ const step = count < 1024 ? 1 : 1024 / count;
117
+ for (let index = 0; index < count; index++) {
118
+ this.catchers[index].zIndex = index * step;
119
+ }
120
+
121
+ this.zIndicesDirty = false;
122
+ }
123
+ }
124
+ }
@@ -0,0 +1,22 @@
1
+ import type { Matrix4, Object3D } from "three";
2
+ import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode";
3
+ import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
4
+
5
+ export interface UISceneWrapperView {
6
+ createPlane(
7
+ source: string,
8
+ properties: Record<string, UIProperty>,
9
+ transform: Matrix4,
10
+ visibility: boolean,
11
+ transparency: UITransparencyMode,
12
+ ): number;
13
+ destroyPlane(handler: number): void;
14
+
15
+ setTransform(handler: number, transform: Matrix4): void;
16
+ setProperties(handler: number, properties: Record<string, UIProperty>): void;
17
+ setVisibility(handler: number, visible: boolean): void;
18
+ setTransparency(handler: number, transparency: UITransparencyMode): void;
19
+
20
+ insertCustomObject(object: Object3D): void;
21
+ removeCustomObject(object: Object3D): void;
22
+ }
@@ -0,0 +1,101 @@
1
+ import type { Matrix4, Object3D, WebGLRenderer } from "three";
2
+ import { Color, OrthographicCamera, Scene } from "three";
3
+ import type { UIProperty } from "../../miscellaneous/generic-plane/shared";
4
+ import { UIPlaneRegistry } from "../../miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry";
5
+ import type { UITransparencyMode } from "../../miscellaneous/UITransparencyMode";
6
+ import type { UISceneWrapperView } from "./UISceneWrapper.Internal";
7
+
8
+ let originalClearColor = new Color();
9
+ let originalClearAlpha = 0;
10
+ let originalAutoClear = false;
11
+ let originalAutoClearColor = false;
12
+ let originalAutoClearDepth = false;
13
+ let originalAutoClearStencil = false;
14
+
15
+ export class UISceneWrapper implements UISceneWrapperView {
16
+ private readonly scene = new Scene();
17
+ private readonly camera: OrthographicCamera;
18
+ private readonly planeRegistry = new UIPlaneRegistry(this.scene);
19
+
20
+ constructor(width: number, height: number) {
21
+ this.camera = new OrthographicCamera(0, width, height, 0, -1024, 1024);
22
+ this.camera.matrixAutoUpdate = false;
23
+ this.camera.matrixWorldAutoUpdate = false;
24
+ }
25
+
26
+ public createPlane(
27
+ source: string,
28
+ properties: Record<string, UIProperty>,
29
+ transform: Matrix4,
30
+ visibility: boolean,
31
+ transparency: UITransparencyMode,
32
+ ): number {
33
+ return this.planeRegistry.createPlane(source, properties, transform, visibility, transparency);
34
+ }
35
+
36
+ public destroyPlane(handler: number): void {
37
+ this.planeRegistry.destroyPlane(handler);
38
+ }
39
+
40
+ public setTransform(handler: number, transform: Matrix4): void {
41
+ this.planeRegistry.setTransform(handler, transform);
42
+ }
43
+
44
+ public setProperties(handler: number, properties: Record<string, UIProperty>): void {
45
+ this.planeRegistry.setProperties(handler, properties);
46
+ }
47
+
48
+ public setVisibility(handler: number, visible: boolean): void {
49
+ this.planeRegistry.setVisibility(handler, visible);
50
+ }
51
+
52
+ public setTransparency(handler: number, transparency: UITransparencyMode): void {
53
+ this.planeRegistry.setTransparency(handler, transparency);
54
+ }
55
+
56
+ public insertCustomObject(object: Object3D): this {
57
+ this.scene.add(object);
58
+ return this;
59
+ }
60
+
61
+ public removeCustomObject(object: Object3D): this {
62
+ this.scene.remove(object);
63
+ return this;
64
+ }
65
+
66
+ public resize(width: number, height: number): this {
67
+ this.camera.right = width;
68
+ this.camera.top = height;
69
+ this.camera.updateProjectionMatrix();
70
+ return this;
71
+ }
72
+
73
+ public render(renderer: WebGLRenderer): this {
74
+ this.planeRegistry.flush();
75
+
76
+ originalClearColor = renderer.getClearColor(originalClearColor);
77
+ originalClearAlpha = renderer.getClearAlpha();
78
+ originalAutoClear = renderer.autoClear;
79
+ originalAutoClearColor = renderer.autoClearColor;
80
+ originalAutoClearDepth = renderer.autoClearDepth;
81
+ originalAutoClearStencil = renderer.autoClearStencil;
82
+
83
+ renderer.autoClear = false;
84
+ renderer.autoClearColor = false;
85
+ renderer.autoClearDepth = false;
86
+ renderer.autoClearStencil = false;
87
+ renderer.setClearColor(0x000000, 1);
88
+
89
+ renderer.clear(false, true, true);
90
+ renderer.render(this.scene, this.camera);
91
+
92
+ renderer.setClearColor(originalClearColor);
93
+ renderer.setClearAlpha(originalClearAlpha);
94
+ renderer.autoClear = originalAutoClear;
95
+ renderer.autoClearColor = originalAutoClearColor;
96
+ renderer.autoClearDepth = originalAutoClearDepth;
97
+ renderer.autoClearStencil = originalAutoClearStencil;
98
+
99
+ return this;
100
+ }
101
+ }
@@ -0,0 +1,58 @@
1
+ import type { Constraint, Variable } from "@lume/kiwi";
2
+ import type { UIExpression } from "../../miscellaneous/UIExpression";
3
+ import type { UIPriority } from "../../miscellaneous/UIPriority";
4
+ import type { UIRelation } from "../../miscellaneous/UIRelation";
5
+
6
+ export interface UISolverWrapperView {
7
+ get dirty(): boolean;
8
+ createVariable(value: number, priority: UIPriority): number;
9
+ removeVariable(index: number): void;
10
+ suggestVariableValue(index: number, value: number): void;
11
+ setVariablePriority(index: number, priority: UIPriority): void;
12
+ readVariableValue(index: number): number;
13
+ createConstraint(
14
+ lhs: UIExpression,
15
+ rhs: UIExpression,
16
+ relation: UIRelation,
17
+ priority: UIPriority,
18
+ enabled: boolean,
19
+ ): number;
20
+ removeConstraint(index: number): void;
21
+ setConstraintLHS(index: number, lhs: UIExpression): void;
22
+ setConstraintRHS(index: number, rhs: UIExpression): void;
23
+ setConstraintRelation(index: number, relation: UIRelation): void;
24
+ setConstraintPriority(index: number, priority: UIPriority): void;
25
+ setConstraintEnabled(index: number, enabled: boolean): void;
26
+ }
27
+
28
+ /**
29
+ * Internal description of a solver variable with its associated properties.
30
+ */
31
+ export interface VariableDescription {
32
+ /** The underlying Kiwi variable instance. */
33
+ variable: Variable;
34
+ /** Priority level for constraint solving. */
35
+ priority: UIPriority;
36
+ /** Current suggested value for the variable. */
37
+ value: number;
38
+ /** Optional constraint for P0 priority variables (required variables). */
39
+ constraint?: Constraint;
40
+ }
41
+
42
+ /**
43
+ * Internal description of a solver constraint with its configuration.
44
+ */
45
+ export interface ConstraintDescription {
46
+ /** The underlying Kiwi constraint instance. */
47
+ constraint: Constraint;
48
+ /** Left-hand side expression of the constraint. */
49
+ lhs: UIExpression;
50
+ /** Right-hand side expression of the constraint. */
51
+ rhs: UIExpression;
52
+ /** Priority level for constraint solving. */
53
+ priority: UIPriority;
54
+ /** Relational operator (equal, less than, greater than). */
55
+ relation: UIRelation;
56
+ /** Whether the constraint is currently active. */
57
+ enabled: boolean;
58
+ }