@babylonjs/gui 5.0.0-alpha.7 → 5.0.0-beta.2

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 (276) hide show
  1. package/2D/adtInstrumentation.js +1 -1
  2. package/2D/advancedDynamicTexture.d.ts +165 -125
  3. package/2D/advancedDynamicTexture.js +342 -181
  4. package/2D/advancedDynamicTexture.js.map +1 -1
  5. package/2D/controls/button.d.ts +8 -0
  6. package/2D/controls/button.js +33 -10
  7. package/2D/controls/button.js.map +1 -1
  8. package/2D/controls/checkbox.d.ts +2 -1
  9. package/2D/controls/checkbox.js +10 -8
  10. package/2D/controls/checkbox.js.map +1 -1
  11. package/2D/controls/colorpicker.d.ts +4 -3
  12. package/2D/controls/colorpicker.js +40 -23
  13. package/2D/controls/colorpicker.js.map +1 -1
  14. package/2D/controls/container.d.ts +16 -5
  15. package/2D/controls/container.js +91 -13
  16. package/2D/controls/container.js.map +1 -1
  17. package/2D/controls/control.d.ts +103 -44
  18. package/2D/controls/control.js +278 -129
  19. package/2D/controls/control.js.map +1 -1
  20. package/2D/controls/displayGrid.d.ts +2 -1
  21. package/2D/controls/displayGrid.js +6 -6
  22. package/2D/controls/displayGrid.js.map +1 -1
  23. package/2D/controls/ellipse.d.ts +5 -3
  24. package/2D/controls/ellipse.js +9 -5
  25. package/2D/controls/ellipse.js.map +1 -1
  26. package/2D/controls/focusableButton.d.ts +1 -0
  27. package/2D/controls/focusableButton.js +9 -6
  28. package/2D/controls/focusableButton.js.map +1 -1
  29. package/2D/controls/grid.d.ts +13 -2
  30. package/2D/controls/grid.js +108 -24
  31. package/2D/controls/grid.js.map +1 -1
  32. package/2D/controls/image.d.ts +5 -4
  33. package/2D/controls/image.js +52 -31
  34. package/2D/controls/image.js.map +1 -1
  35. package/2D/controls/index.js +29 -29
  36. package/2D/controls/inputPassword.js +4 -4
  37. package/2D/controls/inputPassword.js.map +1 -1
  38. package/2D/controls/inputText.d.ts +2 -1
  39. package/2D/controls/inputText.js +40 -14
  40. package/2D/controls/inputText.js.map +1 -1
  41. package/2D/controls/line.d.ts +3 -2
  42. package/2D/controls/line.js +8 -8
  43. package/2D/controls/line.js.map +1 -1
  44. package/2D/controls/multiLine.d.ts +4 -3
  45. package/2D/controls/multiLine.js +6 -6
  46. package/2D/controls/multiLine.js.map +1 -1
  47. package/2D/controls/radioButton.d.ts +2 -1
  48. package/2D/controls/radioButton.js +10 -7
  49. package/2D/controls/radioButton.js.map +1 -1
  50. package/2D/controls/rectangle.d.ts +8 -3
  51. package/2D/controls/rectangle.js +21 -5
  52. package/2D/controls/rectangle.js.map +1 -1
  53. package/2D/controls/scrollViewers/scrollViewer.d.ts +3 -2
  54. package/2D/controls/scrollViewers/scrollViewer.js +9 -9
  55. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
  56. package/2D/controls/scrollViewers/scrollViewerWindow.d.ts +4 -3
  57. package/2D/controls/scrollViewers/scrollViewerWindow.js +4 -4
  58. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  59. package/2D/controls/selector.js +8 -8
  60. package/2D/controls/selector.js.map +1 -1
  61. package/2D/controls/sliders/baseSlider.d.ts +1 -1
  62. package/2D/controls/sliders/baseSlider.js +12 -10
  63. package/2D/controls/sliders/baseSlider.js.map +1 -1
  64. package/2D/controls/sliders/imageBasedSlider.d.ts +10 -1
  65. package/2D/controls/sliders/imageBasedSlider.js +29 -5
  66. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  67. package/2D/controls/sliders/imageScrollBar.d.ts +2 -1
  68. package/2D/controls/sliders/imageScrollBar.js +3 -3
  69. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  70. package/2D/controls/sliders/scrollBar.d.ts +2 -1
  71. package/2D/controls/sliders/scrollBar.js +3 -3
  72. package/2D/controls/sliders/scrollBar.js.map +1 -1
  73. package/2D/controls/sliders/slider.d.ts +2 -1
  74. package/2D/controls/sliders/slider.js +4 -4
  75. package/2D/controls/sliders/slider.js.map +1 -1
  76. package/2D/controls/stackPanel.d.ts +10 -3
  77. package/2D/controls/stackPanel.js +35 -13
  78. package/2D/controls/stackPanel.js.map +1 -1
  79. package/2D/controls/statics.js +3 -3
  80. package/2D/controls/statics.js.map +1 -1
  81. package/2D/controls/textBlock.d.ts +16 -9
  82. package/2D/controls/textBlock.js +75 -34
  83. package/2D/controls/textBlock.js.map +1 -1
  84. package/2D/controls/textWrapper.js +2 -2
  85. package/2D/controls/textWrapper.js.map +1 -1
  86. package/2D/controls/toggleButton.d.ts +1 -13
  87. package/2D/controls/toggleButton.js +29 -38
  88. package/2D/controls/toggleButton.js.map +1 -1
  89. package/2D/controls/virtualKeyboard.js +5 -5
  90. package/2D/controls/virtualKeyboard.js.map +1 -1
  91. package/2D/index.d.ts +1 -1
  92. package/2D/index.js +9 -9
  93. package/2D/index.js.map +1 -1
  94. package/2D/math2D.d.ts +5 -0
  95. package/2D/math2D.js +14 -2
  96. package/2D/math2D.js.map +1 -1
  97. package/2D/measure.js +1 -1
  98. package/2D/measure.js.map +1 -1
  99. package/2D/multiLinePoint.js +3 -3
  100. package/2D/style.js +2 -2
  101. package/2D/valueAndUnit.d.ts +21 -6
  102. package/2D/valueAndUnit.js +57 -13
  103. package/2D/valueAndUnit.js.map +1 -1
  104. package/2D/xmlLoader.d.ts +17 -3
  105. package/2D/xmlLoader.js +54 -15
  106. package/2D/xmlLoader.js.map +1 -1
  107. package/3D/behaviors/defaultBehavior.d.ts +73 -0
  108. package/3D/behaviors/defaultBehavior.js +122 -0
  109. package/3D/behaviors/defaultBehavior.js.map +1 -0
  110. package/3D/controls/abstractButton3D.d.ts +2 -2
  111. package/3D/controls/abstractButton3D.js +3 -3
  112. package/3D/controls/abstractButton3D.js.map +1 -1
  113. package/3D/controls/button3D.d.ts +0 -24
  114. package/3D/controls/button3D.js +15 -84
  115. package/3D/controls/button3D.js.map +1 -1
  116. package/3D/controls/container3D.js +2 -2
  117. package/3D/controls/contentDisplay3D.d.ts +30 -0
  118. package/3D/controls/contentDisplay3D.js +79 -0
  119. package/3D/controls/contentDisplay3D.js.map +1 -0
  120. package/3D/controls/control3D.d.ts +10 -7
  121. package/3D/controls/control3D.js +27 -19
  122. package/3D/controls/control3D.js.map +1 -1
  123. package/3D/controls/cylinderPanel.js +5 -5
  124. package/3D/controls/handMenu.d.ts +28 -0
  125. package/3D/controls/handMenu.js +48 -0
  126. package/3D/controls/handMenu.js.map +1 -0
  127. package/3D/controls/holographicBackplate.d.ts +48 -0
  128. package/3D/controls/holographicBackplate.js +121 -0
  129. package/3D/controls/holographicBackplate.js.map +1 -0
  130. package/3D/controls/holographicButton.d.ts +1 -1
  131. package/3D/controls/holographicButton.js +35 -31
  132. package/3D/controls/holographicButton.js.map +1 -1
  133. package/3D/controls/holographicSlate.d.ts +118 -0
  134. package/3D/controls/holographicSlate.js +365 -0
  135. package/3D/controls/holographicSlate.js.map +1 -0
  136. package/3D/controls/index.d.ts +7 -0
  137. package/3D/controls/index.js +22 -15
  138. package/3D/controls/index.js.map +1 -1
  139. package/3D/controls/meshButton3D.js +2 -2
  140. package/3D/controls/meshButton3D.js.map +1 -1
  141. package/3D/controls/nearMenu.d.ts +45 -0
  142. package/3D/controls/nearMenu.js +111 -0
  143. package/3D/controls/nearMenu.js.map +1 -0
  144. package/3D/controls/planePanel.js +3 -3
  145. package/3D/controls/scatterPanel.js +4 -4
  146. package/3D/controls/slider3D.d.ts +80 -0
  147. package/3D/controls/slider3D.js +268 -0
  148. package/3D/controls/slider3D.js.map +1 -0
  149. package/3D/controls/spherePanel.js +5 -5
  150. package/3D/controls/stackPanel3D.js +3 -3
  151. package/3D/controls/touchButton3D.d.ts +9 -21
  152. package/3D/controls/touchButton3D.js +52 -224
  153. package/3D/controls/touchButton3D.js.map +1 -1
  154. package/3D/controls/touchHolographicButton.d.ts +20 -3
  155. package/3D/controls/touchHolographicButton.js +137 -67
  156. package/3D/controls/touchHolographicButton.js.map +1 -1
  157. package/3D/controls/touchHolographicMenu.d.ts +61 -0
  158. package/3D/controls/touchHolographicMenu.js +149 -0
  159. package/3D/controls/touchHolographicMenu.js.map +1 -0
  160. package/3D/controls/touchMeshButton3D.d.ts +3 -6
  161. package/3D/controls/touchMeshButton3D.js +6 -14
  162. package/3D/controls/touchMeshButton3D.js.map +1 -1
  163. package/3D/controls/touchToggleButton3D.d.ts +35 -0
  164. package/3D/controls/touchToggleButton3D.js +60 -0
  165. package/3D/controls/touchToggleButton3D.js.map +1 -0
  166. package/3D/controls/volumeBasedPanel.d.ts +1 -1
  167. package/3D/controls/volumeBasedPanel.js +5 -5
  168. package/3D/controls/volumeBasedPanel.js.map +1 -1
  169. package/3D/gizmos/gizmoHandle.d.ts +108 -0
  170. package/3D/gizmos/gizmoHandle.js +210 -0
  171. package/3D/gizmos/gizmoHandle.js.map +1 -0
  172. package/3D/gizmos/index.d.ts +2 -0
  173. package/3D/gizmos/index.js +3 -0
  174. package/3D/gizmos/index.js.map +1 -0
  175. package/3D/gizmos/slateGizmo.d.ts +59 -0
  176. package/3D/gizmos/slateGizmo.js +364 -0
  177. package/3D/gizmos/slateGizmo.js.map +1 -0
  178. package/3D/gui3DManager.d.ts +15 -2
  179. package/3D/gui3DManager.js +62 -41
  180. package/3D/gui3DManager.js.map +1 -1
  181. package/3D/index.d.ts +3 -2
  182. package/3D/index.js +5 -4
  183. package/3D/index.js.map +1 -1
  184. package/3D/materials/fluent/fluentMaterial.d.ts +90 -0
  185. package/3D/materials/fluent/fluentMaterial.js +282 -0
  186. package/3D/materials/fluent/fluentMaterial.js.map +1 -0
  187. package/3D/materials/fluent/index.d.ts +1 -0
  188. package/3D/materials/fluent/index.js +2 -0
  189. package/3D/materials/fluent/index.js.map +1 -0
  190. package/3D/materials/{shaders → fluent/shaders}/fluent.fragment.d.ts +0 -0
  191. package/3D/materials/fluent/shaders/fluent.fragment.js +7 -0
  192. package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -0
  193. package/3D/materials/{shaders → fluent/shaders}/fluent.vertex.d.ts +0 -0
  194. package/3D/materials/{shaders → fluent/shaders}/fluent.vertex.js +2 -2
  195. package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -0
  196. package/3D/materials/fluentBackplate/fluentBackplateMaterial.d.ts +154 -0
  197. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +435 -0
  198. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -0
  199. package/3D/materials/fluentBackplate/index.d.ts +1 -0
  200. package/3D/materials/fluentBackplate/index.js +2 -0
  201. package/3D/materials/fluentBackplate/index.js.map +1 -0
  202. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.d.ts +5 -0
  203. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +7 -0
  204. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -0
  205. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.d.ts +5 -0
  206. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +7 -0
  207. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -0
  208. package/3D/materials/fluentButton/fluentButtonMaterial.d.ts +189 -0
  209. package/3D/materials/fluentButton/fluentButtonMaterial.js +538 -0
  210. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -0
  211. package/3D/materials/fluentButton/index.d.ts +1 -0
  212. package/3D/materials/fluentButton/index.js +2 -0
  213. package/3D/materials/fluentButton/index.js.map +1 -0
  214. package/3D/materials/fluentButton/shaders/fluentButton.fragment.d.ts +5 -0
  215. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +7 -0
  216. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -0
  217. package/3D/materials/fluentButton/shaders/fluentButton.vertex.d.ts +5 -0
  218. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +7 -0
  219. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -0
  220. package/3D/materials/fluentMaterial.d.ts +2 -88
  221. package/3D/materials/fluentMaterial.js +2 -277
  222. package/3D/materials/fluentMaterial.js.map +1 -1
  223. package/3D/materials/handle/handleMaterial.d.ts +68 -0
  224. package/3D/materials/handle/handleMaterial.js +127 -0
  225. package/3D/materials/handle/handleMaterial.js.map +1 -0
  226. package/3D/materials/handle/index.d.ts +1 -0
  227. package/3D/materials/handle/index.js +2 -0
  228. package/3D/materials/handle/index.js.map +1 -0
  229. package/3D/materials/handle/shaders/handle.fragment.d.ts +5 -0
  230. package/3D/materials/handle/shaders/handle.fragment.js +7 -0
  231. package/3D/materials/handle/shaders/handle.fragment.js.map +1 -0
  232. package/3D/materials/handle/shaders/handle.vertex.d.ts +5 -0
  233. package/3D/materials/handle/shaders/handle.vertex.js +7 -0
  234. package/3D/materials/handle/shaders/handle.vertex.js.map +1 -0
  235. package/3D/materials/index.d.ts +5 -1
  236. package/3D/materials/index.js +5 -1
  237. package/3D/materials/index.js.map +1 -1
  238. package/3D/materials/mrdl/index.d.ts +3 -0
  239. package/3D/materials/mrdl/index.js +4 -0
  240. package/3D/materials/mrdl/index.js.map +1 -0
  241. package/3D/materials/mrdl/mrdlBackplateMaterial.d.ts +147 -0
  242. package/3D/materials/mrdl/mrdlBackplateMaterial.js +410 -0
  243. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -0
  244. package/3D/materials/mrdl/mrdlSliderBarMaterial.d.ts +333 -0
  245. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +787 -0
  246. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -0
  247. package/3D/materials/mrdl/mrdlSliderThumbMaterial.d.ts +333 -0
  248. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +787 -0
  249. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -0
  250. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.d.ts +5 -0
  251. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +7 -0
  252. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -0
  253. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.d.ts +5 -0
  254. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +7 -0
  255. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -0
  256. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.d.ts +5 -0
  257. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +7 -0
  258. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -0
  259. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.d.ts +5 -0
  260. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +7 -0
  261. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -0
  262. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.d.ts +5 -0
  263. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +7 -0
  264. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -0
  265. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.d.ts +5 -0
  266. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +7 -0
  267. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -0
  268. package/3D/vector3WithInfo.js +1 -1
  269. package/index.d.ts +2 -2
  270. package/index.js +2 -2
  271. package/index.js.map +1 -1
  272. package/legacy/legacy.js +2 -2
  273. package/package.json +117 -9
  274. package/3D/materials/shaders/fluent.fragment.js +0 -7
  275. package/3D/materials/shaders/fluent.fragment.js.map +0 -1
  276. package/3D/materials/shaders/fluent.vertex.js.map +0 -1
