@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
@@ -0,0 +1,2460 @@
1
+ import { __decorate } from "@babylonjs/core/tslib.es6.js";
2
+ import { Observable } from "@babylonjs/core/Misc/observable.js";
3
+ import { Vector2, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector.js";
4
+ import { PointerEventTypes } from "@babylonjs/core/Events/pointerEvents.js";
5
+ import { Logger } from "@babylonjs/core/Misc/logger.js";
6
+ import { Tools } from "@babylonjs/core/Misc/tools.js";
7
+ import { ValueAndUnit } from "../valueAndUnit.js";
8
+ import { Measure } from "../measure.js";
9
+ import { Matrix2D, Vector2WithInfo } from "../math2D.js";
10
+ import { GetClass, RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
11
+ import { serialize } from "@babylonjs/core/Misc/decorators.js";
12
+ import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
13
+ import { EngineStore } from "@babylonjs/core/Engines/engineStore.js";
14
+ /**
15
+ * Root class used for all 2D controls
16
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#controls
17
+ */
18
+ export class Control {
19
+ /**
20
+ * Gets or sets a boolean indicating if the control is readonly (default: false).
21
+ * A readonly control will still raise pointer events but will not react to them
22
+ */
23
+ get isReadOnly() {
24
+ return this._isReadOnly;
25
+ }
26
+ set isReadOnly(value) {
27
+ this._isReadOnly = value;
28
+ }
29
+ /**
30
+ * Gets the transformed measure, that is the bounding box of the control after applying all transformations
31
+ */
32
+ get transformedMeasure() {
33
+ return this._evaluatedMeasure;
34
+ }
35
+ /**
36
+ * Sets/Gets a boolean indicating if the children are clipped to the current control bounds.
37
+ * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
38
+ */
39
+ set clipChildren(value) {
40
+ this._clipChildren = value;
41
+ }
42
+ get clipChildren() {
43
+ return this._clipChildren;
44
+ }
45
+ /**
46
+ * Sets/Gets a boolean indicating that control content must be clipped
47
+ * Please note that not clipping content may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
48
+ */
49
+ set clipContent(value) {
50
+ this._clipContent = value;
51
+ }
52
+ get clipContent() {
53
+ return this._clipContent;
54
+ }
55
+ /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
56
+ get shadowOffsetX() {
57
+ return this._shadowOffsetX;
58
+ }
59
+ set shadowOffsetX(value) {
60
+ if (this._shadowOffsetX === value) {
61
+ return;
62
+ }
63
+ this._shadowOffsetX = value;
64
+ this._markAsDirty();
65
+ }
66
+ /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
67
+ get shadowOffsetY() {
68
+ return this._shadowOffsetY;
69
+ }
70
+ set shadowOffsetY(value) {
71
+ if (this._shadowOffsetY === value) {
72
+ return;
73
+ }
74
+ this._shadowOffsetY = value;
75
+ this._markAsDirty();
76
+ }
77
+ /** Gets or sets a value indicating the amount of blur to use to render the shadow */
78
+ get shadowBlur() {
79
+ return this._shadowBlur;
80
+ }
81
+ set shadowBlur(value) {
82
+ if (this._shadowBlur === value) {
83
+ return;
84
+ }
85
+ this._previousShadowBlur = this._shadowBlur;
86
+ this._shadowBlur = value;
87
+ this._markAsDirty();
88
+ }
89
+ /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
90
+ get shadowColor() {
91
+ return this._shadowColor;
92
+ }
93
+ set shadowColor(value) {
94
+ if (this._shadowColor === value) {
95
+ return;
96
+ }
97
+ this._shadowColor = value;
98
+ this._markAsDirty();
99
+ }
100
+ // Properties
101
+ /** Gets the control type name */
102
+ get typeName() {
103
+ return this._getTypeName();
104
+ }
105
+ /**
106
+ * Get the current class name of the control.
107
+ * @returns current class name
108
+ */
109
+ getClassName() {
110
+ return this._getTypeName();
111
+ }
112
+ /**
113
+ * Gets or sets the accessibility tag to describe the control for accessibility purpose.
114
+ * By default, GUI controls already indicate accessibility info, but one can override the info using this tag.
115
+ */
116
+ set accessibilityTag(value) {
117
+ this._accessibilityTag = value;
118
+ this.onAccessibilityTagChangedObservable.notifyObservers(value);
119
+ }
120
+ get accessibilityTag() {
121
+ return this._accessibilityTag;
122
+ }
123
+ /**
124
+ * Get the hosting AdvancedDynamicTexture
125
+ */
126
+ get host() {
127
+ return this._host;
128
+ }
129
+ /** Gets or set information about font offsets (used to render and align text) */
130
+ get fontOffset() {
131
+ return this._fontOffset;
132
+ }
133
+ set fontOffset(offset) {
134
+ this._fontOffset = offset;
135
+ }
136
+ /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
137
+ get alpha() {
138
+ return this._alpha;
139
+ }
140
+ set alpha(value) {
141
+ if (this._alpha === value) {
142
+ return;
143
+ }
144
+ this._alphaSet = true;
145
+ this._alpha = value;
146
+ this._markAsDirty();
147
+ }
148
+ /**
149
+ * Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)
150
+ */
151
+ get highlightLineWidth() {
152
+ return this._highlightLineWidth;
153
+ }
154
+ set highlightLineWidth(value) {
155
+ if (this._highlightLineWidth === value) {
156
+ return;
157
+ }
158
+ this._highlightLineWidth = value;
159
+ this._markAsDirty();
160
+ }
161
+ /**
162
+ * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
163
+ */
164
+ get isHighlighted() {
165
+ return this._isHighlighted;
166
+ }
167
+ set isHighlighted(value) {
168
+ if (this._isHighlighted === value) {
169
+ return;
170
+ }
171
+ this._isHighlighted = value;
172
+ this._markAsDirty();
173
+ }
174
+ /**
175
+ * Gets or sets a string defining the color to use for highlighting this control
176
+ */
177
+ get highlightColor() {
178
+ return this._highlightColor;
179
+ }
180
+ set highlightColor(value) {
181
+ if (this._highlightColor === value) {
182
+ return;
183
+ }
184
+ this._highlightColor = value;
185
+ this._markAsDirty();
186
+ }
187
+ /** Gets or sets a value indicating the scale factor on X axis (1 by default)
188
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#rotation-and-scaling
189
+ */
190
+ get scaleX() {
191
+ return this._scaleX;
192
+ }
193
+ set scaleX(value) {
194
+ if (this._scaleX === value) {
195
+ return;
196
+ }
197
+ this._scaleX = value;
198
+ this._markAsDirty();
199
+ this._markMatrixAsDirty();
200
+ }
201
+ /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
202
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#rotation-and-scaling
203
+ */
204
+ get scaleY() {
205
+ return this._scaleY;
206
+ }
207
+ set scaleY(value) {
208
+ if (this._scaleY === value) {
209
+ return;
210
+ }
211
+ this._scaleY = value;
212
+ this._markAsDirty();
213
+ this._markMatrixAsDirty();
214
+ }
215
+ /** Gets or sets the rotation angle (0 by default)
216
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#rotation-and-scaling
217
+ */
218
+ get rotation() {
219
+ return this._rotation;
220
+ }
221
+ set rotation(value) {
222
+ if (this._rotation === value) {
223
+ return;
224
+ }
225
+ this._rotation = value;
226
+ this._markAsDirty();
227
+ this._markMatrixAsDirty();
228
+ }
229
+ /** Gets or sets the transformation center on Y axis (0 by default)
230
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#rotation-and-scaling
231
+ */
232
+ get transformCenterY() {
233
+ return this._transformCenterY;
234
+ }
235
+ set transformCenterY(value) {
236
+ if (this._transformCenterY === value) {
237
+ return;
238
+ }
239
+ this._transformCenterY = value;
240
+ this._markAsDirty();
241
+ this._markMatrixAsDirty();
242
+ }
243
+ /** Gets or sets the transformation center on X axis (0 by default)
244
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#rotation-and-scaling
245
+ */
246
+ get transformCenterX() {
247
+ return this._transformCenterX;
248
+ }
249
+ set transformCenterX(value) {
250
+ if (this._transformCenterX === value) {
251
+ return;
252
+ }
253
+ this._transformCenterX = value;
254
+ this._markAsDirty();
255
+ this._markMatrixAsDirty();
256
+ }
257
+ /**
258
+ * Gets or sets the horizontal alignment
259
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#alignments
260
+ */
261
+ get horizontalAlignment() {
262
+ return this._horizontalAlignment;
263
+ }
264
+ set horizontalAlignment(value) {
265
+ if (this._horizontalAlignment === value) {
266
+ return;
267
+ }
268
+ this._horizontalAlignment = value;
269
+ this._markAsDirty();
270
+ }
271
+ /**
272
+ * Gets or sets the vertical alignment
273
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#alignments
274
+ */
275
+ get verticalAlignment() {
276
+ return this._verticalAlignment;
277
+ }
278
+ set verticalAlignment(value) {
279
+ if (this._verticalAlignment === value) {
280
+ return;
281
+ }
282
+ this._verticalAlignment = value;
283
+ this._markAsDirty();
284
+ }
285
+ set fixedRatio(value) {
286
+ if (this._fixedRatio === value) {
287
+ return;
288
+ }
289
+ this._fixedRatio = value;
290
+ this._markAsDirty();
291
+ }
292
+ /**
293
+ * Gets or sets a fixed ratio for this control.
294
+ * When different from 0, the ratio is used to compute the "second" dimension.
295
+ * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
296
+ * second dimension is computed as first dimension * fixedRatio
297
+ */
298
+ get fixedRatio() {
299
+ return this._fixedRatio;
300
+ }
301
+ set fixedRatioMasterIsWidth(value) {
302
+ if (this._fixedRatioMasterIsWidth === value) {
303
+ return;
304
+ }
305
+ this._fixedRatioMasterIsWidth = value;
306
+ this._markAsDirty();
307
+ }
308
+ /**
309
+ * Gets or sets a boolean indicating that the fixed ratio is set on the width instead of the height. True by default.
310
+ * When the height of a control is set, this property is changed to false.
311
+ */
312
+ get fixedRatioMasterIsWidth() {
313
+ return this._fixedRatioMasterIsWidth;
314
+ }
315
+ /**
316
+ * Gets or sets control width
317
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
318
+ */
319
+ get width() {
320
+ return this._width.toString(this._host);
321
+ }
322
+ set width(value) {
323
+ this._fixedRatioMasterIsWidth = true;
324
+ if (this._width.toString(this._host) === value) {
325
+ return;
326
+ }
327
+ if (this._width.fromString(value)) {
328
+ this._markAsDirty();
329
+ }
330
+ }
331
+ /**
332
+ * Gets or sets the control width in pixel
333
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
334
+ */
335
+ get widthInPixels() {
336
+ return this._width.getValueInPixel(this._host, this._cachedParentMeasure.width);
337
+ }
338
+ set widthInPixels(value) {
339
+ if (isNaN(value)) {
340
+ return;
341
+ }
342
+ this._fixedRatioMasterIsWidth = true;
343
+ this.width = value + "px";
344
+ }
345
+ /**
346
+ * Gets or sets control height
347
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
348
+ */
349
+ get height() {
350
+ return this._height.toString(this._host);
351
+ }
352
+ set height(value) {
353
+ this._fixedRatioMasterIsWidth = false;
354
+ if (this._height.toString(this._host) === value) {
355
+ return;
356
+ }
357
+ if (this._height.fromString(value)) {
358
+ this._markAsDirty();
359
+ }
360
+ }
361
+ /**
362
+ * Gets or sets control height in pixel
363
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
364
+ */
365
+ get heightInPixels() {
366
+ return this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);
367
+ }
368
+ set heightInPixels(value) {
369
+ if (isNaN(value)) {
370
+ return;
371
+ }
372
+ this._fixedRatioMasterIsWidth = false;
373
+ this.height = value + "px";
374
+ }
375
+ /** Gets or set font family */
376
+ get fontFamily() {
377
+ return this._fontFamily;
378
+ }
379
+ set fontFamily(value) {
380
+ if (this._fontFamily === value) {
381
+ return;
382
+ }
383
+ this._fontFamily = value;
384
+ this._resetFontCache();
385
+ }
386
+ /** Gets or sets font style */
387
+ get fontStyle() {
388
+ return this._fontStyle;
389
+ }
390
+ set fontStyle(value) {
391
+ if (this._fontStyle === value) {
392
+ return;
393
+ }
394
+ this._fontStyle = value;
395
+ this._resetFontCache();
396
+ }
397
+ /** Gets or sets font weight */
398
+ get fontWeight() {
399
+ return this._fontWeight;
400
+ }
401
+ set fontWeight(value) {
402
+ if (this._fontWeight === value) {
403
+ return;
404
+ }
405
+ this._fontWeight = value;
406
+ this._resetFontCache();
407
+ }
408
+ /**
409
+ * Gets or sets style
410
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#styles
411
+ */
412
+ get style() {
413
+ return this._style;
414
+ }
415
+ set style(value) {
416
+ if (this._style) {
417
+ this._style.onChangedObservable.remove(this._styleObserver);
418
+ this._styleObserver = null;
419
+ }
420
+ this._style = value;
421
+ if (this._style) {
422
+ this._styleObserver = this._style.onChangedObservable.add(() => {
423
+ this._markAsDirty();
424
+ this._resetFontCache();
425
+ });
426
+ }
427
+ this._markAsDirty();
428
+ this._resetFontCache();
429
+ }
430
+ /** @internal */
431
+ get _isFontSizeInPercentage() {
432
+ return this._fontSize.isPercentage;
433
+ }
434
+ /** Gets or sets font size in pixels */
435
+ get fontSizeInPixels() {
436
+ const fontSizeToUse = this._style ? this._style._fontSize : this._fontSize;
437
+ if (fontSizeToUse.isPixel) {
438
+ return fontSizeToUse.getValue(this._host);
439
+ }
440
+ return fontSizeToUse.getValueInPixel(this._host, this._tempParentMeasure.height || this._cachedParentMeasure.height);
441
+ }
442
+ set fontSizeInPixels(value) {
443
+ if (isNaN(value)) {
444
+ return;
445
+ }
446
+ this.fontSize = value + "px";
447
+ }
448
+ /** Gets or sets font size */
449
+ get fontSize() {
450
+ return this._fontSize.toString(this._host);
451
+ }
452
+ set fontSize(value) {
453
+ if (this._fontSize.toString(this._host) === value) {
454
+ return;
455
+ }
456
+ if (this._fontSize.fromString(value)) {
457
+ this._markAsDirty();
458
+ this._resetFontCache();
459
+ }
460
+ }
461
+ /** Gets or sets foreground color */
462
+ get color() {
463
+ return this._color;
464
+ }
465
+ set color(value) {
466
+ if (this._color === value) {
467
+ return;
468
+ }
469
+ this._color = value;
470
+ this._markAsDirty();
471
+ }
472
+ /** Gets or sets gradient. Setting a gradient will override the color */
473
+ get gradient() {
474
+ return this._gradient;
475
+ }
476
+ set gradient(value) {
477
+ if (this._gradient === value) {
478
+ return;
479
+ }
480
+ this._gradient = value;
481
+ this._markAsDirty();
482
+ }
483
+ /** Gets or sets z index which is used to reorder controls on the z axis */
484
+ get zIndex() {
485
+ return this._zIndex;
486
+ }
487
+ set zIndex(value) {
488
+ if (this.zIndex === value) {
489
+ return;
490
+ }
491
+ this._zIndex = value;
492
+ if (this.parent) {
493
+ this.parent._reOrderControl(this);
494
+ }
495
+ }
496
+ /** Gets or sets a boolean indicating if the control can be rendered */
497
+ get notRenderable() {
498
+ return this._doNotRender;
499
+ }
500
+ set notRenderable(value) {
501
+ if (this._doNotRender === value) {
502
+ return;
503
+ }
504
+ this._doNotRender = value;
505
+ this._markAsDirty();
506
+ }
507
+ /** Gets or sets a boolean indicating if the control is visible */
508
+ get isVisible() {
509
+ return this._isVisible;
510
+ }
511
+ set isVisible(value) {
512
+ if (this._isVisible === value) {
513
+ return;
514
+ }
515
+ this._isVisible = value;
516
+ this._markAsDirty(true);
517
+ this.onIsVisibleChangedObservable.notifyObservers(value);
518
+ }
519
+ /** Gets a boolean indicating that the control needs to update its rendering */
520
+ get isDirty() {
521
+ return this._isDirty;
522
+ }
523
+ /**
524
+ * Gets the current linked mesh (or null if none)
525
+ */
526
+ get linkedMesh() {
527
+ return this._linkedMesh;
528
+ }
529
+ /**
530
+ * Gets or sets a value indicating the padding should work like in CSS.
531
+ * Basically, it will add the padding amount on each side of the parent control for its children.
532
+ */
533
+ get descendantsOnlyPadding() {
534
+ return this._descendantsOnlyPadding;
535
+ }
536
+ set descendantsOnlyPadding(value) {
537
+ if (this._descendantsOnlyPadding === value) {
538
+ return;
539
+ }
540
+ this._descendantsOnlyPadding = value;
541
+ this._markAsDirty();
542
+ }
543
+ /**
544
+ * Gets or sets a value indicating the padding to use on the left of the control
545
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
546
+ */
547
+ get paddingLeft() {
548
+ return this._paddingLeft.toString(this._host);
549
+ }
550
+ set paddingLeft(value) {
551
+ if (this._paddingLeft.fromString(value)) {
552
+ this._markAsDirty();
553
+ }
554
+ }
555
+ /**
556
+ * Gets or sets a value indicating the padding in pixels to use on the left of the control
557
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
558
+ */
559
+ get paddingLeftInPixels() {
560
+ return this._paddingLeft.getValueInPixel(this._host, this._cachedParentMeasure.width);
561
+ }
562
+ set paddingLeftInPixels(value) {
563
+ if (isNaN(value)) {
564
+ return;
565
+ }
566
+ this.paddingLeft = value + "px";
567
+ }
568
+ /** @internal */
569
+ get _paddingLeftInPixels() {
570
+ if (this._descendantsOnlyPadding) {
571
+ return 0;
572
+ }
573
+ return this.paddingLeftInPixels;
574
+ }
575
+ /**
576
+ * Gets or sets a value indicating the padding to use on the right of the control
577
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
578
+ */
579
+ get paddingRight() {
580
+ return this._paddingRight.toString(this._host);
581
+ }
582
+ set paddingRight(value) {
583
+ if (this._paddingRight.fromString(value)) {
584
+ this._markAsDirty();
585
+ }
586
+ }
587
+ /**
588
+ * Gets or sets a value indicating the padding in pixels to use on the right of the control
589
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
590
+ */
591
+ get paddingRightInPixels() {
592
+ return this._paddingRight.getValueInPixel(this._host, this._cachedParentMeasure.width);
593
+ }
594
+ set paddingRightInPixels(value) {
595
+ if (isNaN(value)) {
596
+ return;
597
+ }
598
+ this.paddingRight = value + "px";
599
+ }
600
+ /** @internal */
601
+ get _paddingRightInPixels() {
602
+ if (this._descendantsOnlyPadding) {
603
+ return 0;
604
+ }
605
+ return this.paddingRightInPixels;
606
+ }
607
+ /**
608
+ * Gets or sets a value indicating the padding to use on the top of the control
609
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
610
+ */
611
+ get paddingTop() {
612
+ return this._paddingTop.toString(this._host);
613
+ }
614
+ set paddingTop(value) {
615
+ if (this._paddingTop.fromString(value)) {
616
+ this._markAsDirty();
617
+ }
618
+ }
619
+ /**
620
+ * Gets or sets a value indicating the padding in pixels to use on the top of the control
621
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
622
+ */
623
+ get paddingTopInPixels() {
624
+ return this._paddingTop.getValueInPixel(this._host, this._cachedParentMeasure.height);
625
+ }
626
+ set paddingTopInPixels(value) {
627
+ if (isNaN(value)) {
628
+ return;
629
+ }
630
+ this.paddingTop = value + "px";
631
+ }
632
+ /** @internal */
633
+ get _paddingTopInPixels() {
634
+ if (this._descendantsOnlyPadding) {
635
+ return 0;
636
+ }
637
+ return this.paddingTopInPixels;
638
+ }
639
+ /**
640
+ * Gets or sets a value indicating the padding to use on the bottom of the control
641
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
642
+ */
643
+ get paddingBottom() {
644
+ return this._paddingBottom.toString(this._host);
645
+ }
646
+ set paddingBottom(value) {
647
+ if (this._paddingBottom.fromString(value)) {
648
+ this._markAsDirty();
649
+ }
650
+ }
651
+ /**
652
+ * Gets or sets a value indicating the padding in pixels to use on the bottom of the control
653
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
654
+ */
655
+ get paddingBottomInPixels() {
656
+ return this._paddingBottom.getValueInPixel(this._host, this._cachedParentMeasure.height);
657
+ }
658
+ set paddingBottomInPixels(value) {
659
+ if (isNaN(value)) {
660
+ return;
661
+ }
662
+ this.paddingBottom = value + "px";
663
+ }
664
+ /** @internal */
665
+ get _paddingBottomInPixels() {
666
+ if (this._descendantsOnlyPadding) {
667
+ return 0;
668
+ }
669
+ return this.paddingBottomInPixels;
670
+ }
671
+ /**
672
+ * Gets or sets a value indicating the left coordinate of the control
673
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
674
+ */
675
+ get left() {
676
+ return this._left.toString(this._host);
677
+ }
678
+ set left(value) {
679
+ if (this._left.fromString(value)) {
680
+ this._markAsDirty();
681
+ }
682
+ }
683
+ /**
684
+ * Gets or sets a value indicating the left coordinate in pixels of the control
685
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
686
+ */
687
+ get leftInPixels() {
688
+ return this._left.getValueInPixel(this._host, this._cachedParentMeasure.width);
689
+ }
690
+ set leftInPixels(value) {
691
+ if (isNaN(value)) {
692
+ return;
693
+ }
694
+ this.left = value + "px";
695
+ }
696
+ /**
697
+ * Gets or sets a value indicating the top coordinate of the control
698
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
699
+ */
700
+ get top() {
701
+ return this._top.toString(this._host);
702
+ }
703
+ set top(value) {
704
+ if (this._top.fromString(value)) {
705
+ this._markAsDirty();
706
+ }
707
+ }
708
+ /**
709
+ * Gets or sets a value indicating the top coordinate in pixels of the control
710
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
711
+ */
712
+ get topInPixels() {
713
+ return this._top.getValueInPixel(this._host, this._cachedParentMeasure.height);
714
+ }
715
+ set topInPixels(value) {
716
+ if (isNaN(value)) {
717
+ return;
718
+ }
719
+ this.top = value + "px";
720
+ }
721
+ /**
722
+ * Gets or sets a value indicating the offset on X axis to the linked mesh
723
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#tracking-positions
724
+ */
725
+ get linkOffsetX() {
726
+ return this._linkOffsetX.toString(this._host);
727
+ }
728
+ set linkOffsetX(value) {
729
+ if (this._linkOffsetX.fromString(value)) {
730
+ this._markAsDirty();
731
+ }
732
+ }
733
+ /**
734
+ * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
735
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#tracking-positions
736
+ */
737
+ get linkOffsetXInPixels() {
738
+ return this._linkOffsetX.getValueInPixel(this._host, this._cachedParentMeasure.width);
739
+ }
740
+ set linkOffsetXInPixels(value) {
741
+ if (isNaN(value)) {
742
+ return;
743
+ }
744
+ this.linkOffsetX = value + "px";
745
+ }
746
+ /**
747
+ * Gets or sets a value indicating the offset on Y axis to the linked mesh
748
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#tracking-positions
749
+ */
750
+ get linkOffsetY() {
751
+ return this._linkOffsetY.toString(this._host);
752
+ }
753
+ set linkOffsetY(value) {
754
+ if (this._linkOffsetY.fromString(value)) {
755
+ this._markAsDirty();
756
+ }
757
+ }
758
+ /**
759
+ * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
760
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#tracking-positions
761
+ */
762
+ get linkOffsetYInPixels() {
763
+ return this._linkOffsetY.getValueInPixel(this._host, this._cachedParentMeasure.height);
764
+ }
765
+ set linkOffsetYInPixels(value) {
766
+ if (isNaN(value)) {
767
+ return;
768
+ }
769
+ this.linkOffsetY = value + "px";
770
+ }
771
+ /** Gets the center coordinate on X axis */
772
+ get centerX() {
773
+ return this._currentMeasure.left + this._currentMeasure.width / 2;
774
+ }
775
+ /** Gets the center coordinate on Y axis */
776
+ get centerY() {
777
+ return this._currentMeasure.top + this._currentMeasure.height / 2;
778
+ }
779
+ /** Gets or sets if control is Enabled */
780
+ get isEnabled() {
781
+ return this._isEnabled;
782
+ }
783
+ set isEnabled(value) {
784
+ if (this._isEnabled === value) {
785
+ return;
786
+ }
787
+ this._isEnabled = value;
788
+ this._markAsDirty();
789
+ // if this control or any of it's descendants are under a pointer, we need to fire a pointerOut event
790
+ const recursivelyFirePointerOut = (control) => {
791
+ if (!control.host) {
792
+ return;
793
+ }
794
+ for (const pointer in control.host._lastControlOver) {
795
+ if (control === this.host._lastControlOver[pointer]) {
796
+ control._onPointerOut(control, null, true);
797
+ delete control.host._lastControlOver[pointer];
798
+ }
799
+ }
800
+ if (control.children !== undefined) {
801
+ for (const child of control.children) {
802
+ recursivelyFirePointerOut(child);
803
+ }
804
+ }
805
+ };
806
+ recursivelyFirePointerOut(this);
807
+ this.onEnabledStateChangedObservable.notifyObservers(value);
808
+ }
809
+ /** Gets or sets background color of control if it's disabled. Only applies to Button class. */
810
+ get disabledColor() {
811
+ return this._disabledColor;
812
+ }
813
+ set disabledColor(value) {
814
+ if (this._disabledColor === value) {
815
+ return;
816
+ }
817
+ this._disabledColor = value;
818
+ this._markAsDirty();
819
+ }
820
+ /** Gets or sets front color of control if it's disabled. Only applies to Checkbox class. */
821
+ get disabledColorItem() {
822
+ return this._disabledColorItem;
823
+ }
824
+ set disabledColorItem(value) {
825
+ if (this._disabledColorItem === value) {
826
+ return;
827
+ }
828
+ this._disabledColorItem = value;
829
+ this._markAsDirty();
830
+ }
831
+ /**
832
+ * Border color when control is focused
833
+ * When not defined the ADT color will be used. If no ADT color is defined, focused state won't have any border
834
+ */
835
+ get focusedColor() {
836
+ return this._focusedColor;
837
+ }
838
+ set focusedColor(value) {
839
+ this._focusedColor = value;
840
+ }
841
+ /** @internal */
842
+ onBlur() {
843
+ if (this._isFocused) {
844
+ this._isFocused = false;
845
+ if (this.focusedColor && this._unfocusedColor != null) {
846
+ // Set color back to saved unfocused color
847
+ this.color = this._unfocusedColor;
848
+ }
849
+ this.onBlurObservable.notifyObservers(this);
850
+ }
851
+ }
852
+ /** @internal */
853
+ onFocus() {
854
+ this._isFocused = true;
855
+ if (this.focusedColor) {
856
+ // Save the unfocused color
857
+ this._unfocusedColor = this.color;
858
+ this.color = this.focusedColor;
859
+ }
860
+ this.onFocusObservable.notifyObservers(this);
861
+ }
862
+ /**
863
+ * Function called to get the list of controls that should not steal the focus from this control
864
+ * @returns an array of controls
865
+ */
866
+ keepsFocusWith() {
867
+ return null;
868
+ }
869
+ /**
870
+ * Function to focus a button programmatically
871
+ */
872
+ focus() {
873
+ this._host.moveFocusToControl(this);
874
+ }
875
+ /**
876
+ * Function to unfocus a button programmatically
877
+ */
878
+ blur() {
879
+ this._host.focusedControl = null;
880
+ }
881
+ /**
882
+ * Handles the keyboard event
883
+ * @param evt Defines the KeyboardEvent
884
+ */
885
+ processKeyboard(evt) {
886
+ // if enter, trigger the new observable
887
+ if (evt.key === "Enter") {
888
+ this.onEnterPressedObservable.notifyObservers(this);
889
+ }
890
+ this.onKeyboardEventProcessedObservable.notifyObservers(evt, -1, this);
891
+ }
892
+ // Functions
893
+ /**
894
+ * Creates a new control
895
+ * @param name defines the name of the control
896
+ */
897
+ constructor(
898
+ /** defines the name of the control */
899
+ name) {
900
+ this.name = name;
901
+ this._alpha = 1;
902
+ this._alphaSet = false;
903
+ this._zIndex = 0;
904
+ /** @internal */
905
+ this._currentMeasure = Measure.Empty();
906
+ /** @internal */
907
+ this._tempPaddingMeasure = Measure.Empty();
908
+ this._fontFamily = "";
909
+ this._fontStyle = "";
910
+ this._fontWeight = "";
911
+ this._fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);
912
+ /** @internal */
913
+ this._width = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
914
+ /** @internal */
915
+ this._height = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
916
+ this._color = "";
917
+ this._style = null;
918
+ /** @internal */
919
+ this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
920
+ /** @internal */
921
+ this._verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
922
+ /** @internal */
923
+ this._isDirty = true;
924
+ /** @internal */
925
+ this._wasDirty = false;
926
+ /** @internal */
927
+ this._tempParentMeasure = Measure.Empty();
928
+ /** @internal */
929
+ this._prevCurrentMeasureTransformedIntoGlobalSpace = Measure.Empty();
930
+ /** @internal */
931
+ this._cachedParentMeasure = Measure.Empty();
932
+ this._descendantsOnlyPadding = false;
933
+ this._paddingLeft = new ValueAndUnit(0);
934
+ this._paddingRight = new ValueAndUnit(0);
935
+ this._paddingTop = new ValueAndUnit(0);
936
+ this._paddingBottom = new ValueAndUnit(0);
937
+ /** @internal */
938
+ this._left = new ValueAndUnit(0);
939
+ /** @internal */
940
+ this._top = new ValueAndUnit(0);
941
+ this._scaleX = 1.0;
942
+ this._scaleY = 1.0;
943
+ this._rotation = 0;
944
+ this._transformCenterX = 0.5;
945
+ this._transformCenterY = 0.5;
946
+ /** @internal */
947
+ this._transformMatrix = Matrix2D.Identity();
948
+ /** @internal */
949
+ this._invertTransformMatrix = Matrix2D.Identity();
950
+ /** @internal */
951
+ this._transformedPosition = Vector2.Zero();
952
+ this._isMatrixDirty = true;
953
+ this._isVisible = true;
954
+ this._isHighlighted = false;
955
+ this._highlightColor = "#4affff";
956
+ this._highlightLineWidth = 2;
957
+ this._fontSet = false;
958
+ this._dummyVector2 = Vector2.Zero();
959
+ this._downCount = 0;
960
+ this._enterCount = -1;
961
+ this._doNotRender = false;
962
+ this._downPointerIds = {};
963
+ this._evaluatedMeasure = new Measure(0, 0, 0, 0);
964
+ this._evaluatedParentMeasure = new Measure(0, 0, 0, 0);
965
+ this._isEnabled = true;
966
+ this._disabledColor = "#9a9a9a";
967
+ this._disabledColorItem = "#6a6a6a";
968
+ this._isReadOnly = false;
969
+ this._gradient = null;
970
+ /** @internal */
971
+ this._rebuildLayout = false;
972
+ /**
973
+ * Observable that fires when the control's enabled state changes
974
+ */
975
+ this.onEnabledStateChangedObservable = new Observable();
976
+ /** @internal */
977
+ this._customData = {};
978
+ /** @internal */
979
+ this._isClipped = false;
980
+ /** @internal */
981
+ this._automaticSize = false;
982
+ /**
983
+ * Gets or sets an object used to store user defined information for the node
984
+ */
985
+ this.metadata = null;
986
+ /** Gets or sets a boolean indicating if the control can be hit with pointer events */
987
+ this.isHitTestVisible = true;
988
+ /** Gets or sets a boolean indicating if the control can block pointer events. False by default except on the following controls:
989
+ * * Button controls (Button, RadioButton, ToggleButton)
990
+ * * Checkbox
991
+ * * ColorPicker
992
+ * * InputText
993
+ * * Slider
994
+ */
995
+ this.isPointerBlocker = false;
996
+ /** Gets or sets a boolean indicating if the control can be focusable */
997
+ this.isFocusInvisible = false;
998
+ this._clipChildren = true;
999
+ this._clipContent = true;
1000
+ /**
1001
+ * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
1002
+ */
1003
+ this.useBitmapCache = false;
1004
+ this._shadowOffsetX = 0;
1005
+ this._shadowOffsetY = 0;
1006
+ this._shadowBlur = 0;
1007
+ this._previousShadowBlur = 0;
1008
+ this._shadowColor = "black";
1009
+ /** Gets or sets the cursor to use when the control is hovered */
1010
+ this.hoverCursor = "";
1011
+ /** @internal */
1012
+ this._linkOffsetX = new ValueAndUnit(0);
1013
+ /** @internal */
1014
+ this._linkOffsetY = new ValueAndUnit(0);
1015
+ this._accessibilityTag = null;
1016
+ /**
1017
+ * Observable that fires whenever the accessibility event of the control has changed
1018
+ */
1019
+ this.onAccessibilityTagChangedObservable = new Observable();
1020
+ /**
1021
+ * An event triggered when pointer wheel is scrolled
1022
+ */
1023
+ this.onWheelObservable = new Observable();
1024
+ /**
1025
+ * An event triggered when the pointer moves over the control.
1026
+ */
1027
+ this.onPointerMoveObservable = new Observable();
1028
+ /**
1029
+ * An event triggered when the pointer moves out of the control.
1030
+ */
1031
+ this.onPointerOutObservable = new Observable();
1032
+ /**
1033
+ * An event triggered when the pointer taps the control
1034
+ */
1035
+ this.onPointerDownObservable = new Observable();
1036
+ /**
1037
+ * An event triggered when pointer up
1038
+ */
1039
+ this.onPointerUpObservable = new Observable();
1040
+ /**
1041
+ * An event triggered when a control is clicked on
1042
+ */
1043
+ this.onPointerClickObservable = new Observable();
1044
+ /**
1045
+ * An event triggered when a control receives an ENTER key down event
1046
+ */
1047
+ this.onEnterPressedObservable = new Observable();
1048
+ /**
1049
+ * An event triggered when pointer enters the control
1050
+ */
1051
+ this.onPointerEnterObservable = new Observable();
1052
+ /**
1053
+ * An event triggered when the control is marked as dirty
1054
+ */
1055
+ this.onDirtyObservable = new Observable();
1056
+ /**
1057
+ * An event triggered before drawing the control
1058
+ */
1059
+ this.onBeforeDrawObservable = new Observable();
1060
+ /**
1061
+ * An event triggered after the control was drawn
1062
+ */
1063
+ this.onAfterDrawObservable = new Observable();
1064
+ /**
1065
+ * An event triggered when the control has been disposed
1066
+ */
1067
+ this.onDisposeObservable = new Observable();
1068
+ /**
1069
+ * An event triggered when the control isVisible is changed
1070
+ */
1071
+ this.onIsVisibleChangedObservable = new Observable();
1072
+ /**
1073
+ * Indicates if the control should be serialized. Defaults to true.
1074
+ */
1075
+ this.isSerializable = true;
1076
+ this._fixedRatio = 0;
1077
+ this._fixedRatioMasterIsWidth = true;
1078
+ /**
1079
+ * Array of animations
1080
+ */
1081
+ this.animations = null;
1082
+ // Focus functionality
1083
+ this._focusedColor = null;
1084
+ /**
1085
+ * The tab index of this control. -1 indicates this control is not part of the tab navigation.
1086
+ * A positive value indicates the order of the control in the tab navigation.
1087
+ * A value of 0 indicated the control will be focused after all controls with a positive index.
1088
+ * More than one control can have the same tab index and the navigation would then go through all controls with the same value in an order defined by the layout or the hierarchy.
1089
+ * The value can be changed at any time.
1090
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
1091
+ */
1092
+ this.tabIndex = -1;
1093
+ this._isFocused = false;
1094
+ this._unfocusedColor = null;
1095
+ /** Observable raised when the control gets the focus */
1096
+ this.onFocusObservable = new Observable();
1097
+ /** Observable raised when the control loses the focus */
1098
+ this.onBlurObservable = new Observable();
1099
+ /** Observable raised when a key event was processed */
1100
+ this.onKeyboardEventProcessedObservable = new Observable();
1101
+ this._tmpMeasureA = new Measure(0, 0, 0, 0);
1102
+ }
1103
+ /** @internal */
1104
+ _getTypeName() {
1105
+ return "Control";
1106
+ }
1107
+ /**
1108
+ * Gets the first ascendant in the hierarchy of the given type
1109
+ * @param className defines the required type
1110
+ * @returns the ascendant or null if not found
1111
+ */
1112
+ getAscendantOfClass(className) {
1113
+ if (!this.parent) {
1114
+ return null;
1115
+ }
1116
+ if (this.parent.getClassName() === className) {
1117
+ return this.parent;
1118
+ }
1119
+ return this.parent.getAscendantOfClass(className);
1120
+ }
1121
+ /**
1122
+ * Mark control element as dirty
1123
+ * @param force force non visible elements to be marked too
1124
+ */
1125
+ markAsDirty(force = false) {
1126
+ this._markAsDirty(force);
1127
+ }
1128
+ /**
1129
+ * Mark the element and its children as dirty
1130
+ */
1131
+ markAllAsDirty() {
1132
+ this._markAllAsDirty();
1133
+ }
1134
+ /** @internal */
1135
+ _resetFontCache() {
1136
+ this._fontSet = true;
1137
+ this._markAsDirty();
1138
+ }
1139
+ /**
1140
+ * Determines if a container is an ascendant of the current control
1141
+ * @param container defines the container to look for
1142
+ * @returns true if the container is one of the ascendant of the control
1143
+ */
1144
+ isAscendant(container) {
1145
+ if (!this.parent) {
1146
+ return false;
1147
+ }
1148
+ if (this.parent === container) {
1149
+ return true;
1150
+ }
1151
+ return this.parent.isAscendant(container);
1152
+ }
1153
+ /**
1154
+ * Gets coordinates in local control space
1155
+ * @param globalCoordinates defines the coordinates to transform
1156
+ * @returns the new coordinates in local space
1157
+ */
1158
+ getLocalCoordinates(globalCoordinates) {
1159
+ const result = Vector2.Zero();
1160
+ this.getLocalCoordinatesToRef(globalCoordinates, result);
1161
+ return result;
1162
+ }
1163
+ /**
1164
+ * Gets coordinates in local control space
1165
+ * @param globalCoordinates defines the coordinates to transform
1166
+ * @param result defines the target vector2 where to store the result
1167
+ * @returns the current control
1168
+ */
1169
+ getLocalCoordinatesToRef(globalCoordinates, result) {
1170
+ result.x = globalCoordinates.x - this._currentMeasure.left;
1171
+ result.y = globalCoordinates.y - this._currentMeasure.top;
1172
+ return this;
1173
+ }
1174
+ /**
1175
+ * Gets coordinates in parent local control space
1176
+ * @param globalCoordinates defines the coordinates to transform
1177
+ * @returns the new coordinates in parent local space
1178
+ */
1179
+ getParentLocalCoordinates(globalCoordinates) {
1180
+ const result = Vector2.Zero();
1181
+ result.x = globalCoordinates.x - this._cachedParentMeasure.left;
1182
+ result.y = globalCoordinates.y - this._cachedParentMeasure.top;
1183
+ return result;
1184
+ }
1185
+ /**
1186
+ * Move the current control to a vector3 position projected onto the screen.
1187
+ * @param position defines the target position
1188
+ * @param scene defines the hosting scene
1189
+ */
1190
+ moveToVector3(position, scene) {
1191
+ if (!this._host || this.parent !== this._host._rootContainer) {
1192
+ Tools.Error("Cannot move a control to a vector3 if the control is not at root level");
1193
+ return;
1194
+ }
1195
+ this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
1196
+ this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
1197
+ const globalViewport = this._host._getGlobalViewport();
1198
+ const projectedPosition = Vector3.Project(position, Matrix.IdentityReadOnly, scene.getTransformMatrix(), globalViewport);
1199
+ this._moveToProjectedPosition(projectedPosition);
1200
+ if (projectedPosition.z < 0 || projectedPosition.z > 1) {
1201
+ this.notRenderable = true;
1202
+ return;
1203
+ }
1204
+ this.notRenderable = false;
1205
+ }
1206
+ /**
1207
+ * Will store all controls that have this control as ascendant in a given array
1208
+ * @param results defines the array where to store the descendants
1209
+ * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
1210
+ * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
1211
+ */
1212
+ getDescendantsToRef(results, directDescendantsOnly = false, predicate) {
1213
+ // Do nothing by default
1214
+ }
1215
+ /**
1216
+ * Will return all controls that have this control as ascendant
1217
+ * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
1218
+ * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
1219
+ * @returns all child controls
1220
+ */
1221
+ getDescendants(directDescendantsOnly, predicate) {
1222
+ const results = [];
1223
+ this.getDescendantsToRef(results, directDescendantsOnly, predicate);
1224
+ return results;
1225
+ }
1226
+ /**
1227
+ * Link current control with a target mesh
1228
+ * @param mesh defines the mesh to link with
1229
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#tracking-positions
1230
+ */
1231
+ linkWithMesh(mesh) {
1232
+ if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
1233
+ if (mesh) {
1234
+ Tools.Error("Cannot link a control to a mesh if the control is not at root level");
1235
+ }
1236
+ return;
1237
+ }
1238
+ const index = this._host._linkedControls.indexOf(this);
1239
+ if (index !== -1) {
1240
+ this._linkedMesh = mesh;
1241
+ if (!mesh) {
1242
+ this._host._linkedControls.splice(index, 1);
1243
+ }
1244
+ return;
1245
+ }
1246
+ else if (!mesh) {
1247
+ return;
1248
+ }
1249
+ this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
1250
+ this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
1251
+ this._linkedMesh = mesh;
1252
+ this._host._linkedControls.push(this);
1253
+ }
1254
+ /**
1255
+ * Shorthand function to set the top, right, bottom, and left padding values on the control.
1256
+ * @param { string | number} paddingTop - The value of the top padding.
1257
+ * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
1258
+ * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
1259
+ * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
1260
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
1261
+ */
1262
+ setPadding(paddingTop, paddingRight, paddingBottom, paddingLeft) {
1263
+ const top = paddingTop;
1264
+ const right = paddingRight ?? top;
1265
+ const bottom = paddingBottom ?? top;
1266
+ const left = paddingLeft ?? right;
1267
+ this.paddingTop = top;
1268
+ this.paddingRight = right;
1269
+ this.paddingBottom = bottom;
1270
+ this.paddingLeft = left;
1271
+ }
1272
+ /**
1273
+ * Shorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.
1274
+ * @param { number} paddingTop - The value in pixels of the top padding.
1275
+ * @param { number} paddingRight - The value in pixels of the right padding. If omitted, top is used.
1276
+ * @param { number} paddingBottom - The value in pixels of the bottom padding. If omitted, top is used.
1277
+ * @param { number} paddingLeft - The value in pixels of the left padding. If omitted, right is used.
1278
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
1279
+ */
1280
+ setPaddingInPixels(paddingTop, paddingRight, paddingBottom, paddingLeft) {
1281
+ const top = paddingTop;
1282
+ const right = paddingRight ?? top;
1283
+ const bottom = paddingBottom ?? top;
1284
+ const left = paddingLeft ?? right;
1285
+ this.paddingTopInPixels = top;
1286
+ this.paddingRightInPixels = right;
1287
+ this.paddingBottomInPixels = bottom;
1288
+ this.paddingLeftInPixels = left;
1289
+ }
1290
+ /**
1291
+ * @internal
1292
+ */
1293
+ _moveToProjectedPosition(projectedPosition) {
1294
+ const oldLeft = this._left.getValue(this._host);
1295
+ const oldTop = this._top.getValue(this._host);
1296
+ const parentMeasure = this.parent?._currentMeasure;
1297
+ if (parentMeasure) {
1298
+ this._processMeasures(parentMeasure, this._host.getContext());
1299
+ }
1300
+ let newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
1301
+ let newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
1302
+ if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
1303
+ if (Math.abs(newLeft - oldLeft) < 0.5) {
1304
+ newLeft = oldLeft;
1305
+ }
1306
+ if (Math.abs(newTop - oldTop) < 0.5) {
1307
+ newTop = oldTop;
1308
+ }
1309
+ }
1310
+ if (oldLeft === newLeft && oldTop === newTop) {
1311
+ return;
1312
+ }
1313
+ this.left = newLeft + "px";
1314
+ this.top = newTop + "px";
1315
+ this._left.ignoreAdaptiveScaling = true;
1316
+ this._top.ignoreAdaptiveScaling = true;
1317
+ this._markAsDirty();
1318
+ }
1319
+ /**
1320
+ * @internal
1321
+ */
1322
+ _offsetLeft(offset) {
1323
+ this._isDirty = true;
1324
+ this._currentMeasure.left += offset;
1325
+ }
1326
+ /**
1327
+ * @internal
1328
+ */
1329
+ _offsetTop(offset) {
1330
+ this._isDirty = true;
1331
+ this._currentMeasure.top += offset;
1332
+ }
1333
+ /** @internal */
1334
+ _markMatrixAsDirty() {
1335
+ this._isMatrixDirty = true;
1336
+ this._flagDescendantsAsMatrixDirty();
1337
+ }
1338
+ /** @internal */
1339
+ _flagDescendantsAsMatrixDirty() {
1340
+ // No child
1341
+ }
1342
+ /**
1343
+ * @internal
1344
+ */
1345
+ _intersectsRect(rect, context) {
1346
+ // make sure we are transformed correctly before checking intersections. no-op if nothing is dirty.
1347
+ this._transform(context);
1348
+ if (this._evaluatedMeasure.left >= rect.left + rect.width) {
1349
+ return false;
1350
+ }
1351
+ if (this._evaluatedMeasure.top >= rect.top + rect.height) {
1352
+ return false;
1353
+ }
1354
+ if (this._evaluatedMeasure.left + this._evaluatedMeasure.width <= rect.left) {
1355
+ return false;
1356
+ }
1357
+ if (this._evaluatedMeasure.top + this._evaluatedMeasure.height <= rect.top) {
1358
+ return false;
1359
+ }
1360
+ return true;
1361
+ }
1362
+ /** @internal */
1363
+ _computeAdditionalOffsetX() {
1364
+ return 0;
1365
+ }
1366
+ /** @internal */
1367
+ _computeAdditionalOffsetY() {
1368
+ return 0;
1369
+ }
1370
+ /** @internal */
1371
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1372
+ invalidateRect() {
1373
+ this._transform();
1374
+ if (this.host && this.host.useInvalidateRectOptimization) {
1375
+ // Rotate by transform to get the measure transformed to global space
1376
+ this._currentMeasure.transformToRef(this._transformMatrix, this._tmpMeasureA);
1377
+ // get the boudning box of the current measure and last frames measure in global space and invalidate it
1378
+ // the previous measure is used to properly clear a control that is scaled down
1379
+ Measure.CombineToRef(this._tmpMeasureA, this._prevCurrentMeasureTransformedIntoGlobalSpace, this._tmpMeasureA);
1380
+ // Expand rect based on shadows
1381
+ const shadowOffsetX = this.shadowOffsetX;
1382
+ const shadowOffsetY = this.shadowOffsetY;
1383
+ const shadowBlur = Math.max(this._previousShadowBlur, this.shadowBlur);
1384
+ const leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
1385
+ const rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
1386
+ const topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
1387
+ const bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
1388
+ const offsetX = this._computeAdditionalOffsetX();
1389
+ const offsetY = this._computeAdditionalOffsetY();
1390
+ this.host.invalidateRect(Math.floor(this._tmpMeasureA.left + leftShadowOffset - offsetX), Math.floor(this._tmpMeasureA.top + topShadowOffset - offsetY), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width + rightShadowOffset + offsetX), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height + bottomShadowOffset + offsetY));
1391
+ }
1392
+ }
1393
+ /**
1394
+ * @internal
1395
+ */
1396
+ _markAsDirty(force = false) {
1397
+ if (!this._isVisible && !force) {
1398
+ return;
1399
+ }
1400
+ this._isDirty = true;
1401
+ this._markMatrixAsDirty();
1402
+ // Redraw only this rectangle
1403
+ if (this._host) {
1404
+ this._host.markAsDirty();
1405
+ }
1406
+ }
1407
+ /** @internal */
1408
+ _markAllAsDirty() {
1409
+ this._markAsDirty();
1410
+ if (this._font) {
1411
+ this._prepareFont();
1412
+ }
1413
+ }
1414
+ /**
1415
+ * @internal
1416
+ */
1417
+ _link(host) {
1418
+ this._host = host;
1419
+ if (this._host) {
1420
+ this.uniqueId = this._host.getScene().getUniqueId();
1421
+ }
1422
+ }
1423
+ /**
1424
+ * @internal
1425
+ */
1426
+ _transform(context) {
1427
+ if (!this._isMatrixDirty && this._scaleX === 1 && this._scaleY === 1 && this._rotation === 0) {
1428
+ return;
1429
+ }
1430
+ // postTranslate
1431
+ const offsetX = this._currentMeasure.width * this._transformCenterX + this._currentMeasure.left;
1432
+ const offsetY = this._currentMeasure.height * this._transformCenterY + this._currentMeasure.top;
1433
+ if (context) {
1434
+ context.translate(offsetX, offsetY);
1435
+ // rotate
1436
+ context.rotate(this._rotation);
1437
+ // scale
1438
+ context.scale(this._scaleX, this._scaleY);
1439
+ // preTranslate
1440
+ context.translate(-offsetX, -offsetY);
1441
+ }
1442
+ // Need to update matrices?
1443
+ if (this._isMatrixDirty || this._cachedOffsetX !== offsetX || this._cachedOffsetY !== offsetY) {
1444
+ this._cachedOffsetX = offsetX;
1445
+ this._cachedOffsetY = offsetY;
1446
+ this._isMatrixDirty = false;
1447
+ this._flagDescendantsAsMatrixDirty();
1448
+ Matrix2D.ComposeToRef(-offsetX, -offsetY, this._rotation, this._scaleX, this._scaleY, this.parent ? this.parent._transformMatrix : null, this._transformMatrix);
1449
+ this._transformMatrix.invertToRef(this._invertTransformMatrix);
1450
+ this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
1451
+ }
1452
+ }
1453
+ /**
1454
+ * @internal
1455
+ */
1456
+ _renderHighlight(context) {
1457
+ if (!this.isHighlighted) {
1458
+ return;
1459
+ }
1460
+ context.save();
1461
+ context.strokeStyle = this._highlightColor;
1462
+ context.lineWidth = this._highlightLineWidth;
1463
+ this._renderHighlightSpecific(context);
1464
+ context.restore();
1465
+ }
1466
+ /**
1467
+ * @internal
1468
+ */
1469
+ _renderHighlightSpecific(context) {
1470
+ context.strokeRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
1471
+ }
1472
+ _getColor(context) {
1473
+ return this.gradient ? this.gradient.getCanvasGradient(context) : this.color;
1474
+ }
1475
+ /**
1476
+ * @internal
1477
+ */
1478
+ _applyStates(context) {
1479
+ if (this._isFontSizeInPercentage) {
1480
+ this._fontSet = true;
1481
+ }
1482
+ if (this._host && this._host.useSmallestIdeal && !this._font) {
1483
+ this._fontSet = true;
1484
+ }
1485
+ if (this._fontSet) {
1486
+ this._prepareFont();
1487
+ this._fontSet = false;
1488
+ }
1489
+ if (this._font) {
1490
+ context.font = this._font;
1491
+ }
1492
+ if (this._color || this.gradient) {
1493
+ context.fillStyle = this._getColor(context);
1494
+ }
1495
+ if (Control.AllowAlphaInheritance) {
1496
+ context.globalAlpha *= this._alpha;
1497
+ }
1498
+ else if (this._alphaSet) {
1499
+ context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
1500
+ }
1501
+ }
1502
+ /**
1503
+ * @internal
1504
+ */
1505
+ _layout(parentMeasure, context) {
1506
+ if (!this.isDirty && (!this.isVisible || this.notRenderable)) {
1507
+ return false;
1508
+ }
1509
+ if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
1510
+ this.host._numLayoutCalls++;
1511
+ this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this._paddingLeftInPixels | 0, -this._paddingTopInPixels | 0, this._paddingRightInPixels | 0, this._paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
1512
+ context.save();
1513
+ let rebuildCount = 0;
1514
+ do {
1515
+ this._rebuildLayout = false;
1516
+ this._processMeasures(parentMeasure, context);
1517
+ rebuildCount++;
1518
+ } while (this._rebuildLayout && rebuildCount < 4);
1519
+ if (rebuildCount >= 4) {
1520
+ Logger.Error(`Layout cycle detected in GUI (Control name=${this.name}, uniqueId=${this.uniqueId})`);
1521
+ }
1522
+ context.restore();
1523
+ this.invalidateRect();
1524
+ this._evaluateClippingState(parentMeasure);
1525
+ }
1526
+ this._wasDirty = this._isDirty;
1527
+ this._isDirty = false;
1528
+ return true;
1529
+ }
1530
+ /**
1531
+ * @internal
1532
+ */
1533
+ _processMeasures(parentMeasure, context) {
1534
+ // Ensure we always apply states before measuring
1535
+ this._applyStates(context);
1536
+ this._tempPaddingMeasure.copyFrom(parentMeasure);
1537
+ // Apply padding if in correct mode
1538
+ if (this.parent && this.parent.descendantsOnlyPadding) {
1539
+ this._tempPaddingMeasure.left += this.parent.paddingLeftInPixels;
1540
+ this._tempPaddingMeasure.top += this.parent.paddingTopInPixels;
1541
+ this._tempPaddingMeasure.width -= this.parent.paddingLeftInPixels + this.parent.paddingRightInPixels;
1542
+ this._tempPaddingMeasure.height -= this.parent.paddingTopInPixels + this.parent.paddingBottomInPixels;
1543
+ }
1544
+ this._currentMeasure.copyFrom(this._tempPaddingMeasure);
1545
+ // Let children take some pre-measurement actions
1546
+ this._preMeasure(this._tempPaddingMeasure, context);
1547
+ this._measure();
1548
+ // Let children take some post-measurement actions
1549
+ this._postMeasure(this._tempPaddingMeasure, context);
1550
+ this._computeAlignment(this._tempPaddingMeasure, context);
1551
+ // Convert to int values
1552
+ this._currentMeasure.left = this._currentMeasure.left | 0;
1553
+ this._currentMeasure.top = this._currentMeasure.top | 0;
1554
+ this._currentMeasure.width = this._currentMeasure.width | 0;
1555
+ this._currentMeasure.height = this._currentMeasure.height | 0;
1556
+ // Let children add more features
1557
+ this._additionalProcessing(this._tempPaddingMeasure, context);
1558
+ this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure);
1559
+ this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
1560
+ if (this.onDirtyObservable.hasObservers()) {
1561
+ this.onDirtyObservable.notifyObservers(this);
1562
+ }
1563
+ }
1564
+ _evaluateClippingState(parentMeasure) {
1565
+ // Since transformMatrix is used here, we need to have it freshly computed
1566
+ this._transform();
1567
+ this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
1568
+ if (this.parent && this.parent.clipChildren) {
1569
+ parentMeasure.transformToRef(this.parent._transformMatrix, this._evaluatedParentMeasure);
1570
+ // Early clip
1571
+ if (this._evaluatedMeasure.left > this._evaluatedParentMeasure.left + this._evaluatedParentMeasure.width) {
1572
+ this._isClipped = true;
1573
+ return;
1574
+ }
1575
+ if (this._evaluatedMeasure.left + this._evaluatedMeasure.width < this._evaluatedParentMeasure.left) {
1576
+ this._isClipped = true;
1577
+ return;
1578
+ }
1579
+ if (this._evaluatedMeasure.top > this._evaluatedParentMeasure.top + this._evaluatedParentMeasure.height) {
1580
+ this._isClipped = true;
1581
+ return;
1582
+ }
1583
+ if (this._evaluatedMeasure.top + this._evaluatedMeasure.height < this._evaluatedParentMeasure.top) {
1584
+ this._isClipped = true;
1585
+ return;
1586
+ }
1587
+ }
1588
+ this._isClipped = false;
1589
+ }
1590
+ /** @internal */
1591
+ _measure() {
1592
+ // Width / Height
1593
+ if (this._width.isPixel) {
1594
+ this._currentMeasure.width = this._width.getValue(this._host);
1595
+ }
1596
+ else {
1597
+ this._currentMeasure.width *= this._width.getValue(this._host);
1598
+ }
1599
+ if (this._height.isPixel) {
1600
+ this._currentMeasure.height = this._height.getValue(this._host);
1601
+ }
1602
+ else {
1603
+ this._currentMeasure.height *= this._height.getValue(this._host);
1604
+ }
1605
+ if (this._fixedRatio !== 0) {
1606
+ if (this._fixedRatioMasterIsWidth) {
1607
+ this._currentMeasure.height = this._currentMeasure.width * this._fixedRatio;
1608
+ }
1609
+ else {
1610
+ this._currentMeasure.width = this._currentMeasure.height * this._fixedRatio;
1611
+ }
1612
+ }
1613
+ }
1614
+ /**
1615
+ * @internal
1616
+ */
1617
+ _computeAlignment(parentMeasure, context) {
1618
+ const width = this._currentMeasure.width;
1619
+ const height = this._currentMeasure.height;
1620
+ const parentWidth = parentMeasure.width;
1621
+ const parentHeight = parentMeasure.height;
1622
+ // Left / top
1623
+ let x = 0;
1624
+ let y = 0;
1625
+ switch (this.horizontalAlignment) {
1626
+ case Control.HORIZONTAL_ALIGNMENT_LEFT:
1627
+ x = 0;
1628
+ break;
1629
+ case Control.HORIZONTAL_ALIGNMENT_RIGHT:
1630
+ x = parentWidth - width;
1631
+ break;
1632
+ case Control.HORIZONTAL_ALIGNMENT_CENTER:
1633
+ x = (parentWidth - width) / 2;
1634
+ break;
1635
+ }
1636
+ switch (this.verticalAlignment) {
1637
+ case Control.VERTICAL_ALIGNMENT_TOP:
1638
+ y = 0;
1639
+ break;
1640
+ case Control.VERTICAL_ALIGNMENT_BOTTOM:
1641
+ y = parentHeight - height;
1642
+ break;
1643
+ case Control.VERTICAL_ALIGNMENT_CENTER:
1644
+ y = (parentHeight - height) / 2;
1645
+ break;
1646
+ }
1647
+ if (!this.descendantsOnlyPadding) {
1648
+ if (this._paddingLeft.isPixel) {
1649
+ this._currentMeasure.left += this._paddingLeft.getValue(this._host);
1650
+ this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
1651
+ }
1652
+ else {
1653
+ this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
1654
+ this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
1655
+ }
1656
+ if (this._paddingRight.isPixel) {
1657
+ this._currentMeasure.width -= this._paddingRight.getValue(this._host);
1658
+ }
1659
+ else {
1660
+ this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
1661
+ }
1662
+ if (this._paddingTop.isPixel) {
1663
+ this._currentMeasure.top += this._paddingTop.getValue(this._host);
1664
+ this._currentMeasure.height -= this._paddingTop.getValue(this._host);
1665
+ }
1666
+ else {
1667
+ this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
1668
+ this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
1669
+ }
1670
+ if (this._paddingBottom.isPixel) {
1671
+ this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
1672
+ }
1673
+ else {
1674
+ this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
1675
+ }
1676
+ }
1677
+ if (this._left.isPixel) {
1678
+ this._currentMeasure.left += this._left.getValue(this._host);
1679
+ }
1680
+ else {
1681
+ this._currentMeasure.left += parentWidth * this._left.getValue(this._host);
1682
+ }
1683
+ if (this._top.isPixel) {
1684
+ this._currentMeasure.top += this._top.getValue(this._host);
1685
+ }
1686
+ else {
1687
+ this._currentMeasure.top += parentHeight * this._top.getValue(this._host);
1688
+ }
1689
+ this._currentMeasure.left += x;
1690
+ this._currentMeasure.top += y;
1691
+ }
1692
+ /**
1693
+ * @internal
1694
+ */
1695
+ _preMeasure(parentMeasure, context) {
1696
+ // Do nothing
1697
+ }
1698
+ /**
1699
+ * @internal
1700
+ */
1701
+ _postMeasure(parentMeasure, context) {
1702
+ // Do nothing
1703
+ }
1704
+ /**
1705
+ * @internal
1706
+ */
1707
+ _additionalProcessing(parentMeasure, context) {
1708
+ // Do nothing
1709
+ }
1710
+ /**
1711
+ * @internal
1712
+ */
1713
+ _clipForChildren(context) {
1714
+ // DO nothing
1715
+ }
1716
+ _clip(context, invalidatedRectangle) {
1717
+ context.beginPath();
1718
+ Control._ClipMeasure.copyFrom(this._currentMeasure);
1719
+ if (invalidatedRectangle) {
1720
+ // Rotate the invalidated rect into the control's space
1721
+ invalidatedRectangle.transformToRef(this._invertTransformMatrix, this._tmpMeasureA);
1722
+ // Get the intersection of the rect in context space and the current context
1723
+ const intersection = new Measure(0, 0, 0, 0);
1724
+ intersection.left = Math.max(this._tmpMeasureA.left, this._currentMeasure.left);
1725
+ intersection.top = Math.max(this._tmpMeasureA.top, this._currentMeasure.top);
1726
+ intersection.width = Math.min(this._tmpMeasureA.left + this._tmpMeasureA.width, this._currentMeasure.left + this._currentMeasure.width) - intersection.left;
1727
+ intersection.height = Math.min(this._tmpMeasureA.top + this._tmpMeasureA.height, this._currentMeasure.top + this._currentMeasure.height) - intersection.top;
1728
+ Control._ClipMeasure.copyFrom(intersection);
1729
+ }
1730
+ if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
1731
+ const shadowOffsetX = this.shadowOffsetX;
1732
+ const shadowOffsetY = this.shadowOffsetY;
1733
+ const shadowBlur = this.shadowBlur;
1734
+ const leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
1735
+ const rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
1736
+ const topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
1737
+ const bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
1738
+ context.rect(Control._ClipMeasure.left + leftShadowOffset, Control._ClipMeasure.top + topShadowOffset, Control._ClipMeasure.width + rightShadowOffset - leftShadowOffset, Control._ClipMeasure.height + bottomShadowOffset - topShadowOffset);
1739
+ }
1740
+ else {
1741
+ context.rect(Control._ClipMeasure.left, Control._ClipMeasure.top, Control._ClipMeasure.width, Control._ClipMeasure.height);
1742
+ }
1743
+ context.clip();
1744
+ }
1745
+ /**
1746
+ * @internal
1747
+ */
1748
+ _render(context, invalidatedRectangle) {
1749
+ if (!this.isVisible || this.notRenderable || this._isClipped) {
1750
+ this._isDirty = false;
1751
+ return false;
1752
+ }
1753
+ this.host._numRenderCalls++;
1754
+ context.save();
1755
+ this._applyStates(context);
1756
+ // Transform
1757
+ this._transform(context);
1758
+ // Clip
1759
+ if (this.clipContent) {
1760
+ this._clip(context, invalidatedRectangle);
1761
+ }
1762
+ if (this.onBeforeDrawObservable.hasObservers()) {
1763
+ this.onBeforeDrawObservable.notifyObservers(this);
1764
+ }
1765
+ if (this.useBitmapCache && !this._wasDirty && this._cacheData) {
1766
+ context.putImageData(this._cacheData, this._currentMeasure.left, this._currentMeasure.top);
1767
+ }
1768
+ else {
1769
+ this._draw(context, invalidatedRectangle);
1770
+ }
1771
+ if (this.useBitmapCache && this._wasDirty) {
1772
+ this._cacheData = context.getImageData(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
1773
+ }
1774
+ this._renderHighlight(context);
1775
+ if (this.onAfterDrawObservable.hasObservers()) {
1776
+ this.onAfterDrawObservable.notifyObservers(this);
1777
+ }
1778
+ context.restore();
1779
+ return true;
1780
+ }
1781
+ /**
1782
+ * @internal
1783
+ */
1784
+ _draw(context, invalidatedRectangle) {
1785
+ // Do nothing
1786
+ }
1787
+ /**
1788
+ * Tests if a given coordinates belong to the current control
1789
+ * @param x defines x coordinate to test
1790
+ * @param y defines y coordinate to test
1791
+ * @returns true if the coordinates are inside the control
1792
+ */
1793
+ contains(x, y) {
1794
+ // Invert transform
1795
+ this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);
1796
+ x = this._transformedPosition.x;
1797
+ y = this._transformedPosition.y;
1798
+ // Check
1799
+ if (x < this._currentMeasure.left) {
1800
+ return false;
1801
+ }
1802
+ if (x > this._currentMeasure.left + this._currentMeasure.width) {
1803
+ return false;
1804
+ }
1805
+ if (y < this._currentMeasure.top) {
1806
+ return false;
1807
+ }
1808
+ if (y > this._currentMeasure.top + this._currentMeasure.height) {
1809
+ return false;
1810
+ }
1811
+ if (this.isPointerBlocker) {
1812
+ this._host._shouldBlockPointer = true;
1813
+ }
1814
+ return true;
1815
+ }
1816
+ /**
1817
+ * @internal
1818
+ */
1819
+ _processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {
1820
+ if (!this._isEnabled) {
1821
+ return false;
1822
+ }
1823
+ if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {
1824
+ return false;
1825
+ }
1826
+ if (!this.contains(x, y)) {
1827
+ return false;
1828
+ }
1829
+ this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);
1830
+ return true;
1831
+ }
1832
+ /**
1833
+ * @internal
1834
+ */
1835
+ _onPointerMove(target, coordinates, pointerId, pi) {
1836
+ const canNotify = this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this, pi);
1837
+ if (canNotify && this.parent != null && !this.isPointerBlocker) {
1838
+ this.parent._onPointerMove(target, coordinates, pointerId, pi);
1839
+ }
1840
+ }
1841
+ /**
1842
+ * @internal
1843
+ */
1844
+ _onPointerEnter(target, pi) {
1845
+ if (!this._isEnabled) {
1846
+ return false;
1847
+ }
1848
+ if (this._enterCount > 0) {
1849
+ return false;
1850
+ }
1851
+ if (this._enterCount === -1) {
1852
+ // -1 is for touch input, we are now sure we are with a mouse or pencil
1853
+ this._enterCount = 0;
1854
+ }
1855
+ this._enterCount++;
1856
+ const canNotify = this.onPointerEnterObservable.notifyObservers(this, -1, target, this, pi);
1857
+ if (canNotify && this.parent != null && !this.isPointerBlocker) {
1858
+ this.parent._onPointerEnter(target, pi);
1859
+ }
1860
+ return true;
1861
+ }
1862
+ /**
1863
+ * @internal
1864
+ */
1865
+ _onPointerOut(target, pi, force = false) {
1866
+ if (!force && !this._isEnabled) {
1867
+ return;
1868
+ }
1869
+ this._enterCount = 0;
1870
+ let canNotify = true;
1871
+ if (!target.isAscendant(this)) {
1872
+ canNotify = this.onPointerOutObservable.notifyObservers(this, -1, target, this, pi);
1873
+ }
1874
+ if (canNotify && this.parent != null && !this.isPointerBlocker) {
1875
+ this.parent._onPointerOut(target, pi, force);
1876
+ }
1877
+ }
1878
+ /**
1879
+ * @internal
1880
+ */
1881
+ _onPointerDown(target, coordinates, pointerId, buttonIndex, pi) {
1882
+ // Prevent pointerout to lose control context.
1883
+ // Event redundancy is checked inside the function.
1884
+ this._onPointerEnter(this, pi);
1885
+ if (this.tabIndex !== -1) {
1886
+ this.host.focusedControl = this;
1887
+ }
1888
+ if (this._downCount !== 0) {
1889
+ return false;
1890
+ }
1891
+ this._downCount++;
1892
+ this._downPointerIds[pointerId] = true;
1893
+ const canNotify = this.onPointerDownObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1894
+ if (canNotify && this.parent != null && !this.isPointerBlocker) {
1895
+ this.parent._onPointerDown(target, coordinates, pointerId, buttonIndex, pi);
1896
+ }
1897
+ if (pi && this.uniqueId !== this._host.rootContainer.uniqueId) {
1898
+ this._host._capturedPointerIds.add(pi.event.pointerId);
1899
+ }
1900
+ return true;
1901
+ }
1902
+ /**
1903
+ * @internal
1904
+ */
1905
+ _onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick, pi) {
1906
+ if (!this._isEnabled) {
1907
+ return;
1908
+ }
1909
+ this._downCount = 0;
1910
+ delete this._downPointerIds[pointerId];
1911
+ let canNotifyClick = notifyClick;
1912
+ if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {
1913
+ if (!this._host.usePointerTapForClickEvent) {
1914
+ canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1915
+ }
1916
+ }
1917
+ const canNotify = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1918
+ if (canNotify && this.parent != null && !this.isPointerBlocker) {
1919
+ this.parent._onPointerUp(target, coordinates, pointerId, buttonIndex, canNotifyClick, pi);
1920
+ }
1921
+ if (pi && this.uniqueId !== this._host.rootContainer.uniqueId) {
1922
+ this._host._capturedPointerIds.delete(pi.event.pointerId);
1923
+ }
1924
+ if (this._host.usePointerTapForClickEvent && this.isPointerBlocker) {
1925
+ this._host._shouldBlockPointer = false;
1926
+ }
1927
+ }
1928
+ _onPointerPick(target, coordinates, pointerId, buttonIndex, notifyClick, pi) {
1929
+ if (!this._host.usePointerTapForClickEvent) {
1930
+ return false;
1931
+ }
1932
+ let canNotifyClick = notifyClick;
1933
+ if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {
1934
+ canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1935
+ }
1936
+ const canNotify = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1937
+ if (canNotify && this.parent != null && !this.isPointerBlocker) {
1938
+ this.parent._onPointerPick(target, coordinates, pointerId, buttonIndex, canNotifyClick, pi);
1939
+ }
1940
+ if (this._host.usePointerTapForClickEvent && this.isPointerBlocker) {
1941
+ this._host._shouldBlockPointer = true;
1942
+ }
1943
+ return true;
1944
+ }
1945
+ /**
1946
+ * @internal
1947
+ */
1948
+ _forcePointerUp(pointerId = null) {
1949
+ if (pointerId !== null) {
1950
+ this._onPointerUp(this, Vector2.Zero(), pointerId, 0, true);
1951
+ }
1952
+ else {
1953
+ for (const key in this._downPointerIds) {
1954
+ this._onPointerUp(this, Vector2.Zero(), +key, 0, true);
1955
+ }
1956
+ }
1957
+ }
1958
+ /**
1959
+ * @internal
1960
+ */
1961
+ _onWheelScroll(deltaX, deltaY) {
1962
+ if (!this._isEnabled) {
1963
+ return;
1964
+ }
1965
+ const canNotify = this.onWheelObservable.notifyObservers(new Vector2(deltaX, deltaY));
1966
+ if (canNotify && this.parent != null) {
1967
+ this.parent._onWheelScroll(deltaX, deltaY);
1968
+ }
1969
+ }
1970
+ /** @internal */
1971
+ _onCanvasBlur() { }
1972
+ /**
1973
+ * @internal
1974
+ */
1975
+ _processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY) {
1976
+ if (!this._isEnabled) {
1977
+ return false;
1978
+ }
1979
+ this._dummyVector2.copyFromFloats(x, y);
1980
+ if (type === PointerEventTypes.POINTERMOVE) {
1981
+ this._onPointerMove(this, this._dummyVector2, pointerId, pi);
1982
+ const previousControlOver = this._host._lastControlOver[pointerId];
1983
+ if (previousControlOver && previousControlOver !== this) {
1984
+ previousControlOver._onPointerOut(this, pi);
1985
+ }
1986
+ if (previousControlOver !== this) {
1987
+ this._onPointerEnter(this, pi);
1988
+ }
1989
+ this._host._lastControlOver[pointerId] = this;
1990
+ return true;
1991
+ }
1992
+ else if (type === PointerEventTypes.POINTERDOWN) {
1993
+ this._onPointerDown(this, this._dummyVector2, pointerId, buttonIndex, pi);
1994
+ this._host._registerLastControlDown(this, pointerId);
1995
+ this._host._lastPickedControl = this;
1996
+ return true;
1997
+ }
1998
+ else if (type === PointerEventTypes.POINTERUP) {
1999
+ if (this._host._lastControlDown[pointerId]) {
2000
+ this._host._lastControlDown[pointerId]._onPointerUp(this, this._dummyVector2, pointerId, buttonIndex, true, pi);
2001
+ }
2002
+ if (!this._host.usePointerTapForClickEvent) {
2003
+ delete this._host._lastControlDown[pointerId];
2004
+ }
2005
+ return true;
2006
+ }
2007
+ else if (type === PointerEventTypes.POINTERWHEEL) {
2008
+ if (this._host._lastControlOver[pointerId]) {
2009
+ this._host._lastControlOver[pointerId]._onWheelScroll(deltaX, deltaY);
2010
+ return true;
2011
+ }
2012
+ }
2013
+ else if (type === PointerEventTypes.POINTERTAP) {
2014
+ if (this._host._lastControlDown[pointerId]) {
2015
+ this._host._lastControlDown[pointerId]._onPointerPick(this, this._dummyVector2, pointerId, buttonIndex, true, pi);
2016
+ }
2017
+ delete this._host._lastControlDown[pointerId];
2018
+ return true;
2019
+ }
2020
+ return false;
2021
+ }
2022
+ _getStyleProperty(propName, defaultValue) {
2023
+ const prop = (this._style && this._style[propName]) ?? this[propName];
2024
+ if (!prop && this.parent) {
2025
+ return this.parent._getStyleProperty(propName, defaultValue);
2026
+ }
2027
+ else if (!this.parent) {
2028
+ return defaultValue;
2029
+ }
2030
+ else {
2031
+ return prop;
2032
+ }
2033
+ }
2034
+ _prepareFont() {
2035
+ if (!this._font && !this._fontSet) {
2036
+ return;
2037
+ }
2038
+ this._font =
2039
+ this._getStyleProperty("fontStyle", "") +
2040
+ " " +
2041
+ this._getStyleProperty("fontWeight", "") +
2042
+ " " +
2043
+ this.fontSizeInPixels +
2044
+ "px " +
2045
+ this._getStyleProperty("fontFamily", "Arial");
2046
+ this._fontOffset = Control._GetFontOffset(this._font, this._host?.getScene()?.getEngine());
2047
+ //children need to be refreshed
2048
+ const descendants = this.getDescendants();
2049
+ for (const child of descendants) {
2050
+ child._markAllAsDirty();
2051
+ }
2052
+ }
2053
+ /**
2054
+ * A control has a dimension fully defined if that dimension doesn't depend on the parent's dimension.
2055
+ * As an example, a control that has dimensions in pixels is fully defined, while in percentage is not fully defined.
2056
+ * @param dim the dimension to check (width or height)
2057
+ * @returns if the dimension is fully defined
2058
+ */
2059
+ isDimensionFullyDefined(dim) {
2060
+ return this.getDimension(dim).isPixel;
2061
+ }
2062
+ /**
2063
+ * Gets the dimension of the control along a specified axis
2064
+ * @param dim the dimension to retrieve (width or height)
2065
+ * @returns the dimension value along the specified axis
2066
+ */
2067
+ getDimension(dim) {
2068
+ if (dim === "width") {
2069
+ return this._width;
2070
+ }
2071
+ else {
2072
+ return this._height;
2073
+ }
2074
+ }
2075
+ /**
2076
+ * Clones a control and its descendants
2077
+ * @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
2078
+ * @returns the cloned control
2079
+ */
2080
+ clone(host) {
2081
+ const serialization = {};
2082
+ this.serialize(serialization, true);
2083
+ const controlType = Tools.Instantiate("BABYLON.GUI." + serialization.className);
2084
+ const cloned = new controlType();
2085
+ cloned.parse(serialization, host);
2086
+ return cloned;
2087
+ }
2088
+ /**
2089
+ * Parses a serialized object into this control
2090
+ * @param serializedObject the object with the serialized properties
2091
+ * @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
2092
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
2093
+ * @returns this control
2094
+ */
2095
+ parse(serializedObject, host, urlRewriter) {
2096
+ this._urlRewriter = urlRewriter;
2097
+ SerializationHelper.Parse(() => this, serializedObject, null);
2098
+ this.name = serializedObject.name;
2099
+ this._parseFromContent(serializedObject, host ?? this._host);
2100
+ return this;
2101
+ }
2102
+ /**
2103
+ * Serializes the current control
2104
+ * @param serializationObject defined the JSON serialized object
2105
+ * @param force if the control should be serialized even if the isSerializable flag is set to false (default false)
2106
+ * @param allowCanvas defines if the control is allowed to use a Canvas2D object to serialize (true by default)
2107
+ */
2108
+ serialize(serializationObject, force = false, allowCanvas = true) {
2109
+ if (!this.isSerializable && !force) {
2110
+ return;
2111
+ }
2112
+ let idealWidth = 0;
2113
+ let idealHeight = 0;
2114
+ // the host's ideal width and height are influencing the serialization, as they are used in getValue() of ValueAndUnit.
2115
+ // for a proper serialization, we need to temporarily set them to 0 and re-set them back afterwards.
2116
+ if (this.host) {
2117
+ idealHeight = this.host.idealHeight;
2118
+ idealWidth = this.host.idealWidth;
2119
+ this.host.idealWidth = 0;
2120
+ this.host.idealHeight = 0;
2121
+ }
2122
+ SerializationHelper.Serialize(this, serializationObject);
2123
+ serializationObject.name = this.name;
2124
+ serializationObject.className = this.getClassName();
2125
+ // Call prepareFont to guarantee the font is properly set before serializing
2126
+ if (allowCanvas) {
2127
+ this._prepareFont();
2128
+ }
2129
+ if (this._fontFamily) {
2130
+ serializationObject.fontFamily = this._fontFamily;
2131
+ }
2132
+ if (this.fontSize) {
2133
+ serializationObject.fontSize = this.fontSize;
2134
+ }
2135
+ if (this.fontWeight) {
2136
+ serializationObject.fontWeight = this.fontWeight;
2137
+ }
2138
+ if (this.fontStyle) {
2139
+ serializationObject.fontStyle = this.fontStyle;
2140
+ }
2141
+ if (this._gradient) {
2142
+ serializationObject.gradient = {};
2143
+ this._gradient.serialize(serializationObject.gradient);
2144
+ }
2145
+ // Animations
2146
+ SerializationHelper.AppendSerializedAnimations(this, serializationObject);
2147
+ // re-set the ideal width and height
2148
+ if (this.host) {
2149
+ this.host.idealWidth = idealWidth;
2150
+ this.host.idealHeight = idealHeight;
2151
+ }
2152
+ }
2153
+ /**
2154
+ * @internal
2155
+ */
2156
+ _parseFromContent(serializedObject, host, urlRewriter) {
2157
+ if (serializedObject.fontFamily) {
2158
+ this.fontFamily = serializedObject.fontFamily;
2159
+ }
2160
+ if (serializedObject.fontSize) {
2161
+ this.fontSize = serializedObject.fontSize;
2162
+ }
2163
+ if (serializedObject.fontWeight) {
2164
+ this.fontWeight = serializedObject.fontWeight;
2165
+ }
2166
+ if (serializedObject.fontStyle) {
2167
+ this.fontStyle = serializedObject.fontStyle;
2168
+ }
2169
+ // Gradient
2170
+ if (serializedObject.gradient) {
2171
+ const className = Tools.Instantiate("BABYLON.GUI." + serializedObject.gradient.className);
2172
+ this._gradient = new className();
2173
+ this._gradient?.parse(serializedObject.gradient);
2174
+ }
2175
+ // Animations
2176
+ if (serializedObject.animations) {
2177
+ this.animations = [];
2178
+ for (let animationIndex = 0; animationIndex < serializedObject.animations.length; animationIndex++) {
2179
+ const parsedAnimation = serializedObject.animations[animationIndex];
2180
+ const internalClass = GetClass("BABYLON.Animation");
2181
+ if (internalClass) {
2182
+ this.animations.push(internalClass.Parse(parsedAnimation));
2183
+ }
2184
+ }
2185
+ if (serializedObject.autoAnimate && this._host && this._host.getScene()) {
2186
+ this._host
2187
+ .getScene()
2188
+ .beginAnimation(this, serializedObject.autoAnimateFrom, serializedObject.autoAnimateTo, serializedObject.autoAnimateLoop, serializedObject.autoAnimateSpeed || 1.0);
2189
+ }
2190
+ }
2191
+ this.fixedRatioMasterIsWidth = serializedObject.fixedRatioMasterIsWidth ?? this.fixedRatioMasterIsWidth;
2192
+ }
2193
+ /** Releases associated resources */
2194
+ dispose() {
2195
+ this.onDirtyObservable.clear();
2196
+ this.onBeforeDrawObservable.clear();
2197
+ this.onAfterDrawObservable.clear();
2198
+ this.onPointerDownObservable.clear();
2199
+ this.onPointerEnterObservable.clear();
2200
+ this.onPointerMoveObservable.clear();
2201
+ this.onPointerOutObservable.clear();
2202
+ this.onPointerUpObservable.clear();
2203
+ this.onPointerClickObservable.clear();
2204
+ this.onWheelObservable.clear();
2205
+ // focus
2206
+ this.onBlurObservable.clear();
2207
+ this.onFocusObservable.clear();
2208
+ this.onKeyboardEventProcessedObservable.clear();
2209
+ if (this._styleObserver && this._style) {
2210
+ this._style.onChangedObservable.remove(this._styleObserver);
2211
+ this._styleObserver = null;
2212
+ }
2213
+ if (this.parent) {
2214
+ this.parent.removeControl(this);
2215
+ this.parent = null;
2216
+ }
2217
+ if (this._host) {
2218
+ const index = this._host._linkedControls.indexOf(this);
2219
+ if (index > -1) {
2220
+ this.linkWithMesh(null);
2221
+ }
2222
+ }
2223
+ // Callback
2224
+ this.onDisposeObservable.notifyObservers(this);
2225
+ this.onDisposeObservable.clear();
2226
+ }
2227
+ /** HORIZONTAL_ALIGNMENT_LEFT */
2228
+ static get HORIZONTAL_ALIGNMENT_LEFT() {
2229
+ return Control._HORIZONTAL_ALIGNMENT_LEFT;
2230
+ }
2231
+ /** HORIZONTAL_ALIGNMENT_RIGHT */
2232
+ static get HORIZONTAL_ALIGNMENT_RIGHT() {
2233
+ return Control._HORIZONTAL_ALIGNMENT_RIGHT;
2234
+ }
2235
+ /** HORIZONTAL_ALIGNMENT_CENTER */
2236
+ static get HORIZONTAL_ALIGNMENT_CENTER() {
2237
+ return Control._HORIZONTAL_ALIGNMENT_CENTER;
2238
+ }
2239
+ /** VERTICAL_ALIGNMENT_TOP */
2240
+ static get VERTICAL_ALIGNMENT_TOP() {
2241
+ return Control._VERTICAL_ALIGNMENT_TOP;
2242
+ }
2243
+ /** VERTICAL_ALIGNMENT_BOTTOM */
2244
+ static get VERTICAL_ALIGNMENT_BOTTOM() {
2245
+ return Control._VERTICAL_ALIGNMENT_BOTTOM;
2246
+ }
2247
+ /** VERTICAL_ALIGNMENT_CENTER */
2248
+ static get VERTICAL_ALIGNMENT_CENTER() {
2249
+ return Control._VERTICAL_ALIGNMENT_CENTER;
2250
+ }
2251
+ /**
2252
+ * @internal
2253
+ */
2254
+ static _GetFontOffset(font, engineToUse) {
2255
+ if (Control._FontHeightSizes[font]) {
2256
+ return Control._FontHeightSizes[font];
2257
+ }
2258
+ const engine = engineToUse || EngineStore.LastCreatedEngine;
2259
+ if (!engine) {
2260
+ throw new Error("Invalid engine. Unable to create a canvas.");
2261
+ }
2262
+ const result = engine.getFontOffset(font);
2263
+ Control._FontHeightSizes[font] = result;
2264
+ return result;
2265
+ }
2266
+ /**
2267
+ * Creates a Control from parsed data
2268
+ * @param serializedObject defines parsed data
2269
+ * @param host defines the hosting AdvancedDynamicTexture
2270
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
2271
+ * @returns a new Control
2272
+ */
2273
+ static Parse(serializedObject, host, urlRewriter) {
2274
+ const controlType = Tools.Instantiate("BABYLON.GUI." + serializedObject.className);
2275
+ const control = SerializationHelper.Parse(() => {
2276
+ const newControl = new controlType();
2277
+ newControl._urlRewriter = urlRewriter;
2278
+ return newControl;
2279
+ }, serializedObject, null);
2280
+ control.name = serializedObject.name;
2281
+ control._parseFromContent(serializedObject, host, urlRewriter);
2282
+ return control;
2283
+ }
2284
+ /**
2285
+ * @internal
2286
+ */
2287
+ static drawEllipse(x, y, width, height, arc, context) {
2288
+ context.translate(x, y);
2289
+ context.scale(width, height);
2290
+ context.beginPath();
2291
+ context.arc(0, 0, 1, 0, 2 * Math.PI * arc, arc < 0);
2292
+ if (arc >= 1) {
2293
+ context.closePath();
2294
+ }
2295
+ context.scale(1 / width, 1 / height);
2296
+ context.translate(-x, -y);
2297
+ }
2298
+ /**
2299
+ * Returns true if the control is ready to be used
2300
+ * @returns
2301
+ */
2302
+ isReady() {
2303
+ // Most controls are ready by default, so the default implementation is to return true
2304
+ return true;
2305
+ }
2306
+ }
2307
+ /**
2308
+ * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
2309
+ */
2310
+ Control.AllowAlphaInheritance = false;
2311
+ Control._ClipMeasure = new Measure(0, 0, 0, 0);
2312
+ // Statics
2313
+ Control._HORIZONTAL_ALIGNMENT_LEFT = 0;
2314
+ Control._HORIZONTAL_ALIGNMENT_RIGHT = 1;
2315
+ Control._HORIZONTAL_ALIGNMENT_CENTER = 2;
2316
+ Control._VERTICAL_ALIGNMENT_TOP = 0;
2317
+ Control._VERTICAL_ALIGNMENT_BOTTOM = 1;
2318
+ Control._VERTICAL_ALIGNMENT_CENTER = 2;
2319
+ Control._FontHeightSizes = {};
2320
+ Control.AddHeader = () => { };
2321
+ __decorate([
2322
+ serialize()
2323
+ ], Control.prototype, "metadata", void 0);
2324
+ __decorate([
2325
+ serialize()
2326
+ ], Control.prototype, "isHitTestVisible", void 0);
2327
+ __decorate([
2328
+ serialize()
2329
+ ], Control.prototype, "isPointerBlocker", void 0);
2330
+ __decorate([
2331
+ serialize()
2332
+ ], Control.prototype, "isFocusInvisible", void 0);
2333
+ __decorate([
2334
+ serialize()
2335
+ ], Control.prototype, "clipChildren", null);
2336
+ __decorate([
2337
+ serialize()
2338
+ ], Control.prototype, "clipContent", null);
2339
+ __decorate([
2340
+ serialize()
2341
+ ], Control.prototype, "useBitmapCache", void 0);
2342
+ __decorate([
2343
+ serialize()
2344
+ ], Control.prototype, "shadowOffsetX", null);
2345
+ __decorate([
2346
+ serialize()
2347
+ ], Control.prototype, "shadowOffsetY", null);
2348
+ __decorate([
2349
+ serialize()
2350
+ ], Control.prototype, "shadowBlur", null);
2351
+ __decorate([
2352
+ serialize()
2353
+ ], Control.prototype, "shadowColor", null);
2354
+ __decorate([
2355
+ serialize()
2356
+ ], Control.prototype, "hoverCursor", void 0);
2357
+ __decorate([
2358
+ serialize()
2359
+ ], Control.prototype, "fontOffset", null);
2360
+ __decorate([
2361
+ serialize()
2362
+ ], Control.prototype, "alpha", null);
2363
+ __decorate([
2364
+ serialize()
2365
+ ], Control.prototype, "isSerializable", void 0);
2366
+ __decorate([
2367
+ serialize()
2368
+ ], Control.prototype, "scaleX", null);
2369
+ __decorate([
2370
+ serialize()
2371
+ ], Control.prototype, "scaleY", null);
2372
+ __decorate([
2373
+ serialize()
2374
+ ], Control.prototype, "rotation", null);
2375
+ __decorate([
2376
+ serialize()
2377
+ ], Control.prototype, "transformCenterY", null);
2378
+ __decorate([
2379
+ serialize()
2380
+ ], Control.prototype, "transformCenterX", null);
2381
+ __decorate([
2382
+ serialize()
2383
+ ], Control.prototype, "horizontalAlignment", null);
2384
+ __decorate([
2385
+ serialize()
2386
+ ], Control.prototype, "verticalAlignment", null);
2387
+ __decorate([
2388
+ serialize()
2389
+ ], Control.prototype, "fixedRatio", null);
2390
+ __decorate([
2391
+ serialize()
2392
+ ], Control.prototype, "fixedRatioMasterIsWidth", null);
2393
+ __decorate([
2394
+ serialize()
2395
+ ], Control.prototype, "width", null);
2396
+ __decorate([
2397
+ serialize()
2398
+ ], Control.prototype, "height", null);
2399
+ __decorate([
2400
+ serialize()
2401
+ ], Control.prototype, "style", null);
2402
+ __decorate([
2403
+ serialize()
2404
+ ], Control.prototype, "color", null);
2405
+ __decorate([
2406
+ serialize()
2407
+ ], Control.prototype, "gradient", null);
2408
+ __decorate([
2409
+ serialize()
2410
+ ], Control.prototype, "zIndex", null);
2411
+ __decorate([
2412
+ serialize()
2413
+ ], Control.prototype, "notRenderable", null);
2414
+ __decorate([
2415
+ serialize()
2416
+ ], Control.prototype, "isVisible", null);
2417
+ __decorate([
2418
+ serialize()
2419
+ ], Control.prototype, "descendantsOnlyPadding", null);
2420
+ __decorate([
2421
+ serialize()
2422
+ ], Control.prototype, "paddingLeft", null);
2423
+ __decorate([
2424
+ serialize()
2425
+ ], Control.prototype, "paddingRight", null);
2426
+ __decorate([
2427
+ serialize()
2428
+ ], Control.prototype, "paddingTop", null);
2429
+ __decorate([
2430
+ serialize()
2431
+ ], Control.prototype, "paddingBottom", null);
2432
+ __decorate([
2433
+ serialize()
2434
+ ], Control.prototype, "left", null);
2435
+ __decorate([
2436
+ serialize()
2437
+ ], Control.prototype, "top", null);
2438
+ __decorate([
2439
+ serialize()
2440
+ ], Control.prototype, "linkOffsetX", null);
2441
+ __decorate([
2442
+ serialize()
2443
+ ], Control.prototype, "linkOffsetY", null);
2444
+ __decorate([
2445
+ serialize()
2446
+ ], Control.prototype, "isEnabled", null);
2447
+ __decorate([
2448
+ serialize()
2449
+ ], Control.prototype, "disabledColor", null);
2450
+ __decorate([
2451
+ serialize()
2452
+ ], Control.prototype, "disabledColorItem", null);
2453
+ __decorate([
2454
+ serialize()
2455
+ ], Control.prototype, "overlapGroup", void 0);
2456
+ __decorate([
2457
+ serialize()
2458
+ ], Control.prototype, "overlapDeltaMultiplier", void 0);
2459
+ RegisterClass("BABYLON.GUI.Control", Control);
2460
+ //# sourceMappingURL=control.js.map