@onerjs/gui 8.23.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 (354) hide show
  1. package/2D/FrameGraph/guiTask.d.ts +34 -0
  2. package/2D/FrameGraph/guiTask.js +62 -0
  3. package/2D/FrameGraph/guiTask.js.map +1 -0
  4. package/2D/FrameGraph/renderGraphGUIBlock.d.ts +43 -0
  5. package/2D/FrameGraph/renderGraphGUIBlock.js +66 -0
  6. package/2D/FrameGraph/renderGraphGUIBlock.js.map +1 -0
  7. package/2D/adtInstrumentation.d.ts +52 -0
  8. package/2D/adtInstrumentation.js +107 -0
  9. package/2D/adtInstrumentation.js.map +1 -0
  10. package/2D/advancedDynamicTexture.d.ts +548 -0
  11. package/2D/advancedDynamicTexture.js +1522 -0
  12. package/2D/advancedDynamicTexture.js.map +1 -0
  13. package/2D/controls/button.d.ts +109 -0
  14. package/2D/controls/button.js +246 -0
  15. package/2D/controls/button.js.map +1 -0
  16. package/2D/controls/checkbox.d.ts +53 -0
  17. package/2D/controls/checkbox.js +164 -0
  18. package/2D/controls/checkbox.js.map +1 -0
  19. package/2D/controls/colorpicker.d.ts +101 -0
  20. package/2D/controls/colorpicker.js +1396 -0
  21. package/2D/controls/colorpicker.js.map +1 -0
  22. package/2D/controls/container.d.ts +179 -0
  23. package/2D/controls/container.js +616 -0
  24. package/2D/controls/container.js.map +1 -0
  25. package/2D/controls/control.d.ts +943 -0
  26. package/2D/controls/control.js +2460 -0
  27. package/2D/controls/control.js.map +1 -0
  28. package/2D/controls/displayGrid.d.ts +53 -0
  29. package/2D/controls/displayGrid.js +202 -0
  30. package/2D/controls/displayGrid.js.map +1 -0
  31. package/2D/controls/ellipse.d.ts +25 -0
  32. package/2D/controls/ellipse.js +93 -0
  33. package/2D/controls/ellipse.js.map +1 -0
  34. package/2D/controls/focusableButton.d.ts +17 -0
  35. package/2D/controls/focusableButton.js +25 -0
  36. package/2D/controls/focusableButton.js.map +1 -0
  37. package/2D/controls/focusableControl.d.ts +43 -0
  38. package/2D/controls/focusableControl.js +2 -0
  39. package/2D/controls/focusableControl.js.map +1 -0
  40. package/2D/controls/gradient/BaseGradient.d.ts +69 -0
  41. package/2D/controls/gradient/BaseGradient.js +84 -0
  42. package/2D/controls/gradient/BaseGradient.js.map +1 -0
  43. package/2D/controls/gradient/LinearGradient.d.ts +45 -0
  44. package/2D/controls/gradient/LinearGradient.js +73 -0
  45. package/2D/controls/gradient/LinearGradient.js.map +1 -0
  46. package/2D/controls/gradient/RadialGradient.d.ts +53 -0
  47. package/2D/controls/gradient/RadialGradient.js +89 -0
  48. package/2D/controls/gradient/RadialGradient.js.map +1 -0
  49. package/2D/controls/grid.d.ts +151 -0
  50. package/2D/controls/grid.js +528 -0
  51. package/2D/controls/grid.js.map +1 -0
  52. package/2D/controls/image.d.ts +228 -0
  53. package/2D/controls/image.js +915 -0
  54. package/2D/controls/image.js.map +1 -0
  55. package/2D/controls/index.d.ts +34 -0
  56. package/2D/controls/index.js +35 -0
  57. package/2D/controls/index.js.map +1 -0
  58. package/2D/controls/inputPassword.d.ts +9 -0
  59. package/2D/controls/inputPassword.js +22 -0
  60. package/2D/controls/inputPassword.js.map +1 -0
  61. package/2D/controls/inputText.d.ts +197 -0
  62. package/2D/controls/inputText.js +1035 -0
  63. package/2D/controls/inputText.js.map +1 -0
  64. package/2D/controls/inputTextArea.d.ts +142 -0
  65. package/2D/controls/inputTextArea.js +1025 -0
  66. package/2D/controls/inputTextArea.js.map +1 -0
  67. package/2D/controls/line.d.ts +73 -0
  68. package/2D/controls/line.js +227 -0
  69. package/2D/controls/line.js.map +1 -0
  70. package/2D/controls/multiLine.d.ts +75 -0
  71. package/2D/controls/multiLine.js +237 -0
  72. package/2D/controls/multiLine.js.map +1 -0
  73. package/2D/controls/radioButton.d.ts +49 -0
  74. package/2D/controls/radioButton.js +185 -0
  75. package/2D/controls/radioButton.js.map +1 -0
  76. package/2D/controls/rectangle.d.ts +43 -0
  77. package/2D/controls/rectangle.js +204 -0
  78. package/2D/controls/rectangle.js.map +1 -0
  79. package/2D/controls/scrollViewers/scrollViewer.d.ts +178 -0
  80. package/2D/controls/scrollViewers/scrollViewer.js +587 -0
  81. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -0
  82. package/2D/controls/scrollViewers/scrollViewerWindow.d.ts +51 -0
  83. package/2D/controls/scrollViewers/scrollViewerWindow.js +254 -0
  84. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -0
  85. package/2D/controls/selector.d.ts +237 -0
  86. package/2D/controls/selector.js +579 -0
  87. package/2D/controls/selector.js.map +1 -0
  88. package/2D/controls/sliders/baseSlider.d.ts +80 -0
  89. package/2D/controls/sliders/baseSlider.js +299 -0
  90. package/2D/controls/sliders/baseSlider.js.map +1 -0
  91. package/2D/controls/sliders/imageBasedSlider.d.ts +47 -0
  92. package/2D/controls/sliders/imageBasedSlider.js +168 -0
  93. package/2D/controls/sliders/imageBasedSlider.js.map +1 -0
  94. package/2D/controls/sliders/imageScrollBar.d.ts +67 -0
  95. package/2D/controls/sliders/imageScrollBar.js +248 -0
  96. package/2D/controls/sliders/imageScrollBar.js.map +1 -0
  97. package/2D/controls/sliders/scrollBar.d.ts +50 -0
  98. package/2D/controls/sliders/scrollBar.js +175 -0
  99. package/2D/controls/sliders/scrollBar.js.map +1 -0
  100. package/2D/controls/sliders/slider.d.ts +46 -0
  101. package/2D/controls/sliders/slider.js +281 -0
  102. package/2D/controls/sliders/slider.js.map +1 -0
  103. package/2D/controls/stackPanel.d.ts +64 -0
  104. package/2D/controls/stackPanel.js +244 -0
  105. package/2D/controls/stackPanel.js.map +1 -0
  106. package/2D/controls/statics.d.ts +6 -0
  107. package/2D/controls/statics.js +50 -0
  108. package/2D/controls/statics.js.map +1 -0
  109. package/2D/controls/textBlock.d.ts +219 -0
  110. package/2D/controls/textBlock.js +670 -0
  111. package/2D/controls/textBlock.js.map +1 -0
  112. package/2D/controls/textWrapper.d.ts +13 -0
  113. package/2D/controls/textWrapper.js +88 -0
  114. package/2D/controls/textWrapper.js.map +1 -0
  115. package/2D/controls/toggleButton.d.ts +93 -0
  116. package/2D/controls/toggleButton.js +229 -0
  117. package/2D/controls/toggleButton.js.map +1 -0
  118. package/2D/controls/virtualKeyboard.d.ts +102 -0
  119. package/2D/controls/virtualKeyboard.js +275 -0
  120. package/2D/controls/virtualKeyboard.js.map +1 -0
  121. package/2D/index.d.ts +11 -0
  122. package/2D/index.js +13 -0
  123. package/2D/index.js.map +1 -0
  124. package/2D/math2D.d.ts +136 -0
  125. package/2D/math2D.js +235 -0
  126. package/2D/math2D.js.map +1 -0
  127. package/2D/measure.d.ts +77 -0
  128. package/2D/measure.js +138 -0
  129. package/2D/measure.js.map +1 -0
  130. package/2D/multiLinePoint.d.ts +47 -0
  131. package/2D/multiLinePoint.js +110 -0
  132. package/2D/multiLinePoint.js.map +1 -0
  133. package/2D/style.d.ts +46 -0
  134. package/2D/style.js +80 -0
  135. package/2D/style.js.map +1 -0
  136. package/2D/valueAndUnit.d.ts +89 -0
  137. package/2D/valueAndUnit.js +194 -0
  138. package/2D/valueAndUnit.js.map +1 -0
  139. package/2D/xmlLoader.d.ts +60 -0
  140. package/2D/xmlLoader.js +348 -0
  141. package/2D/xmlLoader.js.map +1 -0
  142. package/3D/behaviors/defaultBehavior.d.ts +73 -0
  143. package/3D/behaviors/defaultBehavior.js +103 -0
  144. package/3D/behaviors/defaultBehavior.js.map +1 -0
  145. package/3D/controls/MRTK3/touchHolographicButton.d.ts +220 -0
  146. package/3D/controls/MRTK3/touchHolographicButton.js +868 -0
  147. package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -0
  148. package/3D/controls/abstractButton3D.d.ts +15 -0
  149. package/3D/controls/abstractButton3D.js +22 -0
  150. package/3D/controls/abstractButton3D.js.map +1 -0
  151. package/3D/controls/button3D.d.ts +51 -0
  152. package/3D/controls/button3D.js +98 -0
  153. package/3D/controls/button3D.js.map +1 -0
  154. package/3D/controls/container3D.d.ts +72 -0
  155. package/3D/controls/container3D.js +126 -0
  156. package/3D/controls/container3D.js.map +1 -0
  157. package/3D/controls/contentDisplay3D.d.ts +42 -0
  158. package/3D/controls/contentDisplay3D.js +81 -0
  159. package/3D/controls/contentDisplay3D.js.map +1 -0
  160. package/3D/controls/control3D.d.ts +183 -0
  161. package/3D/controls/control3D.js +401 -0
  162. package/3D/controls/control3D.js.map +1 -0
  163. package/3D/controls/cylinderPanel.d.ts +17 -0
  164. package/3D/controls/cylinderPanel.js +57 -0
  165. package/3D/controls/cylinderPanel.js.map +1 -0
  166. package/3D/controls/handMenu.d.ts +28 -0
  167. package/3D/controls/handMenu.js +39 -0
  168. package/3D/controls/handMenu.js.map +1 -0
  169. package/3D/controls/holographicBackplate.d.ts +49 -0
  170. package/3D/controls/holographicBackplate.js +104 -0
  171. package/3D/controls/holographicBackplate.js.map +1 -0
  172. package/3D/controls/holographicButton.d.ts +84 -0
  173. package/3D/controls/holographicButton.js +300 -0
  174. package/3D/controls/holographicButton.js.map +1 -0
  175. package/3D/controls/holographicSlate.d.ts +134 -0
  176. package/3D/controls/holographicSlate.js +413 -0
  177. package/3D/controls/holographicSlate.js.map +1 -0
  178. package/3D/controls/index.d.ts +22 -0
  179. package/3D/controls/index.js +24 -0
  180. package/3D/controls/index.js.map +1 -0
  181. package/3D/controls/meshButton3D.d.ts +21 -0
  182. package/3D/controls/meshButton3D.js +58 -0
  183. package/3D/controls/meshButton3D.js.map +1 -0
  184. package/3D/controls/nearMenu.d.ts +44 -0
  185. package/3D/controls/nearMenu.js +103 -0
  186. package/3D/controls/nearMenu.js.map +1 -0
  187. package/3D/controls/planePanel.d.ts +9 -0
  188. package/3D/controls/planePanel.js +30 -0
  189. package/3D/controls/planePanel.js.map +1 -0
  190. package/3D/controls/scatterPanel.d.ts +18 -0
  191. package/3D/controls/scatterPanel.js +98 -0
  192. package/3D/controls/scatterPanel.js.map +1 -0
  193. package/3D/controls/slider3D.d.ts +95 -0
  194. package/3D/controls/slider3D.js +256 -0
  195. package/3D/controls/slider3D.js.map +1 -0
  196. package/3D/controls/spherePanel.d.ts +17 -0
  197. package/3D/controls/spherePanel.js +58 -0
  198. package/3D/controls/spherePanel.js.map +1 -0
  199. package/3D/controls/stackPanel3D.d.ts +22 -0
  200. package/3D/controls/stackPanel3D.js +95 -0
  201. package/3D/controls/stackPanel3D.js.map +1 -0
  202. package/3D/controls/touchButton3D.d.ts +77 -0
  203. package/3D/controls/touchButton3D.js +205 -0
  204. package/3D/controls/touchButton3D.js.map +1 -0
  205. package/3D/controls/touchHolographicButton.d.ts +110 -0
  206. package/3D/controls/touchHolographicButton.js +400 -0
  207. package/3D/controls/touchHolographicButton.js.map +1 -0
  208. package/3D/controls/touchHolographicMenu.d.ts +61 -0
  209. package/3D/controls/touchHolographicMenu.js +139 -0
  210. package/3D/controls/touchHolographicMenu.js.map +1 -0
  211. package/3D/controls/touchMeshButton3D.d.ts +21 -0
  212. package/3D/controls/touchMeshButton3D.js +58 -0
  213. package/3D/controls/touchMeshButton3D.js.map +1 -0
  214. package/3D/controls/volumeBasedPanel.d.ts +53 -0
  215. package/3D/controls/volumeBasedPanel.js +158 -0
  216. package/3D/controls/volumeBasedPanel.js.map +1 -0
  217. package/3D/gizmos/gizmoHandle.d.ts +108 -0
  218. package/3D/gizmos/gizmoHandle.js +175 -0
  219. package/3D/gizmos/gizmoHandle.js.map +1 -0
  220. package/3D/gizmos/index.d.ts +2 -0
  221. package/3D/gizmos/index.js +3 -0
  222. package/3D/gizmos/index.js.map +1 -0
  223. package/3D/gizmos/slateGizmo.d.ts +57 -0
  224. package/3D/gizmos/slateGizmo.js +353 -0
  225. package/3D/gizmos/slateGizmo.js.map +1 -0
  226. package/3D/gui3DManager.d.ts +94 -0
  227. package/3D/gui3DManager.js +233 -0
  228. package/3D/gui3DManager.js.map +1 -0
  229. package/3D/index.d.ts +5 -0
  230. package/3D/index.js +7 -0
  231. package/3D/index.js.map +1 -0
  232. package/3D/materials/fluent/fluentMaterial.d.ts +91 -0
  233. package/3D/materials/fluent/fluentMaterial.js +286 -0
  234. package/3D/materials/fluent/fluentMaterial.js.map +1 -0
  235. package/3D/materials/fluent/index.d.ts +1 -0
  236. package/3D/materials/fluent/index.js +2 -0
  237. package/3D/materials/fluent/index.js.map +1 -0
  238. package/3D/materials/fluent/shaders/fluent.fragment.d.ts +5 -0
  239. package/3D/materials/fluent/shaders/fluent.fragment.js +41 -0
  240. package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -0
  241. package/3D/materials/fluent/shaders/fluent.vertex.d.ts +5 -0
  242. package/3D/materials/fluent/shaders/fluent.vertex.js +40 -0
  243. package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -0
  244. package/3D/materials/fluentBackplate/fluentBackplateMaterial.d.ts +155 -0
  245. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +466 -0
  246. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -0
  247. package/3D/materials/fluentBackplate/index.d.ts +1 -0
  248. package/3D/materials/fluentBackplate/index.js +2 -0
  249. package/3D/materials/fluentBackplate/index.js.map +1 -0
  250. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.d.ts +5 -0
  251. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +60 -0
  252. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -0
  253. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.d.ts +5 -0
  254. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +127 -0
  255. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -0
  256. package/3D/materials/fluentButton/fluentButtonMaterial.d.ts +190 -0
  257. package/3D/materials/fluentButton/fluentButtonMaterial.js +536 -0
  258. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -0
  259. package/3D/materials/fluentButton/index.d.ts +1 -0
  260. package/3D/materials/fluentButton/index.js +2 -0
  261. package/3D/materials/fluentButton/index.js.map +1 -0
  262. package/3D/materials/fluentButton/shaders/fluentButton.fragment.d.ts +5 -0
  263. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +57 -0
  264. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -0
  265. package/3D/materials/fluentButton/shaders/fluentButton.vertex.d.ts +5 -0
  266. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +162 -0
  267. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -0
  268. package/3D/materials/fluentMaterial.d.ts +4 -0
  269. package/3D/materials/fluentMaterial.js +5 -0
  270. package/3D/materials/fluentMaterial.js.map +1 -0
  271. package/3D/materials/handle/handleMaterial.d.ts +68 -0
  272. package/3D/materials/handle/handleMaterial.js +114 -0
  273. package/3D/materials/handle/handleMaterial.js.map +1 -0
  274. package/3D/materials/handle/index.d.ts +1 -0
  275. package/3D/materials/handle/index.js +2 -0
  276. package/3D/materials/handle/index.js.map +1 -0
  277. package/3D/materials/handle/shaders/handle.fragment.d.ts +5 -0
  278. package/3D/materials/handle/shaders/handle.fragment.js +11 -0
  279. package/3D/materials/handle/shaders/handle.fragment.js.map +1 -0
  280. package/3D/materials/handle/shaders/handle.vertex.d.ts +5 -0
  281. package/3D/materials/handle/shaders/handle.vertex.js +11 -0
  282. package/3D/materials/handle/shaders/handle.vertex.js.map +1 -0
  283. package/3D/materials/index.d.ts +5 -0
  284. package/3D/materials/index.js +7 -0
  285. package/3D/materials/index.js.map +1 -0
  286. package/3D/materials/mrdl/index.d.ts +3 -0
  287. package/3D/materials/mrdl/index.js +4 -0
  288. package/3D/materials/mrdl/index.js.map +1 -0
  289. package/3D/materials/mrdl/mrdlBackglowMaterial.d.ts +87 -0
  290. package/3D/materials/mrdl/mrdlBackglowMaterial.js +302 -0
  291. package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -0
  292. package/3D/materials/mrdl/mrdlBackplateMaterial.d.ts +148 -0
  293. package/3D/materials/mrdl/mrdlBackplateMaterial.js +433 -0
  294. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -0
  295. package/3D/materials/mrdl/mrdlFrontplateMaterial.d.ts +186 -0
  296. package/3D/materials/mrdl/mrdlFrontplateMaterial.js +532 -0
  297. package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -0
  298. package/3D/materials/mrdl/mrdlInnerquadMaterial.d.ts +56 -0
  299. package/3D/materials/mrdl/mrdlInnerquadMaterial.js +230 -0
  300. package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -0
  301. package/3D/materials/mrdl/mrdlSliderBarMaterial.d.ts +337 -0
  302. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +855 -0
  303. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -0
  304. package/3D/materials/mrdl/mrdlSliderThumbMaterial.d.ts +337 -0
  305. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +855 -0
  306. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -0
  307. package/3D/materials/mrdl/shaders/mrdlBackglow.fragment.d.ts +5 -0
  308. package/3D/materials/mrdl/shaders/mrdlBackglow.fragment.js +25 -0
  309. package/3D/materials/mrdl/shaders/mrdlBackglow.fragment.js.map +1 -0
  310. package/3D/materials/mrdl/shaders/mrdlBackglow.vertex.d.ts +5 -0
  311. package/3D/materials/mrdl/shaders/mrdlBackglow.vertex.js +12 -0
  312. package/3D/materials/mrdl/shaders/mrdlBackglow.vertex.js.map +1 -0
  313. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.d.ts +5 -0
  314. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +88 -0
  315. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -0
  316. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.d.ts +5 -0
  317. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +96 -0
  318. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -0
  319. package/3D/materials/mrdl/shaders/mrdlFrontplate.fragment.d.ts +5 -0
  320. package/3D/materials/mrdl/shaders/mrdlFrontplate.fragment.js +48 -0
  321. package/3D/materials/mrdl/shaders/mrdlFrontplate.fragment.js.map +1 -0
  322. package/3D/materials/mrdl/shaders/mrdlFrontplate.vertex.d.ts +5 -0
  323. package/3D/materials/mrdl/shaders/mrdlFrontplate.vertex.js +158 -0
  324. package/3D/materials/mrdl/shaders/mrdlFrontplate.vertex.js.map +1 -0
  325. package/3D/materials/mrdl/shaders/mrdlInnerquad.fragment.d.ts +5 -0
  326. package/3D/materials/mrdl/shaders/mrdlInnerquad.fragment.js +27 -0
  327. package/3D/materials/mrdl/shaders/mrdlInnerquad.fragment.js.map +1 -0
  328. package/3D/materials/mrdl/shaders/mrdlInnerquad.vertex.d.ts +5 -0
  329. package/3D/materials/mrdl/shaders/mrdlInnerquad.vertex.js +13 -0
  330. package/3D/materials/mrdl/shaders/mrdlInnerquad.vertex.js.map +1 -0
  331. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.d.ts +5 -0
  332. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +236 -0
  333. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -0
  334. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.d.ts +5 -0
  335. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +137 -0
  336. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -0
  337. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.d.ts +5 -0
  338. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +236 -0
  339. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -0
  340. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.d.ts +5 -0
  341. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +137 -0
  342. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -0
  343. package/3D/vector3WithInfo.d.ts +16 -0
  344. package/3D/vector3WithInfo.js +18 -0
  345. package/3D/vector3WithInfo.js.map +1 -0
  346. package/index.d.ts +2 -0
  347. package/index.js +4 -0
  348. package/index.js.map +1 -0
  349. package/legacy/legacy.d.ts +1 -0
  350. package/legacy/legacy.js +17 -0
  351. package/legacy/legacy.js.map +1 -0
  352. package/license.md +71 -0
  353. package/package.json +47 -0
  354. package/readme.md +31 -0
