@babylonjs/gui 5.0.0-alpha.9 → 5.0.0-beta.4

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 (273) hide show
  1. package/2D/adtInstrumentation.js +1 -1
  2. package/2D/advancedDynamicTexture.d.ts +165 -125
  3. package/2D/advancedDynamicTexture.js +347 -183
  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 +112 -44
  18. package/2D/controls/control.js +291 -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 +366 -0
  135. package/3D/controls/holographicSlate.js.map +1 -0
  136. package/3D/controls/index.d.ts +6 -0
  137. package/3D/controls/index.js +21 -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 +44 -0
  142. package/3D/controls/nearMenu.js +113 -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 +30 -21
  152. package/3D/controls/touchButton3D.js +109 -223
  153. package/3D/controls/touchButton3D.js.map +1 -1
  154. package/3D/controls/touchHolographicButton.d.ts +23 -2
  155. package/3D/controls/touchHolographicButton.js +162 -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/volumeBasedPanel.d.ts +1 -1
  164. package/3D/controls/volumeBasedPanel.js +5 -5
  165. package/3D/controls/volumeBasedPanel.js.map +1 -1
  166. package/3D/gizmos/gizmoHandle.d.ts +108 -0
  167. package/3D/gizmos/gizmoHandle.js +210 -0
  168. package/3D/gizmos/gizmoHandle.js.map +1 -0
  169. package/3D/gizmos/index.d.ts +2 -0
  170. package/3D/gizmos/index.js +3 -0
  171. package/3D/gizmos/index.js.map +1 -0
  172. package/3D/gizmos/slateGizmo.d.ts +59 -0
  173. package/3D/gizmos/slateGizmo.js +364 -0
  174. package/3D/gizmos/slateGizmo.js.map +1 -0
  175. package/3D/gui3DManager.d.ts +15 -2
  176. package/3D/gui3DManager.js +62 -41
  177. package/3D/gui3DManager.js.map +1 -1
  178. package/3D/index.d.ts +3 -2
  179. package/3D/index.js +5 -4
  180. package/3D/index.js.map +1 -1
  181. package/3D/materials/fluent/fluentMaterial.d.ts +90 -0
  182. package/3D/materials/fluent/fluentMaterial.js +282 -0
  183. package/3D/materials/fluent/fluentMaterial.js.map +1 -0
  184. package/3D/materials/fluent/index.d.ts +1 -0
  185. package/3D/materials/fluent/index.js +2 -0
  186. package/3D/materials/fluent/index.js.map +1 -0
  187. package/3D/materials/{shaders → fluent/shaders}/fluent.fragment.d.ts +0 -0
  188. package/3D/materials/fluent/shaders/fluent.fragment.js +7 -0
  189. package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -0
  190. package/3D/materials/{shaders → fluent/shaders}/fluent.vertex.d.ts +0 -0
  191. package/3D/materials/{shaders → fluent/shaders}/fluent.vertex.js +2 -2
  192. package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -0
  193. package/3D/materials/fluentBackplate/fluentBackplateMaterial.d.ts +154 -0
  194. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +435 -0
  195. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -0
  196. package/3D/materials/fluentBackplate/index.d.ts +1 -0
  197. package/3D/materials/fluentBackplate/index.js +2 -0
  198. package/3D/materials/fluentBackplate/index.js.map +1 -0
  199. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.d.ts +5 -0
  200. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +7 -0
  201. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -0
  202. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.d.ts +5 -0
  203. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +7 -0
  204. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -0
  205. package/3D/materials/fluentButton/fluentButtonMaterial.d.ts +189 -0
  206. package/3D/materials/fluentButton/fluentButtonMaterial.js +538 -0
  207. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -0
  208. package/3D/materials/fluentButton/index.d.ts +1 -0
  209. package/3D/materials/fluentButton/index.js +2 -0
  210. package/3D/materials/fluentButton/index.js.map +1 -0
  211. package/3D/materials/fluentButton/shaders/fluentButton.fragment.d.ts +5 -0
  212. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +7 -0
  213. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -0
  214. package/3D/materials/fluentButton/shaders/fluentButton.vertex.d.ts +5 -0
  215. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +7 -0
  216. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -0
  217. package/3D/materials/fluentMaterial.d.ts +2 -88
  218. package/3D/materials/fluentMaterial.js +2 -277
  219. package/3D/materials/fluentMaterial.js.map +1 -1
  220. package/3D/materials/handle/handleMaterial.d.ts +68 -0
  221. package/3D/materials/handle/handleMaterial.js +127 -0
  222. package/3D/materials/handle/handleMaterial.js.map +1 -0
  223. package/3D/materials/handle/index.d.ts +1 -0
  224. package/3D/materials/handle/index.js +2 -0
  225. package/3D/materials/handle/index.js.map +1 -0
  226. package/3D/materials/handle/shaders/handle.fragment.d.ts +5 -0
  227. package/3D/materials/handle/shaders/handle.fragment.js +7 -0
  228. package/3D/materials/handle/shaders/handle.fragment.js.map +1 -0
  229. package/3D/materials/handle/shaders/handle.vertex.d.ts +5 -0
  230. package/3D/materials/handle/shaders/handle.vertex.js +7 -0
  231. package/3D/materials/handle/shaders/handle.vertex.js.map +1 -0
  232. package/3D/materials/index.d.ts +5 -1
  233. package/3D/materials/index.js +5 -1
  234. package/3D/materials/index.js.map +1 -1
  235. package/3D/materials/mrdl/index.d.ts +3 -0
  236. package/3D/materials/mrdl/index.js +4 -0
  237. package/3D/materials/mrdl/index.js.map +1 -0
  238. package/3D/materials/mrdl/mrdlBackplateMaterial.d.ts +147 -0
  239. package/3D/materials/mrdl/mrdlBackplateMaterial.js +410 -0
  240. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -0
  241. package/3D/materials/mrdl/mrdlSliderBarMaterial.d.ts +333 -0
  242. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +787 -0
  243. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -0
  244. package/3D/materials/mrdl/mrdlSliderThumbMaterial.d.ts +333 -0
  245. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +787 -0
  246. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -0
  247. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.d.ts +5 -0
  248. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +7 -0
  249. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -0
  250. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.d.ts +5 -0
  251. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +7 -0
  252. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -0
  253. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.d.ts +5 -0
  254. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +7 -0
  255. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -0
  256. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.d.ts +5 -0
  257. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +7 -0
  258. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -0
  259. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.d.ts +5 -0
  260. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +7 -0
  261. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -0
  262. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.d.ts +5 -0
  263. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +7 -0
  264. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -0
  265. package/3D/vector3WithInfo.js +1 -1
  266. package/index.d.ts +2 -2
  267. package/index.js +2 -2
  268. package/index.js.map +1 -1
  269. package/legacy/legacy.js +2 -2
  270. package/package.json +114 -9
  271. package/3D/materials/shaders/fluent.fragment.js +0 -7
  272. package/3D/materials/shaders/fluent.fragment.js.map +0 -1
  273. 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