@@ -1,14 +1,15 @@
1
1
  import { __decorate } from "tslib";
2
- import { Observable } from "@babylonjs/core/Misc/observable";
3
- import { Vector2, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector";
4
- import { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents';
5
- import { Logger } from "@babylonjs/core/Misc/logger";
6
- import { Tools } from "@babylonjs/core/Misc/tools";
7
- import { ValueAndUnit } from "../valueAndUnit";
8
- import { Measure } from "../measure";
9
- import { Matrix2D, Vector2WithInfo } from "../math2D";
10
- import { _TypeStore } from '@babylonjs/core/Misc/typeStore';
11
- import { SerializationHelper, serialize } from '@babylonjs/core/Misc/decorators';
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 { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
11
+ import { SerializationHelper, serialize } from "@babylonjs/core/Misc/decorators.js";
12
+ import { Engine } from "@babylonjs/core/Engines/engine.js";
12
13
  /**
13
14
  * Root class used for all 2D controls
14
15
  * @see https://doc.babylonjs.com/how_to/gui#controls
@@ -28,6 +29,8 @@ var Control = /** @class */ (function () {
28
29
  this._zIndex = 0;
29
30
  /** @hidden */
30
31
  this._currentMeasure = Measure.Empty();
32
+ /** @hidden */
33
+ this._tempPaddingMeasure = Measure.Empty();
31
34
  this._fontFamily = "Arial";
32
35
  this._fontStyle = "";
33
36
  this._fontWeight = "";
@@ -52,6 +55,7 @@ var Control = /** @class */ (function () {
52
55
  this._prevCurrentMeasureTransformedIntoGlobalSpace = Measure.Empty();
53
56
  /** @hidden */
54
57
  this._cachedParentMeasure = Measure.Empty();
58
+ this._descendantsOnlyPadding = false;
55
59
  this._paddingLeft = new ValueAndUnit(0);
56
60
  this._paddingRight = new ValueAndUnit(0);
57
61
  this._paddingTop = new ValueAndUnit(0);
@@ -74,15 +78,20 @@ var Control = /** @class */ (function () {
74
78
  this._isMatrixDirty = true;
75
79
  this._isVisible = true;
76
80
  this._isHighlighted = false;
81
+ this._highlightColor = "#4affff";
82
+ this._highlightLineWidth = 2;
77
83
  this._fontSet = false;
78
84
  this._dummyVector2 = Vector2.Zero();
79
85
  this._downCount = 0;
80
86
  this._enterCount = -1;
81
87
  this._doNotRender = false;
82
88
  this._downPointerIds = {};
89
+ this._evaluatedMeasure = new Measure(0, 0, 0, 0);
90
+ this._evaluatedParentMeasure = new Measure(0, 0, 0, 0);
83
91
  this._isEnabled = true;
84
92
  this._disabledColor = "#9a9a9a";
85
93
  this._disabledColorItem = "#6a6a6a";
94
+ this._isReadOnly = false;
86
95
  /** @hidden */
87
96
  this._rebuildLayout = false;
88
97
  /** @hidden */
@@ -118,7 +127,8 @@ var Control = /** @class */ (function () {
118
127
  this._shadowOffsetX = 0;
119
128
  this._shadowOffsetY = 0;
120
129
  this._shadowBlur = 0;
121
- this._shadowColor = 'black';
130
+ this._previousShadowBlur = 0;
131
+ this._shadowColor = "black";
122
132
  /** Gets or sets the cursor to use when the control is hovered */
123
133
  this.hoverCursor = "";
124
134
  /** @hidden */
@@ -126,36 +136,36 @@ var Control = /** @class */ (function () {
126
136
  /** @hidden */
127
137
  this._linkOffsetY = new ValueAndUnit(0);
128
138
  /**
129
- * An event triggered when pointer wheel is scrolled
130
- */
139
+ * An event triggered when pointer wheel is scrolled
140
+ */
131
141
  this.onWheelObservable = new Observable();
132
142
  /**
133
- * An event triggered when the pointer move over the control.
134
- */
143
+ * An event triggered when the pointer moves over the control.
144
+ */
135
145
  this.onPointerMoveObservable = new Observable();
136
146
  /**
137
- * An event triggered when the pointer move out of the control.
138
- */
147
+ * An event triggered when the pointer moves out of the control.
148
+ */
139
149
  this.onPointerOutObservable = new Observable();
140
150
  /**
141
- * An event triggered when the pointer taps the control
142
- */
151
+ * An event triggered when the pointer taps the control
152
+ */
143
153
  this.onPointerDownObservable = new Observable();
144
154
  /**
145
- * An event triggered when pointer up
146
- */
155
+ * An event triggered when pointer up
156
+ */
147
157
  this.onPointerUpObservable = new Observable();
148
158
  /**
149
- * An event triggered when a control is clicked on
150
- */
159
+ * An event triggered when a control is clicked on
160
+ */
151
161
  this.onPointerClickObservable = new Observable();
152
162
  /**
153
- * An event triggered when pointer enters the control
154
- */
163
+ * An event triggered when pointer enters the control
164
+ */
155
165
  this.onPointerEnterObservable = new Observable();
156
166
  /**
157
- * An event triggered when the control is marked as dirty
158
- */
167
+ * An event triggered when the control is marked as dirty
168
+ */
159
169
  this.onDirtyObservable = new Observable();
160
170
  /**
161
171
  * An event triggered before drawing the control
@@ -166,8 +176,8 @@ var Control = /** @class */ (function () {
166
176
  */
167
177
  this.onAfterDrawObservable = new Observable();
168
178
  /**
169
- * An event triggered when the control has been disposed
170
- */
179
+ * An event triggered when the control has been disposed
180
+ */
171
181
  this.onDisposeObservable = new Observable();
172
182
  /**
173
183
  * Gets or sets a fixed ratio for this control.
@@ -179,6 +189,30 @@ var Control = /** @class */ (function () {
179
189
  this._fixedRatioMasterIsWidth = true;
180
190
  this._tmpMeasureA = new Measure(0, 0, 0, 0);
181
191
  }
192
+ Object.defineProperty(Control.prototype, "isReadOnly", {
193
+ /**
194
+ * Gets or sets a boolean indicating if the control is readonly (default: false).
195
+ * A readonly control will still raise pointer events but will not react to them
196
+ */
197
+ get: function () {
198
+ return this._isReadOnly;
199
+ },
200
+ set: function (value) {
201
+ this._isReadOnly = value;
202
+ },
203
+ enumerable: false,
204
+ configurable: true
205
+ });
206
+ Object.defineProperty(Control.prototype, "transformedMeasure", {
207
+ /**
208
+ * Gets the transformed measure, that is the bounding box of the control after applying all transformations
209
+ */
210
+ get: function () {
211
+ return this._evaluatedMeasure;
212
+ },
213
+ enumerable: false,
214
+ configurable: true
215
+ });
182
216
  Object.defineProperty(Control.prototype, "shadowOffsetX", {
183
217
  /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
184
218
  get: function () {
@@ -218,6 +252,7 @@ var Control = /** @class */ (function () {
218
252
  if (this._shadowBlur === value) {
219
253
  return;
220
254
  }
255
+ this._previousShadowBlur = this._shadowBlur;
221
256
  this._shadowBlur = value;
222
257
  this._markAsDirty();
223
258
  },
@@ -292,6 +327,23 @@ var Control = /** @class */ (function () {
292
327
  enumerable: false,
293
328
  configurable: true
294
329
  });
330
+ Object.defineProperty(Control.prototype, "highlightLineWidth", {
331
+ /**
332
+ * Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)
333
+ */
334
+ get: function () {
335
+ return this._highlightLineWidth;
336
+ },
337
+ set: function (value) {
338
+ if (this._highlightLineWidth === value) {
339
+ return;
340
+ }
341
+ this._highlightLineWidth = value;
342
+ this._markAsDirty();
343
+ },
344
+ enumerable: false,
345
+ configurable: true
346
+ });
295
347
  Object.defineProperty(Control.prototype, "isHighlighted", {
296
348
  /**
297
349
  * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
@@ -309,10 +361,27 @@ var Control = /** @class */ (function () {
309
361
  enumerable: false,
310
362
  configurable: true
311
363
  });
364
+ Object.defineProperty(Control.prototype, "highlightColor", {
365
+ /**
366
+ * Gets or sets a string defining the color to use for highlighting this control
367
+ */
368
+ get: function () {
369
+ return this._highlightColor;
370
+ },
371
+ set: function (value) {
372
+ if (this._highlightColor === value) {
373
+ return;
374
+ }
375
+ this._highlightColor = value;
376
+ this._markAsDirty();
377
+ },
378
+ enumerable: false,
379
+ configurable: true
380
+ });
312
381
  Object.defineProperty(Control.prototype, "scaleX", {
313
382
  /** Gets or sets a value indicating the scale factor on X axis (1 by default)
314
383
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
315
- */
384
+ */
316
385
  get: function () {
317
386
  return this._scaleX;
318
387
  },
@@ -330,7 +399,7 @@ var Control = /** @class */ (function () {
330
399
  Object.defineProperty(Control.prototype, "scaleY", {
331
400
  /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
332
401
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
333
- */
402
+ */
334
403
  get: function () {
335
404
  return this._scaleY;
336
405
  },
@@ -348,7 +417,7 @@ var Control = /** @class */ (function () {
348
417
  Object.defineProperty(Control.prototype, "rotation", {
349
418
  /** Gets or sets the rotation angle (0 by default)
350
419
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
351
- */
420
+ */
352
421
  get: function () {
353
422
  return this._rotation;
354
423
  },
@@ -366,7 +435,7 @@ var Control = /** @class */ (function () {
366
435
  Object.defineProperty(Control.prototype, "transformCenterY", {
367
436
  /** Gets or sets the transformation center on Y axis (0 by default)
368
437
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
369
- */
438
+ */
370
439
  get: function () {
371
440
  return this._transformCenterY;
372
441
  },
@@ -384,7 +453,7 @@ var Control = /** @class */ (function () {
384
453
  Object.defineProperty(Control.prototype, "transformCenterX", {
385
454
  /** Gets or sets the transformation center on X axis (0 by default)
386
455
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
387
- */
456
+ */
388
457
  get: function () {
389
458
  return this._transformCenterX;
390
459
  },
@@ -514,9 +583,6 @@ var Control = /** @class */ (function () {
514
583
  Object.defineProperty(Control.prototype, "fontFamily", {
515
584
  /** Gets or set font family */
516
585
  get: function () {
517
- if (!this._fontSet) {
518
- return "";
519
- }
520
586
  return this._fontFamily;
521
587
  },
522
588
  set: function (value) {
@@ -709,6 +775,24 @@ var Control = /** @class */ (function () {
709
775
  enumerable: false,
710
776
  configurable: true
711
777
  });
778
+ Object.defineProperty(Control.prototype, "descendantsOnlyPadding", {
779
+ /**
780
+ * Gets or sets a value indicating the padding should work like in CSS.
781
+ * Basically, it will add the padding amount on each side of the parent control for its children.
782
+ */
783
+ get: function () {
784
+ return this._descendantsOnlyPadding;
785
+ },
786
+ set: function (value) {
787
+ if (this._descendantsOnlyPadding === value) {
788
+ return;
789
+ }
790
+ this._descendantsOnlyPadding = value;
791
+ this._markAsDirty();
792
+ },
793
+ enumerable: false,
794
+ configurable: true
795
+ });
712
796
  Object.defineProperty(Control.prototype, "paddingLeft", {
713
797
  /**
714
798
  * Gets or sets a value indicating the padding to use on the left of the control
@@ -742,6 +826,17 @@ var Control = /** @class */ (function () {
742
826
  enumerable: false,
743
827
  configurable: true
744
828
  });
829
+ Object.defineProperty(Control.prototype, "_paddingLeftInPixels", {
830
+ /** @hidden */
831
+ get: function () {
832
+ if (this._descendantsOnlyPadding) {
833
+ return 0;
834
+ }
835
+ return this.paddingLeftInPixels;
836
+ },
837
+ enumerable: false,
838
+ configurable: true
839
+ });
745
840
  Object.defineProperty(Control.prototype, "paddingRight", {
746
841
  /**
747
842
  * Gets or sets a value indicating the padding to use on the right of the control
@@ -775,6 +870,17 @@ var Control = /** @class */ (function () {
775
870
  enumerable: false,
776
871
  configurable: true
777
872
  });
873
+ Object.defineProperty(Control.prototype, "_paddingRightInPixels", {
874
+ /** @hidden */
875
+ get: function () {
876
+ if (this._descendantsOnlyPadding) {
877
+ return 0;
878
+ }
879
+ return this.paddingRightInPixels;
880
+ },
881
+ enumerable: false,
882
+ configurable: true
883
+ });
778
884
  Object.defineProperty(Control.prototype, "paddingTop", {
779
885
  /**
780
886
  * Gets or sets a value indicating the padding to use on the top of the control
@@ -808,6 +914,17 @@ var Control = /** @class */ (function () {
808
914
  enumerable: false,
809
915
  configurable: true
810
916
  });
917
+ Object.defineProperty(Control.prototype, "_paddingTopInPixels", {
918
+ /** @hidden */
919
+ get: function () {
920
+ if (this._descendantsOnlyPadding) {
921
+ return 0;
922
+ }
923
+ return this.paddingTopInPixels;
924
+ },
925
+ enumerable: false,
926
+ configurable: true
927
+ });
811
928
  Object.defineProperty(Control.prototype, "paddingBottom", {
812
929
  /**
813
930
  * Gets or sets a value indicating the padding to use on the bottom of the control
@@ -841,6 +958,17 @@ var Control = /** @class */ (function () {
841
958
  enumerable: false,
842
959
  configurable: true
843
960
  });
961
+ Object.defineProperty(Control.prototype, "_paddingBottomInPixels", {
962
+ /** @hidden */
963
+ get: function () {
964
+ if (this._descendantsOnlyPadding) {
965
+ return 0;
966
+ }
967
+ return this.paddingBottomInPixels;
968
+ },
969
+ enumerable: false,
970
+ configurable: true
971
+ });
844
972
  Object.defineProperty(Control.prototype, "left", {
845
973
  /**
846
974
  * Gets or sets a value indicating the left coordinate of the control
@@ -1115,7 +1243,7 @@ var Control = /** @class */ (function () {
1115
1243
  }
1116
1244
  this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
1117
1245
  this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
1118
- var globalViewport = this._host._getGlobalViewport(scene);
1246
+ var globalViewport = this._host._getGlobalViewport();
1119
1247
  var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);
1120
1248
  this._moveToProjectedPosition(projectedPosition);
1121
1249
  if (projectedPosition.z < 0 || projectedPosition.z > 1) {
@@ -1151,7 +1279,7 @@ var Control = /** @class */ (function () {
1151
1279
  * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
1152
1280
  */
1153
1281
  Control.prototype.linkWithMesh = function (mesh) {
1154
- if (!this._host || this.parent && this.parent !== this._host._rootContainer) {
1282
+ if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
1155
1283
  if (mesh) {
1156
1284
  Tools.Error("Cannot link a control to a mesh if the control is not at root level");
1157
1285
  }
@@ -1174,13 +1302,13 @@ var Control = /** @class */ (function () {
1174
1302
  this._host._linkedControls.push(this);
1175
1303
  };
1176
1304
  /**
1177
- * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
1178
- * @param { string | number} paddingTop - The value of the top padding.
1179
- * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
1180
- * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
1181
- * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
1182
- * @see https://doc.babylonjs.com/how_to/gui#position-and-size
1183
- */
1305
+ * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
1306
+ * @param { string | number} paddingTop - The value of the top padding.
1307
+ * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
1308
+ * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
1309
+ * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
1310
+ * @see https://doc.babylonjs.com/how_to/gui#position-and-size
1311
+ */
1184
1312
  Control.prototype.setPadding = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
1185
1313
  var top = paddingTop;
1186
1314
  var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
@@ -1211,10 +1339,17 @@ var Control = /** @class */ (function () {
1211
1339
  };
1212
1340
  /** @hidden */
1213
1341
  Control.prototype._moveToProjectedPosition = function (projectedPosition) {
1342
+ var _a;
1214
1343
  var oldLeft = this._left.getValue(this._host);
1215
1344
  var oldTop = this._top.getValue(this._host);
1216
- var newLeft = ((projectedPosition.x + this._linkOffsetX.getValue(this._host)) - this._currentMeasure.width / 2);
1217
- var newTop = ((projectedPosition.y + this._linkOffsetY.getValue(this._host)) - this._currentMeasure.height / 2);
1345
+ if (this._currentMeasure.width === 0 && this._currentMeasure.height === 0) {
1346
+ var parentMeasure = (_a = this.parent) === null || _a === void 0 ? void 0 : _a._currentMeasure;
1347
+ if (parentMeasure) {
1348
+ this._processMeasures(parentMeasure, this._host.getContext());
1349
+ }
1350
+ }
1351
+ var newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
1352
+ var newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
1218
1353
  if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
1219
1354
  if (Math.abs(newLeft - oldLeft) < 0.5) {
1220
1355
  newLeft = oldLeft;
@@ -1267,6 +1402,14 @@ var Control = /** @class */ (function () {
1267
1402
  return true;
1268
1403
  };
1269
1404
  /** @hidden */
1405
+ Control.prototype._computeAdditionnalOffsetX = function () {
1406
+ return 0;
1407
+ };
1408
+ /** @hidden */
1409
+ Control.prototype._computeAdditionnalOffsetY = function () {
1410
+ return 0;
1411
+ };
1412
+ /** @hidden */
1270
1413
  Control.prototype.invalidateRect = function () {
1271
1414
  this._transform();
1272
1415
  if (this.host && this.host.useInvalidateRectOptimization) {
@@ -1275,20 +1418,17 @@ var Control = /** @class */ (function () {
1275
1418
  // get the boudning box of the current measure and last frames measure in global space and invalidate it
1276
1419
  // the previous measure is used to properly clear a control that is scaled down
1277
1420
  Measure.CombineToRef(this._tmpMeasureA, this._prevCurrentMeasureTransformedIntoGlobalSpace, this._tmpMeasureA);
1278
- if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
1279
- // Expand rect based on shadows
1280
- var shadowOffsetX = this.shadowOffsetX;
1281
- var shadowOffsetY = this.shadowOffsetY;
1282
- var shadowBlur = this.shadowBlur;
1283
- var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
1284
- var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
1285
- var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
1286
- var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
1287
- this.host.invalidateRect(Math.floor(this._tmpMeasureA.left + leftShadowOffset), Math.floor(this._tmpMeasureA.top + topShadowOffset), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width + rightShadowOffset), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height + bottomShadowOffset));
1288
- }
1289
- else {
1290
- this.host.invalidateRect(Math.floor(this._tmpMeasureA.left), Math.floor(this._tmpMeasureA.top), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height));
1291
- }
1421
+ // Expand rect based on shadows
1422
+ var shadowOffsetX = this.shadowOffsetX;
1423
+ var shadowOffsetY = this.shadowOffsetY;
1424
+ var shadowBlur = Math.max(this._previousShadowBlur, this.shadowBlur);
1425
+ var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
1426
+ var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
1427
+ var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
1428
+ var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
1429
+ var offsetX = this._computeAdditionnalOffsetX();
1430
+ var offsetY = this._computeAdditionnalOffsetY();
1431
+ 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));
1292
1432
  }
1293
1433
  };
1294
1434
  /** @hidden */
@@ -1350,8 +1490,8 @@ var Control = /** @class */ (function () {
1350
1490
  return;
1351
1491
  }
1352
1492
  context.save();
1353
- context.strokeStyle = "#4affff";
1354
- context.lineWidth = 2;
1493
+ context.strokeStyle = this._highlightColor;
1494
+ context.lineWidth = this._highlightLineWidth;
1355
1495
  this._renderHighlightSpecific(context);
1356
1496
  context.restore();
1357
1497
  };
@@ -1364,6 +1504,9 @@ var Control = /** @class */ (function () {
1364
1504
  if (this._isFontSizeInPercentage) {
1365
1505
  this._fontSet = true;
1366
1506
  }
1507
+ if (this._host && this._host.useSmallestIdeal && !this._font) {
1508
+ this._fontSet = true;
1509
+ }
1367
1510
  if (this._fontSet) {
1368
1511
  this._prepareFont();
1369
1512
  this._fontSet = false;
@@ -1378,7 +1521,7 @@ var Control = /** @class */ (function () {
1378
1521
  context.globalAlpha *= this._alpha;
1379
1522
  }
1380
1523
  else if (this._alphaSet) {
1381
- context.globalAlpha = this.parent ? this.parent.alpha * this._alpha : this._alpha;
1524
+ context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
1382
1525
  }
1383
1526
  };
1384
1527
  /** @hidden */
@@ -1388,7 +1531,7 @@ var Control = /** @class */ (function () {
1388
1531
  }
1389
1532
  if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
1390
1533
  this.host._numLayoutCalls++;
1391
- this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this.paddingLeftInPixels | 0, -this.paddingTopInPixels | 0, this.paddingRightInPixels | 0, this.paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
1534
+ this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this._paddingLeftInPixels | 0, -this._paddingTopInPixels | 0, this._paddingRightInPixels | 0, this._paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
1392
1535
  context.save();
1393
1536
  this._applyStates(context);
1394
1537
  var rebuildCount = 0;
@@ -1410,39 +1553,50 @@ var Control = /** @class */ (function () {
1410
1553
  };
1411
1554
  /** @hidden */
1412
1555
  Control.prototype._processMeasures = function (parentMeasure, context) {
1413
- this._currentMeasure.copyFrom(parentMeasure);
1556
+ this._tempPaddingMeasure.copyFrom(parentMeasure);
1557
+ // Apply padding if in correct mode
1558
+ if (this.parent && this.parent.descendantsOnlyPadding) {
1559
+ this._tempPaddingMeasure.left += this.parent.paddingLeftInPixels;
1560
+ this._tempPaddingMeasure.top += this.parent.paddingTopInPixels;
1561
+ this._tempPaddingMeasure.width -= this.parent.paddingLeftInPixels + this.parent.paddingRightInPixels;
1562
+ this._tempPaddingMeasure.height -= this.parent.paddingTopInPixels + this.parent.paddingBottomInPixels;
1563
+ }
1564
+ this._currentMeasure.copyFrom(this._tempPaddingMeasure);
1414
1565
  // Let children take some pre-measurement actions
1415
- this._preMeasure(parentMeasure, context);
1566
+ this._preMeasure(this._tempPaddingMeasure, context);
1416
1567
  this._measure();
1417
- this._computeAlignment(parentMeasure, context);
1568
+ this._computeAlignment(this._tempPaddingMeasure, context);
1418
1569
  // Convert to int values
1419
1570
  this._currentMeasure.left = this._currentMeasure.left | 0;
1420
1571
  this._currentMeasure.top = this._currentMeasure.top | 0;
1421
1572
  this._currentMeasure.width = this._currentMeasure.width | 0;
1422
1573
  this._currentMeasure.height = this._currentMeasure.height | 0;
1423
1574
  // Let children add more features
1424
- this._additionalProcessing(parentMeasure, context);
1425
- this._cachedParentMeasure.copyFrom(parentMeasure);
1575
+ this._additionalProcessing(this._tempPaddingMeasure, context);
1576
+ this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure);
1577
+ this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
1426
1578
  if (this.onDirtyObservable.hasObservers()) {
1427
1579
  this.onDirtyObservable.notifyObservers(this);
1428
1580
  }
1429
1581
  };
1430
1582
  Control.prototype._evaluateClippingState = function (parentMeasure) {
1583
+ this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
1431
1584
  if (this.parent && this.parent.clipChildren) {
1585
+ parentMeasure.transformToRef(this.parent._transformMatrix, this._evaluatedParentMeasure);
1432
1586
  // Early clip
1433
- if (this._currentMeasure.left > parentMeasure.left + parentMeasure.width) {
1587
+ if (this._evaluatedMeasure.left > this._evaluatedParentMeasure.left + this._evaluatedParentMeasure.width) {
1434
1588
  this._isClipped = true;
1435
1589
  return;
1436
1590
  }
1437
- if (this._currentMeasure.left + this._currentMeasure.width < parentMeasure.left) {
1591
+ if (this._evaluatedMeasure.left + this._evaluatedMeasure.width < this._evaluatedParentMeasure.left) {
1438
1592
  this._isClipped = true;
1439
1593
  return;
1440
1594
  }
1441
- if (this._currentMeasure.top > parentMeasure.top + parentMeasure.height) {
1595
+ if (this._evaluatedMeasure.top > this._evaluatedParentMeasure.top + this._evaluatedParentMeasure.height) {
1442
1596
  this._isClipped = true;
1443
1597
  return;
1444
1598
  }
1445
- if (this._currentMeasure.top + this._currentMeasure.height < parentMeasure.top) {
1599
+ if (this._evaluatedMeasure.top + this._evaluatedMeasure.height < this._evaluatedParentMeasure.top) {
1446
1600
  this._isClipped = true;
1447
1601
  return;
1448
1602
  }
@@ -1504,33 +1658,35 @@ var Control = /** @class */ (function () {
1504
1658
  y = (parentHeight - height) / 2;
1505
1659
  break;
1506
1660
  }
1507
- if (this._paddingLeft.isPixel) {
1508
- this._currentMeasure.left += this._paddingLeft.getValue(this._host);
1509
- this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
1510
- }
1511
- else {
1512
- this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
1513
- this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
1514
- }
1515
- if (this._paddingRight.isPixel) {
1516
- this._currentMeasure.width -= this._paddingRight.getValue(this._host);
1517
- }
1518
- else {
1519
- this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
1520
- }
1521
- if (this._paddingTop.isPixel) {
1522
- this._currentMeasure.top += this._paddingTop.getValue(this._host);
1523
- this._currentMeasure.height -= this._paddingTop.getValue(this._host);
1524
- }
1525
- else {
1526
- this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
1527
- this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
1528
- }
1529
- if (this._paddingBottom.isPixel) {
1530
- this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
1531
- }
1532
- else {
1533
- this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
1661
+ if (!this.descendantsOnlyPadding) {
1662
+ if (this._paddingLeft.isPixel) {
1663
+ this._currentMeasure.left += this._paddingLeft.getValue(this._host);
1664
+ this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
1665
+ }
1666
+ else {
1667
+ this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
1668
+ this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
1669
+ }
1670
+ if (this._paddingRight.isPixel) {
1671
+ this._currentMeasure.width -= this._paddingRight.getValue(this._host);
1672
+ }
1673
+ else {
1674
+ this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
1675
+ }
1676
+ if (this._paddingTop.isPixel) {
1677
+ this._currentMeasure.top += this._paddingTop.getValue(this._host);
1678
+ this._currentMeasure.height -= this._paddingTop.getValue(this._host);
1679
+ }
1680
+ else {
1681
+ this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
1682
+ this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
1683
+ }
1684
+ if (this._paddingBottom.isPixel) {
1685
+ this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
1686
+ }
1687
+ else {
1688
+ this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
1689
+ }
1534
1690
  }
1535
1691
  if (this._left.isPixel) {
1536
1692
  this._currentMeasure.left += this._left.getValue(this._host);
@@ -1684,7 +1840,8 @@ var Control = /** @class */ (function () {
1684
1840
  if (this._enterCount > 0) {
1685
1841
  return false;
1686
1842
  }
1687
- if (this._enterCount === -1) { // -1 is for touch input, we are now sure we are with a mouse or pencil
1843
+ if (this._enterCount === -1) {
1844
+ // -1 is for touch input, we are now sure we are with a mouse or pencil
1688
1845
  this._enterCount = 0;
1689
1846
  }
1690
1847
  this._enterCount++;
@@ -1815,6 +1972,8 @@ var Control = /** @class */ (function () {
1815
1972
  this._font = this._fontStyle + " " + this._fontWeight + " " + this.fontSizeInPixels + "px " + this._fontFamily;
1816
1973
  }
1817
1974
  this._fontOffset = Control._GetFontOffset(this._font);
1975
+ //children need to be refreshed
1976
+ this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
1818
1977
  };
1819
1978
  /**
1820
1979
  * Serializes the current control
@@ -1825,7 +1984,7 @@ var Control = /** @class */ (function () {
1825
1984
  serializationObject.name = this.name;
1826
1985
  serializationObject.className = this.getClassName();
1827
1986
  if (this._font) {
1828
- serializationObject.fontFamily = this.fontFamily;
1987
+ serializationObject.fontFamily = this._fontFamily;
1829
1988
  serializationObject.fontSize = this.fontSize;
1830
1989
  serializationObject.fontWeight = this.fontWeight;
1831
1990
  serializationObject.fontStyle = this.fontStyle;
@@ -1929,30 +2088,11 @@ var Control = /** @class */ (function () {
1929
2088
  if (Control._FontHeightSizes[font]) {
1930
2089
  return Control._FontHeightSizes[font];
1931
2090
  }
1932
- var text = document.createElement("span");
1933
- text.innerHTML = "Hg";
1934
- text.style.font = font;
1935
- var block = document.createElement("div");
1936
- block.style.display = "inline-block";
1937
- block.style.width = "1px";
1938
- block.style.height = "0px";
1939
- block.style.verticalAlign = "bottom";
1940
- var div = document.createElement("div");
1941
- div.style.whiteSpace = "nowrap";
1942
- div.appendChild(text);
1943
- div.appendChild(block);
1944
- document.body.appendChild(div);
1945
- var fontAscent = 0;
1946
- var fontHeight = 0;
1947
- try {
1948
- fontHeight = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
1949
- block.style.verticalAlign = "baseline";
1950
- fontAscent = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
1951
- }
1952
- finally {
1953
- document.body.removeChild(div);
1954
- }
1955
- var result = { ascent: fontAscent, height: fontHeight, descent: fontHeight - fontAscent };
2091
+ var engine = Engine.LastCreatedEngine;
2092
+ if (!engine) {
2093
+ throw new Error("Invalid engine. Unable to create a canvas.");
2094
+ }
2095
+ var result = engine.getFontOffset(font);
1956
2096
  Control._FontHeightSizes[font] = result;
1957
2097
  return result;
1958
2098
  };
@@ -2090,6 +2230,9 @@ var Control = /** @class */ (function () {
2090
2230
  __decorate([
2091
2231
  serialize()
2092
2232
  ], Control.prototype, "isVisible", null);
2233
+ __decorate([
2234
+ serialize()
2235
+ ], Control.prototype, "descendantsOnlyPadding", null);
2093
2236
  __decorate([
2094
2237
  serialize()
2095
2238
  ], Control.prototype, "paddingLeft", null);
@@ -2123,8 +2266,14 @@ var Control = /** @class */ (function () {
2123
2266
  __decorate([
2124
2267
  serialize()
2125
2268
  ], Control.prototype, "disabledColorItem", null);
2269
+ __decorate([
2270
+ serialize()
2271
+ ], Control.prototype, "overlapGroup", void 0);
2272
+ __decorate([
2273
+ serialize()
2274
+ ], Control.prototype, "overlapDeltaMultiplier", void 0);
2126
2275
  return Control;
2127
2276
  }());
2128
2277
  export { Control };
2129
- _TypeStore.RegisteredTypes["BABYLON.GUI.Control"] = Control;
2278
+ RegisterClass("BABYLON.GUI.Control", Control);
2130
2279
  //# sourceMappingURL=control.js.map