package/2D/math2D.js ADDED
@@ -0,0 +1,235 @@
1
+ import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
2
+ import { Epsilon } from "@babylonjs/core/Maths/math.constants.js";
3
+ /**
4
+ * Class used to transport Vector2 information for pointer events
5
+ */
6
+ export class Vector2WithInfo extends Vector2 {
7
+ /**
8
+ * Creates a new Vector2WithInfo
9
+ * @param source defines the vector2 data to transport
10
+ * @param buttonIndex defines the current mouse button index
11
+ */
12
+ constructor(source,
13
+ /** defines the current mouse button index */
14
+ buttonIndex = 0) {
15
+ super(source.x, source.y);
16
+ this.buttonIndex = buttonIndex;
17
+ }
18
+ }
19
+ /** Class used to provide 2D matrix features */
20
+ export class Matrix2D {
21
+ /**
22
+ * Creates a new matrix
23
+ * @param m00 defines value for (0, 0)
24
+ * @param m01 defines value for (0, 1)
25
+ * @param m10 defines value for (1, 0)
26
+ * @param m11 defines value for (1, 1)
27
+ * @param m20 defines value for (2, 0)
28
+ * @param m21 defines value for (2, 1)
29
+ */
30
+ constructor(m00, m01, m10, m11, m20, m21) {
31
+ /** Gets the internal array of 6 floats used to store matrix data */
32
+ this.m = new Float32Array(6);
33
+ this.fromValues(m00, m01, m10, m11, m20, m21);
34
+ }
35
+ /**
36
+ * Fills the matrix from direct values
37
+ * @param m00 defines value for (0, 0)
38
+ * @param m01 defines value for (0, 1)
39
+ * @param m10 defines value for (1, 0)
40
+ * @param m11 defines value for (1, 1)
41
+ * @param m20 defines value for (2, 0)
42
+ * @param m21 defines value for (2, 1)
43
+ * @returns the current modified matrix
44
+ */
45
+ fromValues(m00, m01, m10, m11, m20, m21) {
46
+ this.m[0] = m00;
47
+ this.m[1] = m01;
48
+ this.m[2] = m10;
49
+ this.m[3] = m11;
50
+ this.m[4] = m20;
51
+ this.m[5] = m21;
52
+ return this;
53
+ }
54
+ /**
55
+ * Gets matrix determinant
56
+ * @returns the determinant
57
+ */
58
+ determinant() {
59
+ return this.m[0] * this.m[3] - this.m[1] * this.m[2];
60
+ }
61
+ /**
62
+ * Inverses the matrix and stores it in a target matrix
63
+ * @param result defines the target matrix
64
+ * @returns the current matrix
65
+ */
66
+ invertToRef(result) {
67
+ const l0 = this.m[0];
68
+ const l1 = this.m[1];
69
+ const l2 = this.m[2];
70
+ const l3 = this.m[3];
71
+ const l4 = this.m[4];
72
+ const l5 = this.m[5];
73
+ const det = this.determinant();
74
+ if (det < Epsilon * Epsilon) {
75
+ result.m[0] = 0;
76
+ result.m[1] = 0;
77
+ result.m[2] = 0;
78
+ result.m[3] = 0;
79
+ result.m[4] = 0;
80
+ result.m[5] = 0;
81
+ return this;
82
+ }
83
+ const detDiv = 1 / det;
84
+ const det4 = l2 * l5 - l3 * l4;
85
+ const det5 = l1 * l4 - l0 * l5;
86
+ result.m[0] = l3 * detDiv;
87
+ result.m[1] = -l1 * detDiv;
88
+ result.m[2] = -l2 * detDiv;
89
+ result.m[3] = l0 * detDiv;
90
+ result.m[4] = det4 * detDiv;
91
+ result.m[5] = det5 * detDiv;
92
+ return this;
93
+ }
94
+ /**
95
+ * Multiplies the current matrix with another one
96
+ * @param other defines the second operand
97
+ * @param result defines the target matrix
98
+ * @returns the current matrix
99
+ */
100
+ multiplyToRef(other, result) {
101
+ const l0 = this.m[0];
102
+ const l1 = this.m[1];
103
+ const l2 = this.m[2];
104
+ const l3 = this.m[3];
105
+ const l4 = this.m[4];
106
+ const l5 = this.m[5];
107
+ const r0 = other.m[0];
108
+ const r1 = other.m[1];
109
+ const r2 = other.m[2];
110
+ const r3 = other.m[3];
111
+ const r4 = other.m[4];
112
+ const r5 = other.m[5];
113
+ result.m[0] = l0 * r0 + l1 * r2;
114
+ result.m[1] = l0 * r1 + l1 * r3;
115
+ result.m[2] = l2 * r0 + l3 * r2;
116
+ result.m[3] = l2 * r1 + l3 * r3;
117
+ result.m[4] = l4 * r0 + l5 * r2 + r4;
118
+ result.m[5] = l4 * r1 + l5 * r3 + r5;
119
+ return this;
120
+ }
121
+ /**
122
+ * Applies the current matrix to a set of 2 floats and stores the result in a vector2
123
+ * @param x defines the x coordinate to transform
124
+ * @param y defines the x coordinate to transform
125
+ * @param result defines the target vector2
126
+ * @returns the current matrix
127
+ */
128
+ transformCoordinates(x, y, result) {
129
+ result.x = x * this.m[0] + y * this.m[2] + this.m[4];
130
+ result.y = x * this.m[1] + y * this.m[3] + this.m[5];
131
+ return this;
132
+ }
133
+ // Statics
134
+ /**
135
+ * Creates an identity matrix
136
+ * @returns a new matrix
137
+ */
138
+ static Identity() {
139
+ return new Matrix2D(1, 0, 0, 1, 0, 0);
140
+ }
141
+ /**
142
+ * Creates an identity matrix and stores it in a target matrix
143
+ * @param result defines the target matrix
144
+ */
145
+ static IdentityToRef(result) {
146
+ result.m[0] = 1;
147
+ result.m[1] = 0;
148
+ result.m[2] = 0;
149
+ result.m[3] = 1;
150
+ result.m[4] = 0;
151
+ result.m[5] = 0;
152
+ }
153
+ /**
154
+ * Creates a translation matrix and stores it in a target matrix
155
+ * @param x defines the x coordinate of the translation
156
+ * @param y defines the y coordinate of the translation
157
+ * @param result defines the target matrix
158
+ */
159
+ static TranslationToRef(x, y, result) {
160
+ result.fromValues(1, 0, 0, 1, x, y);
161
+ }
162
+ /**
163
+ * Creates a scaling matrix and stores it in a target matrix
164
+ * @param x defines the x coordinate of the scaling
165
+ * @param y defines the y coordinate of the scaling
166
+ * @param result defines the target matrix
167
+ */
168
+ static ScalingToRef(x, y, result) {
169
+ result.fromValues(x, 0, 0, y, 0, 0);
170
+ }
171
+ /**
172
+ * Creates a rotation matrix and stores it in a target matrix
173
+ * @param angle defines the rotation angle
174
+ * @param result defines the target matrix
175
+ */
176
+ static RotationToRef(angle, result) {
177
+ const s = Math.sin(angle);
178
+ const c = Math.cos(angle);
179
+ result.fromValues(c, s, -s, c, 0, 0);
180
+ }
181
+ /**
182
+ * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
183
+ * @param tx defines the x coordinate of the translation
184
+ * @param ty defines the y coordinate of the translation
185
+ * @param angle defines the rotation angle
186
+ * @param scaleX defines the x coordinate of the scaling
187
+ * @param scaleY defines the y coordinate of the scaling
188
+ * @param parentMatrix defines the parent matrix to multiply by (can be null)
189
+ * @param result defines the target matrix
190
+ */
191
+ static ComposeToRef(tx, ty, angle, scaleX, scaleY, parentMatrix, result) {
192
+ Matrix2D.TranslationToRef(tx, ty, Matrix2D._TempPreTranslationMatrix);
193
+ Matrix2D.ScalingToRef(scaleX, scaleY, Matrix2D._TempScalingMatrix);
194
+ Matrix2D.RotationToRef(angle, Matrix2D._TempRotationMatrix);
195
+ Matrix2D.TranslationToRef(-tx, -ty, Matrix2D._TempPostTranslationMatrix);
196
+ Matrix2D._TempPreTranslationMatrix.multiplyToRef(Matrix2D._TempScalingMatrix, Matrix2D._TempCompose0);
197
+ Matrix2D._TempCompose0.multiplyToRef(Matrix2D._TempRotationMatrix, Matrix2D._TempCompose1);
198
+ if (parentMatrix) {
199
+ Matrix2D._TempCompose1.multiplyToRef(Matrix2D._TempPostTranslationMatrix, Matrix2D._TempCompose2);
200
+ Matrix2D._TempCompose2.multiplyToRef(parentMatrix, result);
201
+ }
202
+ else {
203
+ Matrix2D._TempCompose1.multiplyToRef(Matrix2D._TempPostTranslationMatrix, result);
204
+ }
205
+ }
206
+ }
207
+ Matrix2D._TempPreTranslationMatrix = Matrix2D.Identity();
208
+ Matrix2D._TempPostTranslationMatrix = Matrix2D.Identity();
209
+ Matrix2D._TempRotationMatrix = Matrix2D.Identity();
210
+ Matrix2D._TempScalingMatrix = Matrix2D.Identity();
211
+ Matrix2D._TempCompose0 = Matrix2D.Identity();
212
+ Matrix2D._TempCompose1 = Matrix2D.Identity();
213
+ Matrix2D._TempCompose2 = Matrix2D.Identity();
214
+ /**
215
+ * Useful math functions
216
+ */
217
+ export class MathTools {
218
+ /**
219
+ * Rounds a number to the nearest multiple of a given precision
220
+ * @param value the value to be rounded
221
+ * @param precision the multiple to which the value will be rounded. Default is 100 (2 decimal digits)
222
+ * @returns
223
+ */
224
+ static Round(value, precision = MathTools.DefaultRoundingPrecision) {
225
+ return Math.round(value * precision) / precision;
226
+ }
227
+ }
228
+ /**
229
+ * Default rounding precision for GUI elements. It should be
230
+ * set to a power of ten, where the exponent means the number
231
+ * of decimal digits to round to, i.e, 100 means 2 decimal digits,
232
+ * 1000 means 3 decimal digits, etc. Default is 100 (2 decimal digits).
233
+ */
234
+ MathTools.DefaultRoundingPrecision = 100;
235
+ //# sourceMappingURL=math2D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math2D.js","sourceRoot":"","sources":["../../../../dev/gui/src/2D/math2D.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,OAAO,EAAE,gDAAkC;AAEpD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAAO;IACxC;;;;OAIG;IACH,YACI,MAAe;IACf,6CAA6C;IACtC,cAAsB,CAAC;QAE9B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAFnB,gBAAW,GAAX,WAAW,CAAY;IAGlC,CAAC;CACJ;AAED,+CAA+C;AAC/C,MAAM,OAAO,QAAQ;IAIjB;;;;;;;;OAQG;IACH,YAAY,GAAW,EAAE,GAAW,EAAE,GAAW,EAAE,GAAW,EAAE,GAAW,EAAE,GAAW;QAZxF,oEAAoE;QAC7D,MAAC,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;QAY3B,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GA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CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\n\r\n/**\r\n * Class used to transport Vector2 information for pointer events\r\n */\r\nexport class Vector2WithInfo extends Vector2 {\r\n /**\r\n * Creates a new Vector2WithInfo\r\n * @param source defines the vector2 data to transport\r\n * @param buttonIndex defines the current mouse button index\r\n */\r\n public constructor(\r\n source: Vector2,\r\n /** defines the current mouse button index */\r\n public buttonIndex: number = 0\r\n ) {\r\n super(source.x, source.y);\r\n }\r\n}\r\n\r\n/** Class used to provide 2D matrix features */\r\nexport class Matrix2D {\r\n /** Gets the internal array of 6 floats used to store matrix data */\r\n public m = new Float32Array(6);\r\n\r\n /**\r\n * Creates a new matrix\r\n * @param m00 defines value for (0, 0)\r\n * @param m01 defines value for (0, 1)\r\n * @param m10 defines value for (1, 0)\r\n * @param m11 defines value for (1, 1)\r\n * @param m20 defines value for (2, 0)\r\n * @param m21 defines value for (2, 1)\r\n */\r\n constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number) {\r\n this.fromValues(m00, m01, m10, m11, m20, m21);\r\n }\r\n\r\n /**\r\n * Fills the matrix from direct values\r\n * @param m00 defines value for (0, 0)\r\n * @param m01 defines value for (0, 1)\r\n * @param m10 defines value for (1, 0)\r\n * @param m11 defines value for (1, 1)\r\n * @param m20 defines value for (2, 0)\r\n * @param m21 defines value for (2, 1)\r\n * @returns the current modified matrix\r\n */\r\n public fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D {\r\n this.m[0] = m00;\r\n this.m[1] = m01;\r\n this.m[2] = m10;\r\n this.m[3] = m11;\r\n this.m[4] = m20;\r\n this.m[5] = m21;\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets matrix determinant\r\n * @returns the determinant\r\n */\r\n public determinant(): number {\r\n return this.m[0] * this.m[3] - this.m[1] * this.m[2];\r\n }\r\n\r\n /**\r\n * Inverses the matrix and stores it in a target matrix\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n public invertToRef(result: Matrix2D): Matrix2D {\r\n const l0 = this.m[0];\r\n const l1 = this.m[1];\r\n const l2 = this.m[2];\r\n const l3 = this.m[3];\r\n const l4 = this.m[4];\r\n const l5 = this.m[5];\r\n\r\n const det = this.determinant();\r\n if (det < Epsilon * Epsilon) {\r\n result.m[0] = 0;\r\n result.m[1] = 0;\r\n result.m[2] = 0;\r\n result.m[3] = 0;\r\n result.m[4] = 0;\r\n result.m[5] = 0;\r\n return this;\r\n }\r\n\r\n const detDiv = 1 / det;\r\n\r\n const det4 = l2 * l5 - l3 * l4;\r\n const det5 = l1 * l4 - l0 * l5;\r\n\r\n result.m[0] = l3 * detDiv;\r\n result.m[1] = -l1 * detDiv;\r\n result.m[2] = -l2 * detDiv;\r\n result.m[3] = l0 * detDiv;\r\n result.m[4] = det4 * detDiv;\r\n result.m[5] = det5 * detDiv;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies the current matrix with another one\r\n * @param other defines the second operand\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n public multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D {\r\n const l0 = this.m[0];\r\n const l1 = this.m[1];\r\n const l2 = this.m[2];\r\n const l3 = this.m[3];\r\n const l4 = this.m[4];\r\n const l5 = this.m[5];\r\n\r\n const r0 = other.m[0];\r\n const r1 = other.m[1];\r\n const r2 = other.m[2];\r\n const r3 = other.m[3];\r\n const r4 = other.m[4];\r\n const r5 = other.m[5];\r\n\r\n result.m[0] = l0 * r0 + l1 * r2;\r\n result.m[1] = l0 * r1 + l1 * r3;\r\n result.m[2] = l2 * r0 + l3 * r2;\r\n result.m[3] = l2 * r1 + l3 * r3;\r\n result.m[4] = l4 * r0 + l5 * r2 + r4;\r\n result.m[5] = l4 * r1 + l5 * r3 + r5;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Applies the current matrix to a set of 2 floats and stores the result in a vector2\r\n * @param x defines the x coordinate to transform\r\n * @param y defines the x coordinate to transform\r\n * @param result defines the target vector2\r\n * @returns the current matrix\r\n */\r\n public transformCoordinates(x: number, y: number, result: Vector2): Matrix2D {\r\n result.x = x * this.m[0] + y * this.m[2] + this.m[4];\r\n result.y = x * this.m[1] + y * this.m[3] + this.m[5];\r\n\r\n return this;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates an identity matrix\r\n * @returns a new matrix\r\n */\r\n public static Identity(): Matrix2D {\r\n return new Matrix2D(1, 0, 0, 1, 0, 0);\r\n }\r\n\r\n /**\r\n * Creates an identity matrix and stores it in a target matrix\r\n * @param result defines the target matrix\r\n */\r\n public static IdentityToRef(result: Matrix2D): void {\r\n result.m[0] = 1;\r\n result.m[1] = 0;\r\n result.m[2] = 0;\r\n result.m[3] = 1;\r\n result.m[4] = 0;\r\n result.m[5] = 0;\r\n }\r\n\r\n /**\r\n * Creates a translation matrix and stores it in a target matrix\r\n * @param x defines the x coordinate of the translation\r\n * @param y defines the y coordinate of the translation\r\n * @param result defines the target matrix\r\n */\r\n public static TranslationToRef(x: number, y: number, result: Matrix2D): void {\r\n result.fromValues(1, 0, 0, 1, x, y);\r\n }\r\n\r\n /**\r\n * Creates a scaling matrix and stores it in a target matrix\r\n * @param x defines the x coordinate of the scaling\r\n * @param y defines the y coordinate of the scaling\r\n * @param result defines the target matrix\r\n */\r\n public static ScalingToRef(x: number, y: number, result: Matrix2D): void {\r\n result.fromValues(x, 0, 0, y, 0, 0);\r\n }\r\n\r\n /**\r\n * Creates a rotation matrix and stores it in a target matrix\r\n * @param angle defines the rotation angle\r\n * @param result defines the target matrix\r\n */\r\n public static RotationToRef(angle: number, result: Matrix2D): void {\r\n const s = Math.sin(angle);\r\n const c = Math.cos(angle);\r\n\r\n result.fromValues(c, s, -s, c, 0, 0);\r\n }\r\n\r\n private static _TempPreTranslationMatrix = Matrix2D.Identity();\r\n private static _TempPostTranslationMatrix = Matrix2D.Identity();\r\n private static _TempRotationMatrix = Matrix2D.Identity();\r\n private static _TempScalingMatrix = Matrix2D.Identity();\r\n private static _TempCompose0 = Matrix2D.Identity();\r\n private static _TempCompose1 = Matrix2D.Identity();\r\n private static _TempCompose2 = Matrix2D.Identity();\r\n\r\n /**\r\n * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix\r\n * @param tx defines the x coordinate of the translation\r\n * @param ty defines the y coordinate of the translation\r\n * @param angle defines the rotation angle\r\n * @param scaleX defines the x coordinate of the scaling\r\n * @param scaleY defines the y coordinate of the scaling\r\n * @param parentMatrix defines the parent matrix to multiply by (can be null)\r\n * @param result defines the target matrix\r\n */\r\n public static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void {\r\n Matrix2D.TranslationToRef(tx, ty, Matrix2D._TempPreTranslationMatrix);\r\n\r\n Matrix2D.ScalingToRef(scaleX, scaleY, Matrix2D._TempScalingMatrix);\r\n\r\n Matrix2D.RotationToRef(angle, Matrix2D._TempRotationMatrix);\r\n\r\n Matrix2D.TranslationToRef(-tx, -ty, Matrix2D._TempPostTranslationMatrix);\r\n\r\n Matrix2D._TempPreTranslationMatrix.multiplyToRef(Matrix2D._TempScalingMatrix, Matrix2D._TempCompose0);\r\n Matrix2D._TempCompose0.multiplyToRef(Matrix2D._TempRotationMatrix, Matrix2D._TempCompose1);\r\n if (parentMatrix) {\r\n Matrix2D._TempCompose1.multiplyToRef(Matrix2D._TempPostTranslationMatrix, Matrix2D._TempCompose2);\r\n Matrix2D._TempCompose2.multiplyToRef(parentMatrix, result);\r\n } else {\r\n Matrix2D._TempCompose1.multiplyToRef(Matrix2D._TempPostTranslationMatrix, result);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Useful math functions\r\n */\r\nexport class MathTools {\r\n /**\r\n * Default rounding precision for GUI elements. It should be\r\n * set to a power of ten, where the exponent means the number\r\n * of decimal digits to round to, i.e, 100 means 2 decimal digits,\r\n * 1000 means 3 decimal digits, etc. Default is 100 (2 decimal digits).\r\n */\r\n public static DefaultRoundingPrecision = 100;\r\n\r\n /**\r\n * Rounds a number to the nearest multiple of a given precision\r\n * @param value the value to be rounded\r\n * @param precision the multiple to which the value will be rounded. Default is 100 (2 decimal digits)\r\n * @returns\r\n */\r\n public static Round(value: number, precision: number = MathTools.DefaultRoundingPrecision): number {\r\n return Math.round(value * precision) / precision;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,77 @@
1
+ import type { Matrix2D } from "./math2D.js";
2
+ /**
3
+ * Class used to store 2D control sizes
4
+ */
5
+ export declare class Measure {
6
+ /** defines left coordinate */
7
+ left: number;
8
+ /** defines top coordinate */
9
+ top: number;
10
+ /** defines width dimension */
11
+ width: number;
12
+ /** defines height dimension */
13
+ height: number;
14
+ /**
15
+ * Creates a new measure
16
+ * @param left defines left coordinate
17
+ * @param top defines top coordinate
18
+ * @param width defines width dimension
19
+ * @param height defines height dimension
20
+ */
21
+ constructor(
22
+ /** defines left coordinate */
23
+ left: number,
24
+ /** defines top coordinate */
25
+ top: number,
26
+ /** defines width dimension */
27
+ width: number,
28
+ /** defines height dimension */
29
+ height: number);
30
+ /**
31
+ * Copy from another measure
32
+ * @param other defines the other measure to copy from
33
+ */
34
+ copyFrom(other: Measure): void;
35
+ /**
36
+ * Copy from a group of 4 floats
37
+ * @param left defines left coordinate
38
+ * @param top defines top coordinate
39
+ * @param width defines width dimension
40
+ * @param height defines height dimension
41
+ */
42
+ copyFromFloats(left: number, top: number, width: number, height: number): void;
43
+ /**
44
+ * Computes the axis aligned bounding box measure for two given measures
45
+ * @param a Input measure
46
+ * @param b Input measure
47
+ * @param result the resulting bounding measure
48
+ */
49
+ static CombineToRef(a: Measure, b: Measure, result: Measure): void;
50
+ /**
51
+ * Computes the axis aligned bounding box of the measure after it is modified by a given transform
52
+ * @param transform the matrix to transform the measure before computing the AABB
53
+ * @param addX number to add to left
54
+ * @param addY number to add to top
55
+ * @param addWidth number to add to width
56
+ * @param addHeight number to add to height
57
+ * @param result the resulting AABB
58
+ */
59
+ addAndTransformToRef(transform: Matrix2D, addX: number, addY: number, addWidth: number, addHeight: number, result: Measure): void;
60
+ /**
61
+ * Computes the axis aligned bounding box of the measure after it is modified by a given transform
62
+ * @param transform the matrix to transform the measure before computing the AABB
63
+ * @param result the resulting AABB
64
+ */
65
+ transformToRef(transform: Matrix2D, result: Measure): void;
66
+ /**
67
+ * Check equality between this measure and another one
68
+ * @param other defines the other measures
69
+ * @returns true if both measures are equals
70
+ */
71
+ isEqualsTo(other: Measure): boolean;
72
+ /**
73
+ * Creates an empty measure
74
+ * @returns a new measure
75
+ */
76
+ static Empty(): Measure;
77
+ }
package/2D/measure.js ADDED
@@ -0,0 +1,138 @@
1
+ import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
2
+ const TmpRect = [new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0)];
3
+ const TmpRect2 = [new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0)];
4
+ const TmpV1 = new Vector2(0, 0);
5
+ const TmpV2 = new Vector2(0, 0);
6
+ /**
7
+ * Class used to store 2D control sizes
8
+ */
9
+ export class Measure {
10
+ /**
11
+ * Creates a new measure
12
+ * @param left defines left coordinate
13
+ * @param top defines top coordinate
14
+ * @param width defines width dimension
15
+ * @param height defines height dimension
16
+ */
17
+ constructor(
18
+ /** defines left coordinate */
19
+ left,
20
+ /** defines top coordinate */
21
+ top,
22
+ /** defines width dimension */
23
+ width,
24
+ /** defines height dimension */
25
+ height) {
26
+ this.left = left;
27
+ this.top = top;
28
+ this.width = width;
29
+ this.height = height;
30
+ }
31
+ /**
32
+ * Copy from another measure
33
+ * @param other defines the other measure to copy from
34
+ */
35
+ copyFrom(other) {
36
+ this.left = other.left;
37
+ this.top = other.top;
38
+ this.width = other.width;
39
+ this.height = other.height;
40
+ }
41
+ /**
42
+ * Copy from a group of 4 floats
43
+ * @param left defines left coordinate
44
+ * @param top defines top coordinate
45
+ * @param width defines width dimension
46
+ * @param height defines height dimension
47
+ */
48
+ copyFromFloats(left, top, width, height) {
49
+ this.left = left;
50
+ this.top = top;
51
+ this.width = width;
52
+ this.height = height;
53
+ }
54
+ /**
55
+ * Computes the axis aligned bounding box measure for two given measures
56
+ * @param a Input measure
57
+ * @param b Input measure
58
+ * @param result the resulting bounding measure
59
+ */
60
+ static CombineToRef(a, b, result) {
61
+ const left = Math.min(a.left, b.left);
62
+ const top = Math.min(a.top, b.top);
63
+ const right = Math.max(a.left + a.width, b.left + b.width);
64
+ const bottom = Math.max(a.top + a.height, b.top + b.height);
65
+ result.left = left;
66
+ result.top = top;
67
+ result.width = right - left;
68
+ result.height = bottom - top;
69
+ }
70
+ /**
71
+ * Computes the axis aligned bounding box of the measure after it is modified by a given transform
72
+ * @param transform the matrix to transform the measure before computing the AABB
73
+ * @param addX number to add to left
74
+ * @param addY number to add to top
75
+ * @param addWidth number to add to width
76
+ * @param addHeight number to add to height
77
+ * @param result the resulting AABB
78
+ */
79
+ addAndTransformToRef(transform, addX, addY, addWidth, addHeight, result) {
80
+ const left = this.left + addX;
81
+ const top = this.top + addY;
82
+ const width = this.width + addWidth;
83
+ const height = this.height + addHeight;
84
+ TmpRect[0].copyFromFloats(left, top);
85
+ TmpRect[1].copyFromFloats(left + width, top);
86
+ TmpRect[2].copyFromFloats(left + width, top + height);
87
+ TmpRect[3].copyFromFloats(left, top + height);
88
+ TmpV1.copyFromFloats(Number.MAX_VALUE, Number.MAX_VALUE);
89
+ TmpV2.copyFromFloats(0, 0);
90
+ for (let i = 0; i < 4; i++) {
91
+ transform.transformCoordinates(TmpRect[i].x, TmpRect[i].y, TmpRect2[i]);
92
+ TmpV1.x = Math.floor(Math.min(TmpV1.x, TmpRect2[i].x));
93
+ TmpV1.y = Math.floor(Math.min(TmpV1.y, TmpRect2[i].y));
94
+ TmpV2.x = Math.ceil(Math.max(TmpV2.x, TmpRect2[i].x));
95
+ TmpV2.y = Math.ceil(Math.max(TmpV2.y, TmpRect2[i].y));
96
+ }
97
+ result.left = TmpV1.x;
98
+ result.top = TmpV1.y;
99
+ result.width = TmpV2.x - TmpV1.x;
100
+ result.height = TmpV2.y - TmpV1.y;
101
+ }
102
+ /**
103
+ * Computes the axis aligned bounding box of the measure after it is modified by a given transform
104
+ * @param transform the matrix to transform the measure before computing the AABB
105
+ * @param result the resulting AABB
106
+ */
107
+ transformToRef(transform, result) {
108
+ this.addAndTransformToRef(transform, 0, 0, 0, 0, result);
109
+ }
110
+ /**
111
+ * Check equality between this measure and another one
112
+ * @param other defines the other measures
113
+ * @returns true if both measures are equals
114
+ */
115
+ isEqualsTo(other) {
116
+ if (this.left !== other.left) {
117
+ return false;
118
+ }
119
+ if (this.top !== other.top) {
120
+ return false;
121
+ }
122
+ if (this.width !== other.width) {
123
+ return false;
124
+ }
125
+ if (this.height !== other.height) {
126
+ return false;
127
+ }
128
+ return true;
129
+ }
130
+ /**
131
+ * Creates an empty measure
132
+ * @returns a new measure
133
+ */
134
+ static Empty() {
135
+ return new Measure(0, 0, 0, 0);
136
+ }
137
+ }
138
+ //# sourceMappingURL=measure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../../dev/gui/src/2D/measure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAEjD,MAAM,OAAO,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE7F,MAAM,QAAQ,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,E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AAC;QACrB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,SAAmB,EAAE,MAAe;QACtD,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;IACD;;;;OAIG;IACI,UAAU,CAAC,KAAc;QAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK;QACf,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;CACJ","sourcesContent":["import type { Matrix2D } from \"./math2D\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nconst TmpRect = [new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0)];\r\n\r\nconst TmpRect2 = [new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0)];\r\n\r\nconst TmpV1 = new Vector2(0, 0);\r\nconst TmpV2 = new Vector2(0, 0);\r\n\r\n/**\r\n * Class used to store 2D control sizes\r\n */\r\nexport class Measure {\r\n /**\r\n * Creates a new measure\r\n * @param left defines left coordinate\r\n * @param top defines top coordinate\r\n * @param width defines width dimension\r\n * @param height defines height dimension\r\n */\r\n public constructor(\r\n /** defines left coordinate */\r\n public left: number,\r\n /** defines top coordinate */\r\n public top: number,\r\n /** defines width dimension */\r\n public width: number,\r\n /** defines height dimension */\r\n public height: number\r\n ) {}\r\n\r\n /**\r\n * Copy from another measure\r\n * @param other defines the other measure to copy from\r\n */\r\n public copyFrom(other: Measure): void {\r\n this.left = other.left;\r\n this.top = other.top;\r\n this.width = other.width;\r\n this.height = other.height;\r\n }\r\n\r\n /**\r\n * Copy from a group of 4 floats\r\n * @param left defines left coordinate\r\n * @param top defines top coordinate\r\n * @param width defines width dimension\r\n * @param height defines height dimension\r\n */\r\n public copyFromFloats(left: number, top: number, width: number, height: number): void {\r\n this.left = left;\r\n this.top = top;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n\r\n /**\r\n * Computes the axis aligned bounding box measure for two given measures\r\n * @param a Input measure\r\n * @param b Input measure\r\n * @param result the resulting bounding measure\r\n */\r\n public static CombineToRef(a: Measure, b: Measure, result: Measure) {\r\n const left = Math.min(a.left, b.left);\r\n const top = Math.min(a.top, b.top);\r\n const right = Math.max(a.left + a.width, b.left + b.width);\r\n const bottom = Math.max(a.top + a.height, b.top + b.height);\r\n result.left = left;\r\n result.top = top;\r\n result.width = right - left;\r\n result.height = bottom - top;\r\n }\r\n\r\n /**\r\n * Computes the axis aligned bounding box of the measure after it is modified by a given transform\r\n * @param transform the matrix to transform the measure before computing the AABB\r\n * @param addX number to add to left\r\n * @param addY number to add to top\r\n * @param addWidth number to add to width\r\n * @param addHeight number to add to height\r\n * @param result the resulting AABB\r\n */\r\n public addAndTransformToRef(transform: Matrix2D, addX: number, addY: number, addWidth: number, addHeight: number, result: Measure) {\r\n const left = this.left + addX;\r\n const top = this.top + addY;\r\n const width = this.width + addWidth;\r\n const height = this.height + addHeight;\r\n\r\n TmpRect[0].copyFromFloats(left, top);\r\n TmpRect[1].copyFromFloats(left + width, top);\r\n TmpRect[2].copyFromFloats(left + width, top + height);\r\n TmpRect[3].copyFromFloats(left, top + height);\r\n\r\n TmpV1.copyFromFloats(Number.MAX_VALUE, Number.MAX_VALUE);\r\n TmpV2.copyFromFloats(0, 0);\r\n for (let i = 0; i < 4; i++) {\r\n transform.transformCoordinates(TmpRect[i].x, TmpRect[i].y, TmpRect2[i]);\r\n TmpV1.x = Math.floor(Math.min(TmpV1.x, TmpRect2[i].x));\r\n TmpV1.y = Math.floor(Math.min(TmpV1.y, TmpRect2[i].y));\r\n TmpV2.x = Math.ceil(Math.max(TmpV2.x, TmpRect2[i].x));\r\n TmpV2.y = Math.ceil(Math.max(TmpV2.y, TmpRect2[i].y));\r\n }\r\n result.left = TmpV1.x;\r\n result.top = TmpV1.y;\r\n result.width = TmpV2.x - TmpV1.x;\r\n result.height = TmpV2.y - TmpV1.y;\r\n }\r\n\r\n /**\r\n * Computes the axis aligned bounding box of the measure after it is modified by a given transform\r\n * @param transform the matrix to transform the measure before computing the AABB\r\n * @param result the resulting AABB\r\n */\r\n public transformToRef(transform: Matrix2D, result: Measure) {\r\n this.addAndTransformToRef(transform, 0, 0, 0, 0, result);\r\n }\r\n /**\r\n * Check equality between this measure and another one\r\n * @param other defines the other measures\r\n * @returns true if both measures are equals\r\n */\r\n public isEqualsTo(other: Measure): boolean {\r\n if (this.left !== other.left) {\r\n return false;\r\n }\r\n\r\n if (this.top !== other.top) {\r\n return false;\r\n }\r\n\r\n if (this.width !== other.width) {\r\n return false;\r\n }\r\n\r\n if (this.height !== other.height) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Creates an empty measure\r\n * @returns a new measure\r\n */\r\n public static Empty(): Measure {\r\n return new Measure(0, 0, 0, 0);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,47 @@
1
+ import type { Nullable } from "@babylonjs/core/types.js";
2
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
3
+ import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
4
+ import type { MultiLine } from "./controls/multiLine.js";
5
+ import type { Control } from "./controls/control.js";
6
+ /**
7
+ * Class used to store a point for a MultiLine object.
8
+ * The point can be pure 2D coordinates, a mesh or a control
9
+ */
10
+ export declare class MultiLinePoint {
11
+ private _multiLine;
12
+ private _x;
13
+ private _y;
14
+ private _control;
15
+ private _mesh;
16
+ private _controlObserver;
17
+ private _meshObserver;
18
+ /** @internal */
19
+ _point: Vector3;
20
+ /**
21
+ * Creates a new MultiLinePoint
22
+ * @param multiLine defines the source MultiLine object
23
+ */
24
+ constructor(multiLine: MultiLine);
25
+ /** Gets or sets x coordinate */
26
+ get x(): string | number;
27
+ set x(value: string | number);
28
+ /** Gets or sets y coordinate */
29
+ get y(): string | number;
30
+ set y(value: string | number);
31
+ /** Gets or sets the control associated with this point */
32
+ get control(): Nullable<Control>;
33
+ set control(value: Nullable<Control>);
34
+ /** Gets or sets the mesh associated with this point */
35
+ get mesh(): Nullable<AbstractMesh>;
36
+ set mesh(value: Nullable<AbstractMesh>);
37
+ /** Resets links */
38
+ resetLinks(): void;
39
+ /**
40
+ * Gets a translation vector with Z component
41
+ * @returns the translation vector
42
+ */
43
+ translate(): Vector3;
44
+ private _translatePoint;
45
+ /** Release associated resources */
46
+ dispose(): void;
47
+ }
@@ -0,0 +1,110 @@
1
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
+ import { Epsilon } from "@babylonjs/core/Maths/math.constants.js";
3
+ import { ValueAndUnit } from "./valueAndUnit.js";
4
+ /**
5
+ * Class used to store a point for a MultiLine object.
6
+ * The point can be pure 2D coordinates, a mesh or a control
7
+ */
8
+ export class MultiLinePoint {
9
+ /**
10
+ * Creates a new MultiLinePoint
11
+ * @param multiLine defines the source MultiLine object
12
+ */
13
+ constructor(multiLine) {
14
+ this._multiLine = multiLine;
15
+ this._x = new ValueAndUnit(0);
16
+ this._y = new ValueAndUnit(0);
17
+ this._point = new Vector3(0, 0, 0);
18
+ }
19
+ /** Gets or sets x coordinate */
20
+ get x() {
21
+ return this._x.toString(this._multiLine._host);
22
+ }
23
+ set x(value) {
24
+ if (this._x.toString(this._multiLine._host) === value) {
25
+ return;
26
+ }
27
+ if (this._x.fromString(value)) {
28
+ this._multiLine._markAsDirty();
29
+ }
30
+ }
31
+ /** Gets or sets y coordinate */
32
+ get y() {
33
+ return this._y.toString(this._multiLine._host);
34
+ }
35
+ set y(value) {
36
+ if (this._y.toString(this._multiLine._host) === value) {
37
+ return;
38
+ }
39
+ if (this._y.fromString(value)) {
40
+ this._multiLine._markAsDirty();
41
+ }
42
+ }
43
+ /** Gets or sets the control associated with this point */
44
+ get control() {
45
+ return this._control;
46
+ }
47
+ set control(value) {
48
+ if (this._control === value) {
49
+ return;
50
+ }
51
+ if (this._control && this._controlObserver) {
52
+ this._control.onDirtyObservable.remove(this._controlObserver);
53
+ this._controlObserver = null;
54
+ }
55
+ this._control = value;
56
+ if (this._control) {
57
+ this._controlObserver = this._control.onDirtyObservable.add(this._multiLine.onPointUpdate);
58
+ }
59
+ this._multiLine._markAsDirty();
60
+ }
61
+ /** Gets or sets the mesh associated with this point */
62
+ get mesh() {
63
+ return this._mesh;
64
+ }
65
+ set mesh(value) {
66
+ if (this._mesh === value) {
67
+ return;
68
+ }
69
+ if (this._mesh && this._meshObserver) {
70
+ this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver);
71
+ }
72
+ this._mesh = value;
73
+ if (this._mesh) {
74
+ this._meshObserver = this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate);
75
+ }
76
+ this._multiLine._markAsDirty();
77
+ }
78
+ /** Resets links */
79
+ resetLinks() {
80
+ this.control = null;
81
+ this.mesh = null;
82
+ }
83
+ /**
84
+ * Gets a translation vector with Z component
85
+ * @returns the translation vector
86
+ */
87
+ translate() {
88
+ this._point = this._translatePoint();
89
+ return this._point;
90
+ }
91
+ _translatePoint() {
92
+ if (this._mesh != null) {
93
+ return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center, this._mesh.getWorldMatrix());
94
+ }
95
+ else if (this._control != null) {
96
+ return new Vector3(this._control.centerX, this._control.centerY, 1 - Epsilon);
97
+ }
98
+ else {
99
+ const host = this._multiLine._host;
100
+ const xValue = this._x.getValueInPixel(host, Number(host._canvas.width));
101
+ const yValue = this._y.getValueInPixel(host, Number(host._canvas.height));
102
+ return new Vector3(xValue, yValue, 1 - Epsilon);
103
+ }
104
+ }
105
+ /** Release associated resources */
106
+ dispose() {
107
+ this.resetLinks();
108
+ }
109
+ }
110
+ //# sourceMappingURL=multiLinePoint.js.map