@@ -1052,6 +1180,19 @@ var Control = /** @class */ (function () {
1052
1180
  }
1053
1181
  return this.parent.getAscendantOfClass(className);
1054
1182
  };
1183
+ /**
1184
+ * Mark control element as dirty
1185
+ * @param force force non visible elements to be marked too
1186
+ */
1187
+ Control.prototype.markAsDirty = function (force) {
1188
+ this._markAsDirty(force);
1189
+ };
1190
+ /**
1191
+ * Mark the element and its children as dirty
1192
+ */
1193
+ Control.prototype.markAllAsDirty = function () {
1194
+ this._markAllAsDirty();
1195
+ };
1055
1196
  /** @hidden */
1056
1197
  Control.prototype._resetFontCache = function () {
1057
1198
  this._fontSet = true;
@@ -1115,7 +1256,7 @@ var Control = /** @class */ (function () {
1115
1256
  }
1116
1257
  this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
1117
1258
  this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
1118
- var globalViewport = this._host._getGlobalViewport(scene);
1259
+ var globalViewport = this._host._getGlobalViewport();
1119
1260
  var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);
1120
1261
  this._moveToProjectedPosition(projectedPosition);
1121
1262
  if (projectedPosition.z < 0 || projectedPosition.z > 1) {
@@ -1151,7 +1292,7 @@ var Control = /** @class */ (function () {
1151
1292
  * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
1152
1293
  */
1153
1294
  Control.prototype.linkWithMesh = function (mesh) {
1154
- if (!this._host || this.parent && this.parent !== this._host._rootContainer) {
1295
+ if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
1155
1296
  if (mesh) {
1156
1297
  Tools.Error("Cannot link a control to a mesh if the control is not at root level");
1157
1298
  }
@@ -1174,13 +1315,13 @@ var Control = /** @class */ (function () {
1174
1315
  this._host._linkedControls.push(this);
1175
1316
  };
1176
1317
  /**
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
- */
1318
+ * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
1319
+ * @param { string | number} paddingTop - The value of the top padding.
1320
+ * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
1321
+ * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
1322
+ * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
1323
+ * @see https://doc.babylonjs.com/how_to/gui#position-and-size
1324
+ */
1184
1325
  Control.prototype.setPadding = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
1185
1326
  var top = paddingTop;
1186
1327
  var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
@@ -1211,10 +1352,17 @@ var Control = /** @class */ (function () {
1211
1352
  };
1212
1353
  /** @hidden */
1213
1354
  Control.prototype._moveToProjectedPosition = function (projectedPosition) {
1355
+ var _a;
1214
1356
  var oldLeft = this._left.getValue(this._host);
1215
1357
  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);
1358
+ if (this._currentMeasure.width === 0 && this._currentMeasure.height === 0) {
1359
+ var parentMeasure = (_a = this.parent) === null || _a === void 0 ? void 0 : _a._currentMeasure;
1360
+ if (parentMeasure) {
1361
+ this._processMeasures(parentMeasure, this._host.getContext());
1362
+ }
1363
+ }
1364
+ var newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
1365
+ var newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
1218
1366
  if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
1219
1367
  if (Math.abs(newLeft - oldLeft) < 0.5) {
1220
1368
  newLeft = oldLeft;
@@ -1267,6 +1415,14 @@ var Control = /** @class */ (function () {
1267
1415
  return true;
1268
1416
  };
1269
1417
  /** @hidden */
1418
+ Control.prototype._computeAdditionnalOffsetX = function () {
1419
+ return 0;
1420
+ };
1421
+ /** @hidden */
1422
+ Control.prototype._computeAdditionnalOffsetY = function () {
1423
+ return 0;
1424
+ };
1425
+ /** @hidden */
1270
1426
  Control.prototype.invalidateRect = function () {
1271
1427
  this._transform();
1272
1428
  if (this.host && this.host.useInvalidateRectOptimization) {
@@ -1275,20 +1431,17 @@ var Control = /** @class */ (function () {
1275
1431
  // get the boudning box of the current measure and last frames measure in global space and invalidate it
1276
1432
  // the previous measure is used to properly clear a control that is scaled down
1277
1433
  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
- }
1434
+ // Expand rect based on shadows
1435
+ var shadowOffsetX = this.shadowOffsetX;
1436
+ var shadowOffsetY = this.shadowOffsetY;
1437
+ var shadowBlur = Math.max(this._previousShadowBlur, this.shadowBlur);
1438
+ var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
1439
+ var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
1440
+ var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
1441
+ var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
1442
+ var offsetX = this._computeAdditionnalOffsetX();
1443
+ var offsetY = this._computeAdditionnalOffsetY();
1444
+ 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
1445
  }
1293
1446
  };
1294
1447
  /** @hidden */
@@ -1350,8 +1503,8 @@ var Control = /** @class */ (function () {
1350
1503
  return;
1351
1504
  }
1352
1505
  context.save();
1353
- context.strokeStyle = "#4affff";
1354
- context.lineWidth = 2;
1506
+ context.strokeStyle = this._highlightColor;
1507
+ context.lineWidth = this._highlightLineWidth;
1355
1508
  this._renderHighlightSpecific(context);
1356
1509
  context.restore();
1357
1510
  };
@@ -1364,6 +1517,9 @@ var Control = /** @class */ (function () {
1364
1517
  if (this._isFontSizeInPercentage) {
1365
1518
  this._fontSet = true;
1366
1519
  }
1520
+ if (this._host && this._host.useSmallestIdeal && !this._font) {
1521
+ this._fontSet = true;
1522
+ }
1367
1523
  if (this._fontSet) {
1368
1524
  this._prepareFont();
1369
1525
  this._fontSet = false;
@@ -1378,7 +1534,7 @@ var Control = /** @class */ (function () {
1378
1534
  context.globalAlpha *= this._alpha;
1379
1535
  }
1380
1536
  else if (this._alphaSet) {
1381
- context.globalAlpha = this.parent ? this.parent.alpha * this._alpha : this._alpha;
1537
+ context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
1382
1538
  }
1383
1539
  };
1384
1540
  /** @hidden */
@@ -1388,7 +1544,7 @@ var Control = /** @class */ (function () {
1388
1544
  }
1389
1545
  if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
1390
1546
  this.host._numLayoutCalls++;
1391
- this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this.paddingLeftInPixels | 0, -this.paddingTopInPixels | 0, this.paddingRightInPixels | 0, this.paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
1547
+ this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this._paddingLeftInPixels | 0, -this._paddingTopInPixels | 0, this._paddingRightInPixels | 0, this._paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
1392
1548
  context.save();
1393
1549
  this._applyStates(context);
1394
1550
  var rebuildCount = 0;
@@ -1410,39 +1566,50 @@ var Control = /** @class */ (function () {
1410
1566
  };
1411
1567
  /** @hidden */
1412
1568
  Control.prototype._processMeasures = function (parentMeasure, context) {
1413
- this._currentMeasure.copyFrom(parentMeasure);
1569
+ this._tempPaddingMeasure.copyFrom(parentMeasure);
1570
+ // Apply padding if in correct mode
1571
+ if (this.parent && this.parent.descendantsOnlyPadding) {
1572
+ this._tempPaddingMeasure.left += this.parent.paddingLeftInPixels;
1573
+ this._tempPaddingMeasure.top += this.parent.paddingTopInPixels;
1574
+ this._tempPaddingMeasure.width -= this.parent.paddingLeftInPixels + this.parent.paddingRightInPixels;
1575
+ this._tempPaddingMeasure.height -= this.parent.paddingTopInPixels + this.parent.paddingBottomInPixels;
1576
+ }
1577
+ this._currentMeasure.copyFrom(this._tempPaddingMeasure);
1414
1578
  // Let children take some pre-measurement actions
1415
- this._preMeasure(parentMeasure, context);
1579
+ this._preMeasure(this._tempPaddingMeasure, context);
1416
1580
  this._measure();
1417
- this._computeAlignment(parentMeasure, context);
1581
+ this._computeAlignment(this._tempPaddingMeasure, context);
1418
1582
  // Convert to int values
1419
1583
  this._currentMeasure.left = this._currentMeasure.left | 0;
1420
1584
  this._currentMeasure.top = this._currentMeasure.top | 0;
1421
1585
  this._currentMeasure.width = this._currentMeasure.width | 0;
1422
1586
  this._currentMeasure.height = this._currentMeasure.height | 0;
1423
1587
  // Let children add more features
1424
- this._additionalProcessing(parentMeasure, context);
1425
- this._cachedParentMeasure.copyFrom(parentMeasure);
1588
+ this._additionalProcessing(this._tempPaddingMeasure, context);
1589
+ this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure);
1590
+ this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
1426
1591
  if (this.onDirtyObservable.hasObservers()) {
1427
1592
  this.onDirtyObservable.notifyObservers(this);
1428
1593
  }
1429
1594
  };
1430
1595
  Control.prototype._evaluateClippingState = function (parentMeasure) {
1596
+ this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
1431
1597
  if (this.parent && this.parent.clipChildren) {
1598
+ parentMeasure.transformToRef(this.parent._transformMatrix, this._evaluatedParentMeasure);
1432
1599
  // Early clip
1433
- if (this._currentMeasure.left > parentMeasure.left + parentMeasure.width) {
1600
+ if (this._evaluatedMeasure.left > this._evaluatedParentMeasure.left + this._evaluatedParentMeasure.width) {
1434
1601
  this._isClipped = true;
1435
1602
  return;
1436
1603
  }
1437
- if (this._currentMeasure.left + this._currentMeasure.width < parentMeasure.left) {
1604
+ if (this._evaluatedMeasure.left + this._evaluatedMeasure.width < this._evaluatedParentMeasure.left) {
1438
1605
  this._isClipped = true;
1439
1606
  return;
1440
1607
  }
1441
- if (this._currentMeasure.top > parentMeasure.top + parentMeasure.height) {
1608
+ if (this._evaluatedMeasure.top > this._evaluatedParentMeasure.top + this._evaluatedParentMeasure.height) {
1442
1609
  this._isClipped = true;
1443
1610
  return;
1444
1611
  }
1445
- if (this._currentMeasure.top + this._currentMeasure.height < parentMeasure.top) {
1612
+ if (this._evaluatedMeasure.top + this._evaluatedMeasure.height < this._evaluatedParentMeasure.top) {
1446
1613
  this._isClipped = true;
1447
1614
  return;
1448
1615
  }
@@ -1504,33 +1671,35 @@ var Control = /** @class */ (function () {
1504
1671
  y = (parentHeight - height) / 2;
1505
1672
  break;
1506
1673
  }
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);
1674
+ if (!this.descendantsOnlyPadding) {
1675
+ if (this._paddingLeft.isPixel) {
1676
+ this._currentMeasure.left += this._paddingLeft.getValue(this._host);
1677
+ this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
1678
+ }
1679
+ else {
1680
+ this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
1681
+ this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
1682
+ }
1683
+ if (this._paddingRight.isPixel) {
1684
+ this._currentMeasure.width -= this._paddingRight.getValue(this._host);
1685
+ }
1686
+ else {
1687
+ this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
1688
+ }
1689
+ if (this._paddingTop.isPixel) {
1690
+ this._currentMeasure.top += this._paddingTop.getValue(this._host);
1691
+ this._currentMeasure.height -= this._paddingTop.getValue(this._host);
1692
+ }
1693
+ else {
1694
+ this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
1695
+ this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
1696
+ }
1697
+ if (this._paddingBottom.isPixel) {
1698
+ this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
1699
+ }
1700
+ else {
1701
+ this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
1702
+ }
1534
1703
  }
1535
1704
  if (this._left.isPixel) {
1536
1705
  this._currentMeasure.left += this._left.getValue(this._host);
@@ -1684,7 +1853,8 @@ var Control = /** @class */ (function () {
1684
1853
  if (this._enterCount > 0) {
1685
1854
  return false;
1686
1855
  }
1687
- if (this._enterCount === -1) { // -1 is for touch input, we are now sure we are with a mouse or pencil
1856
+ if (this._enterCount === -1) {
1857
+ // -1 is for touch input, we are now sure we are with a mouse or pencil
1688
1858
  this._enterCount = 0;
1689
1859
  }
1690
1860
  this._enterCount++;
@@ -1815,6 +1985,8 @@ var Control = /** @class */ (function () {
1815
1985
  this._font = this._fontStyle + " " + this._fontWeight + " " + this.fontSizeInPixels + "px " + this._fontFamily;
1816
1986
  }
1817
1987
  this._fontOffset = Control._GetFontOffset(this._font);
1988
+ //children need to be refreshed
1989
+ this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
1818
1990
  };
1819
1991
  /**
1820
1992
  * Serializes the current control
@@ -1825,7 +1997,7 @@ var Control = /** @class */ (function () {
1825
1997
  serializationObject.name = this.name;
1826
1998
  serializationObject.className = this.getClassName();
1827
1999
  if (this._font) {
1828
- serializationObject.fontFamily = this.fontFamily;
2000
+ serializationObject.fontFamily = this._fontFamily;
1829
2001
  serializationObject.fontSize = this.fontSize;
1830
2002
  serializationObject.fontWeight = this.fontWeight;
1831
2003
  serializationObject.fontStyle = this.fontStyle;
@@ -1929,30 +2101,11 @@ var Control = /** @class */ (function () {
1929
2101
  if (Control._FontHeightSizes[font]) {
1930
2102
  return Control._FontHeightSizes[font];
1931
2103
  }
1932
- var text = document.createElement("span");
1933
- text.innerHTML = "Hg";
1934
- text.setAttribute('style', "font: " + font + " !important");
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 };
2104
+ var engine = Engine.LastCreatedEngine;
2105
+ if (!engine) {
2106
+ throw new Error("Invalid engine. Unable to create a canvas.");
2107
+ }
2108
+ var result = engine.getFontOffset(font);
1956
2109
  Control._FontHeightSizes[font] = result;
1957
2110
  return result;
1958
2111
  };
@@ -2090,6 +2243,9 @@ var Control = /** @class */ (function () {
2090
2243
  __decorate([
2091
2244
  serialize()
2092
2245
  ], Control.prototype, "isVisible", null);
2246
+ __decorate([
2247
+ serialize()
2248
+ ], Control.prototype, "descendantsOnlyPadding", null);
2093
2249
  __decorate([
2094
2250
  serialize()
2095
2251
  ], Control.prototype, "paddingLeft", null);
@@ -2123,8 +2279,14 @@ var Control = /** @class */ (function () {
2123
2279
  __decorate([
2124
2280
  serialize()
2125
2281
  ], Control.prototype, "disabledColorItem", null);
2282
+ __decorate([
2283
+ serialize()
2284
+ ], Control.prototype, "overlapGroup", void 0);
2285
+ __decorate([
2286
+ serialize()
2287
+ ], Control.prototype, "overlapDeltaMultiplier", void 0);
2126
2288
  return Control;
2127
2289
  }());
2128
2290
  export { Control };
2129
- _TypeStore.RegisteredTypes["BABYLON.GUI.Control"] = Control;
2291
+ RegisterClass("BABYLON.GUI.Control", Control);
2130
2292
  //# sourceMappingURL=control.js.map