@babylonjs/gui 5.0.0-alpha.6 → 5.0.0-alpha.63

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 (275) 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.js +10 -10
  6. package/2D/controls/button.js.map +1 -1
  7. package/2D/controls/checkbox.d.ts +2 -1
  8. package/2D/controls/checkbox.js +10 -8
  9. package/2D/controls/checkbox.js.map +1 -1
  10. package/2D/controls/colorpicker.d.ts +4 -3
  11. package/2D/controls/colorpicker.js +40 -23
  12. package/2D/controls/colorpicker.js.map +1 -1
  13. package/2D/controls/container.d.ts +16 -5
  14. package/2D/controls/container.js +93 -15
  15. package/2D/controls/container.js.map +1 -1
  16. package/2D/controls/control.d.ts +99 -44
  17. package/2D/controls/control.js +267 -129
  18. package/2D/controls/control.js.map +1 -1
  19. package/2D/controls/displayGrid.d.ts +2 -1
  20. package/2D/controls/displayGrid.js +6 -6
  21. package/2D/controls/displayGrid.js.map +1 -1
  22. package/2D/controls/ellipse.d.ts +5 -3
  23. package/2D/controls/ellipse.js +9 -5
  24. package/2D/controls/ellipse.js.map +1 -1
  25. package/2D/controls/focusableButton.d.ts +4 -2
  26. package/2D/controls/focusableButton.js +9 -6
  27. package/2D/controls/focusableButton.js.map +1 -1
  28. package/2D/controls/focusableControl.d.ts +2 -1
  29. package/2D/controls/focusableControl.js.map +1 -1
  30. package/2D/controls/grid.d.ts +13 -2
  31. package/2D/controls/grid.js +108 -24
  32. package/2D/controls/grid.js.map +1 -1
  33. package/2D/controls/image.d.ts +20 -12
  34. package/2D/controls/image.js +154 -111
  35. package/2D/controls/image.js.map +1 -1
  36. package/2D/controls/index.js +29 -29
  37. package/2D/controls/inputPassword.js +4 -4
  38. package/2D/controls/inputPassword.js.map +1 -1
  39. package/2D/controls/inputText.d.ts +6 -4
  40. package/2D/controls/inputText.js +40 -14
  41. package/2D/controls/inputText.js.map +1 -1
  42. package/2D/controls/line.d.ts +3 -2
  43. package/2D/controls/line.js +8 -8
  44. package/2D/controls/line.js.map +1 -1
  45. package/2D/controls/multiLine.d.ts +4 -3
  46. package/2D/controls/multiLine.js +6 -6
  47. package/2D/controls/multiLine.js.map +1 -1
  48. package/2D/controls/radioButton.d.ts +2 -1
  49. package/2D/controls/radioButton.js +10 -7
  50. package/2D/controls/radioButton.js.map +1 -1
  51. package/2D/controls/rectangle.d.ts +8 -3
  52. package/2D/controls/rectangle.js +21 -5
  53. package/2D/controls/rectangle.js.map +1 -1
  54. package/2D/controls/scrollViewers/scrollViewer.d.ts +3 -2
  55. package/2D/controls/scrollViewers/scrollViewer.js +9 -9
  56. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
  57. package/2D/controls/scrollViewers/scrollViewerWindow.d.ts +4 -3
  58. package/2D/controls/scrollViewers/scrollViewerWindow.js +4 -4
  59. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  60. package/2D/controls/selector.js +8 -8
  61. package/2D/controls/selector.js.map +1 -1
  62. package/2D/controls/sliders/baseSlider.d.ts +1 -1
  63. package/2D/controls/sliders/baseSlider.js +12 -10
  64. package/2D/controls/sliders/baseSlider.js.map +1 -1
  65. package/2D/controls/sliders/imageBasedSlider.d.ts +10 -1
  66. package/2D/controls/sliders/imageBasedSlider.js +29 -5
  67. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  68. package/2D/controls/sliders/imageScrollBar.d.ts +2 -1
  69. package/2D/controls/sliders/imageScrollBar.js +3 -3
  70. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  71. package/2D/controls/sliders/scrollBar.d.ts +2 -1
  72. package/2D/controls/sliders/scrollBar.js +3 -3
  73. package/2D/controls/sliders/scrollBar.js.map +1 -1
  74. package/2D/controls/sliders/slider.d.ts +2 -1
  75. package/2D/controls/sliders/slider.js +4 -4
  76. package/2D/controls/sliders/slider.js.map +1 -1
  77. package/2D/controls/stackPanel.d.ts +10 -3
  78. package/2D/controls/stackPanel.js +35 -13
  79. package/2D/controls/stackPanel.js.map +1 -1
  80. package/2D/controls/statics.js +3 -3
  81. package/2D/controls/statics.js.map +1 -1
  82. package/2D/controls/textBlock.d.ts +9 -8
  83. package/2D/controls/textBlock.js +30 -20
  84. package/2D/controls/textBlock.js.map +1 -1
  85. package/2D/controls/textWrapper.js +2 -2
  86. package/2D/controls/textWrapper.js.map +1 -1
  87. package/2D/controls/toggleButton.d.ts +1 -13
  88. package/2D/controls/toggleButton.js +29 -38
  89. package/2D/controls/toggleButton.js.map +1 -1
  90. package/2D/controls/virtualKeyboard.js +5 -5
  91. package/2D/controls/virtualKeyboard.js.map +1 -1
  92. package/2D/index.d.ts +1 -1
  93. package/2D/index.js +9 -9
  94. package/2D/index.js.map +1 -1
  95. package/2D/math2D.js +2 -2
  96. package/2D/measure.js +1 -1
  97. package/2D/measure.js.map +1 -1
  98. package/2D/multiLinePoint.js +3 -3
  99. package/2D/style.js +2 -2
  100. package/2D/valueAndUnit.d.ts +21 -6
  101. package/2D/valueAndUnit.js +57 -13
  102. package/2D/valueAndUnit.js.map +1 -1
  103. package/2D/xmlLoader.d.ts +17 -3
  104. package/2D/xmlLoader.js +54 -15
  105. package/2D/xmlLoader.js.map +1 -1
  106. package/3D/behaviors/defaultBehavior.d.ts +73 -0
  107. package/3D/behaviors/defaultBehavior.js +122 -0
  108. package/3D/behaviors/defaultBehavior.js.map +1 -0
  109. package/3D/controls/abstractButton3D.d.ts +2 -2
  110. package/3D/controls/abstractButton3D.js +3 -3
  111. package/3D/controls/abstractButton3D.js.map +1 -1
  112. package/3D/controls/button3D.d.ts +0 -24
  113. package/3D/controls/button3D.js +7 -83
  114. package/3D/controls/button3D.js.map +1 -1
  115. package/3D/controls/container3D.js +2 -2
  116. package/3D/controls/contentDisplay3D.d.ts +30 -0
  117. package/3D/controls/contentDisplay3D.js +79 -0
  118. package/3D/controls/contentDisplay3D.js.map +1 -0
  119. package/3D/controls/control3D.d.ts +10 -7
  120. package/3D/controls/control3D.js +42 -28
  121. package/3D/controls/control3D.js.map +1 -1
  122. package/3D/controls/cylinderPanel.js +5 -5
  123. package/3D/controls/handMenu.d.ts +28 -0
  124. package/3D/controls/handMenu.js +48 -0
  125. package/3D/controls/handMenu.js.map +1 -0
  126. package/3D/controls/holographicBackplate.d.ts +48 -0
  127. package/3D/controls/holographicBackplate.js +121 -0
  128. package/3D/controls/holographicBackplate.js.map +1 -0
  129. package/3D/controls/holographicButton.d.ts +1 -1
  130. package/3D/controls/holographicButton.js +27 -24
  131. package/3D/controls/holographicButton.js.map +1 -1
  132. package/3D/controls/holographicSlate.d.ts +118 -0
  133. package/3D/controls/holographicSlate.js +360 -0
  134. package/3D/controls/holographicSlate.js.map +1 -0
  135. package/3D/controls/index.d.ts +10 -0
  136. package/3D/controls/index.js +22 -12
  137. package/3D/controls/index.js.map +1 -1
  138. package/3D/controls/meshButton3D.js +2 -2
  139. package/3D/controls/meshButton3D.js.map +1 -1
  140. package/3D/controls/nearMenu.d.ts +45 -0
  141. package/3D/controls/nearMenu.js +111 -0
  142. package/3D/controls/nearMenu.js.map +1 -0
  143. package/3D/controls/planePanel.js +3 -3
  144. package/3D/controls/scatterPanel.js +4 -4
  145. package/3D/controls/slider3D.d.ts +80 -0
  146. package/3D/controls/slider3D.js +268 -0
  147. package/3D/controls/slider3D.js.map +1 -0
  148. package/3D/controls/spherePanel.js +5 -5
  149. package/3D/controls/stackPanel3D.js +3 -3
  150. package/3D/controls/touchButton3D.d.ts +43 -0
  151. package/3D/controls/touchButton3D.js +133 -0
  152. package/3D/controls/touchButton3D.js.map +1 -0
  153. package/3D/controls/touchHolographicButton.d.ts +100 -0
  154. package/3D/controls/touchHolographicButton.js +408 -0
  155. package/3D/controls/touchHolographicButton.js.map +1 -0
  156. package/3D/controls/touchHolographicMenu.d.ts +61 -0
  157. package/3D/controls/touchHolographicMenu.js +149 -0
  158. package/3D/controls/touchHolographicMenu.js.map +1 -0
  159. package/3D/controls/touchMeshButton3D.d.ts +22 -0
  160. package/3D/controls/touchMeshButton3D.js +63 -0
  161. package/3D/controls/touchMeshButton3D.js.map +1 -0
  162. package/3D/controls/touchToggleButton3D.d.ts +35 -0
  163. package/3D/controls/touchToggleButton3D.js +60 -0
  164. package/3D/controls/touchToggleButton3D.js.map +1 -0
  165. package/3D/controls/volumeBasedPanel.d.ts +1 -1
  166. package/3D/controls/volumeBasedPanel.js +5 -5
  167. package/3D/controls/volumeBasedPanel.js.map +1 -1
  168. package/3D/gizmos/gizmoHandle.d.ts +108 -0
  169. package/3D/gizmos/gizmoHandle.js +210 -0
  170. package/3D/gizmos/gizmoHandle.js.map +1 -0
  171. package/3D/gizmos/index.d.ts +2 -0
  172. package/3D/gizmos/index.js +3 -0
  173. package/3D/gizmos/index.js.map +1 -0
  174. package/3D/gizmos/slateGizmo.d.ts +59 -0
  175. package/3D/gizmos/slateGizmo.js +364 -0
  176. package/3D/gizmos/slateGizmo.js.map +1 -0
  177. package/3D/gui3DManager.d.ts +19 -0
  178. package/3D/gui3DManager.js +73 -13
  179. package/3D/gui3DManager.js.map +1 -1
  180. package/3D/index.d.ts +3 -2
  181. package/3D/index.js +5 -4
  182. package/3D/index.js.map +1 -1
  183. package/3D/materials/fluent/fluentMaterial.d.ts +90 -0
  184. package/3D/materials/fluent/fluentMaterial.js +282 -0
  185. package/3D/materials/fluent/fluentMaterial.js.map +1 -0
  186. package/3D/materials/fluent/index.d.ts +1 -0
  187. package/3D/materials/fluent/index.js +2 -0
  188. package/3D/materials/fluent/index.js.map +1 -0
  189. package/3D/materials/{shaders → fluent/shaders}/fluent.fragment.d.ts +0 -0
  190. package/3D/materials/fluent/shaders/fluent.fragment.js +7 -0
  191. package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -0
  192. package/3D/materials/{shaders → fluent/shaders}/fluent.vertex.d.ts +0 -0
  193. package/3D/materials/{shaders → fluent/shaders}/fluent.vertex.js +2 -2
  194. package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -0
  195. package/3D/materials/fluentBackplate/fluentBackplateMaterial.d.ts +154 -0
  196. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +435 -0
  197. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -0
  198. package/3D/materials/fluentBackplate/index.d.ts +1 -0
  199. package/3D/materials/fluentBackplate/index.js +2 -0
  200. package/3D/materials/fluentBackplate/index.js.map +1 -0
  201. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.d.ts +5 -0
  202. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +7 -0
  203. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -0
  204. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.d.ts +5 -0
  205. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +7 -0
  206. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -0
  207. package/3D/materials/fluentButton/fluentButtonMaterial.d.ts +189 -0
  208. package/3D/materials/fluentButton/fluentButtonMaterial.js +538 -0
  209. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -0
  210. package/3D/materials/fluentButton/index.d.ts +1 -0
  211. package/3D/materials/fluentButton/index.js +2 -0
  212. package/3D/materials/fluentButton/index.js.map +1 -0
  213. package/3D/materials/fluentButton/shaders/fluentButton.fragment.d.ts +5 -0
  214. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +7 -0
  215. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -0
  216. package/3D/materials/fluentButton/shaders/fluentButton.vertex.d.ts +5 -0
  217. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +7 -0
  218. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -0
  219. package/3D/materials/fluentMaterial.d.ts +2 -88
  220. package/3D/materials/fluentMaterial.js +2 -277
  221. package/3D/materials/fluentMaterial.js.map +1 -1
  222. package/3D/materials/handle/handleMaterial.d.ts +68 -0
  223. package/3D/materials/handle/handleMaterial.js +127 -0
  224. package/3D/materials/handle/handleMaterial.js.map +1 -0
  225. package/3D/materials/handle/index.d.ts +1 -0
  226. package/3D/materials/handle/index.js +2 -0
  227. package/3D/materials/handle/index.js.map +1 -0
  228. package/3D/materials/handle/shaders/handle.fragment.d.ts +5 -0
  229. package/3D/materials/handle/shaders/handle.fragment.js +7 -0
  230. package/3D/materials/handle/shaders/handle.fragment.js.map +1 -0
  231. package/3D/materials/handle/shaders/handle.vertex.d.ts +5 -0
  232. package/3D/materials/handle/shaders/handle.vertex.js +7 -0
  233. package/3D/materials/handle/shaders/handle.vertex.js.map +1 -0
  234. package/3D/materials/index.d.ts +5 -1
  235. package/3D/materials/index.js +5 -1
  236. package/3D/materials/index.js.map +1 -1
  237. package/3D/materials/mrdl/index.d.ts +3 -0
  238. package/3D/materials/mrdl/index.js +4 -0
  239. package/3D/materials/mrdl/index.js.map +1 -0
  240. package/3D/materials/mrdl/mrdlBackplateMaterial.d.ts +147 -0
  241. package/3D/materials/mrdl/mrdlBackplateMaterial.js +410 -0
  242. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -0
  243. package/3D/materials/mrdl/mrdlSliderBarMaterial.d.ts +333 -0
  244. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +787 -0
  245. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -0
  246. package/3D/materials/mrdl/mrdlSliderThumbMaterial.d.ts +333 -0
  247. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +787 -0
  248. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -0
  249. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.d.ts +5 -0
  250. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +7 -0
  251. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -0
  252. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.d.ts +5 -0
  253. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +7 -0
  254. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -0
  255. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.d.ts +5 -0
  256. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +7 -0
  257. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -0
  258. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.d.ts +5 -0
  259. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +7 -0
  260. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -0
  261. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.d.ts +5 -0
  262. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +7 -0
  263. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -0
  264. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.d.ts +5 -0
  265. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +7 -0
  266. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -0
  267. package/3D/vector3WithInfo.js +1 -1
  268. package/index.d.ts +2 -2
  269. package/index.js +2 -2
  270. package/index.js.map +1 -1
  271. package/legacy/legacy.js +2 -2
  272. package/package.json +126 -9
  273. package/3D/materials/shaders/fluent.fragment.js +0 -7
  274. package/3D/materials/shaders/fluent.fragment.js.map +0 -1
  275. 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._descendentsOnlyPadding = 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,20 @@ 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
+ });
182
206
  Object.defineProperty(Control.prototype, "shadowOffsetX", {
183
207
  /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
184
208
  get: function () {
@@ -218,6 +242,7 @@ var Control = /** @class */ (function () {
218
242
  if (this._shadowBlur === value) {
219
243
  return;
220
244
  }
245
+ this._previousShadowBlur = this._shadowBlur;
221
246
  this._shadowBlur = value;
222
247
  this._markAsDirty();
223
248
  },
@@ -292,6 +317,23 @@ var Control = /** @class */ (function () {
292
317
  enumerable: false,
293
318
  configurable: true
294
319
  });
320
+ Object.defineProperty(Control.prototype, "highlightLineWidth", {
321
+ /**
322
+ * Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)
323
+ */
324
+ get: function () {
325
+ return this._highlightLineWidth;
326
+ },
327
+ set: function (value) {
328
+ if (this._highlightLineWidth === value) {
329
+ return;
330
+ }
331
+ this._highlightLineWidth = value;
332
+ this._markAsDirty();
333
+ },
334
+ enumerable: false,
335
+ configurable: true
336
+ });
295
337
  Object.defineProperty(Control.prototype, "isHighlighted", {
296
338
  /**
297
339
  * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
@@ -309,10 +351,27 @@ var Control = /** @class */ (function () {
309
351
  enumerable: false,
310
352
  configurable: true
311
353
  });
354
+ Object.defineProperty(Control.prototype, "highlightColor", {
355
+ /**
356
+ * Gets or sets a string defining the color to use for highlighting this control
357
+ */
358
+ get: function () {
359
+ return this._highlightColor;
360
+ },
361
+ set: function (value) {
362
+ if (this._highlightColor === value) {
363
+ return;
364
+ }
365
+ this._highlightColor = value;
366
+ this._markAsDirty();
367
+ },
368
+ enumerable: false,
369
+ configurable: true
370
+ });
312
371
  Object.defineProperty(Control.prototype, "scaleX", {
313
372
  /** Gets or sets a value indicating the scale factor on X axis (1 by default)
314
373
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
315
- */
374
+ */
316
375
  get: function () {
317
376
  return this._scaleX;
318
377
  },
@@ -330,7 +389,7 @@ var Control = /** @class */ (function () {
330
389
  Object.defineProperty(Control.prototype, "scaleY", {
331
390
  /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
332
391
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
333
- */
392
+ */
334
393
  get: function () {
335
394
  return this._scaleY;
336
395
  },
@@ -348,7 +407,7 @@ var Control = /** @class */ (function () {
348
407
  Object.defineProperty(Control.prototype, "rotation", {
349
408
  /** Gets or sets the rotation angle (0 by default)
350
409
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
351
- */
410
+ */
352
411
  get: function () {
353
412
  return this._rotation;
354
413
  },
@@ -366,7 +425,7 @@ var Control = /** @class */ (function () {
366
425
  Object.defineProperty(Control.prototype, "transformCenterY", {
367
426
  /** Gets or sets the transformation center on Y axis (0 by default)
368
427
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
369
- */
428
+ */
370
429
  get: function () {
371
430
  return this._transformCenterY;
372
431
  },
@@ -384,7 +443,7 @@ var Control = /** @class */ (function () {
384
443
  Object.defineProperty(Control.prototype, "transformCenterX", {
385
444
  /** Gets or sets the transformation center on X axis (0 by default)
386
445
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
387
- */
446
+ */
388
447
  get: function () {
389
448
  return this._transformCenterX;
390
449
  },
@@ -514,9 +573,6 @@ var Control = /** @class */ (function () {
514
573
  Object.defineProperty(Control.prototype, "fontFamily", {
515
574
  /** Gets or set font family */
516
575
  get: function () {
517
- if (!this._fontSet) {
518
- return "";
519
- }
520
576
  return this._fontFamily;
521
577
  },
522
578
  set: function (value) {
@@ -709,6 +765,24 @@ var Control = /** @class */ (function () {
709
765
  enumerable: false,
710
766
  configurable: true
711
767
  });
768
+ Object.defineProperty(Control.prototype, "descendentsOnlyPadding", {
769
+ /**
770
+ * Gets or sets a value indicating the padding should work like in CSS.
771
+ * Basically, it will add the padding amount on each side of the parent control for its children.
772
+ */
773
+ get: function () {
774
+ return this._descendentsOnlyPadding;
775
+ },
776
+ set: function (value) {
777
+ if (this._descendentsOnlyPadding === value) {
778
+ return;
779
+ }
780
+ this._descendentsOnlyPadding = value;
781
+ this._markAsDirty();
782
+ },
783
+ enumerable: false,
784
+ configurable: true
785
+ });
712
786
  Object.defineProperty(Control.prototype, "paddingLeft", {
713
787
  /**
714
788
  * Gets or sets a value indicating the padding to use on the left of the control
@@ -742,6 +816,17 @@ var Control = /** @class */ (function () {
742
816
  enumerable: false,
743
817
  configurable: true
744
818
  });
819
+ Object.defineProperty(Control.prototype, "_paddingLeftInPixels", {
820
+ /** @hidden */
821
+ get: function () {
822
+ if (this._descendentsOnlyPadding) {
823
+ return 0;
824
+ }
825
+ return this.paddingLeftInPixels;
826
+ },
827
+ enumerable: false,
828
+ configurable: true
829
+ });
745
830
  Object.defineProperty(Control.prototype, "paddingRight", {
746
831
  /**
747
832
  * Gets or sets a value indicating the padding to use on the right of the control
@@ -775,6 +860,17 @@ var Control = /** @class */ (function () {
775
860
  enumerable: false,
776
861
  configurable: true
777
862
  });
863
+ Object.defineProperty(Control.prototype, "_paddingRightInPixels", {
864
+ /** @hidden */
865
+ get: function () {
866
+ if (this._descendentsOnlyPadding) {
867
+ return 0;
868
+ }
869
+ return this.paddingRightInPixels;
870
+ },
871
+ enumerable: false,
872
+ configurable: true
873
+ });
778
874
  Object.defineProperty(Control.prototype, "paddingTop", {
779
875
  /**
780
876
  * Gets or sets a value indicating the padding to use on the top of the control
@@ -808,6 +904,17 @@ var Control = /** @class */ (function () {
808
904
  enumerable: false,
809
905
  configurable: true
810
906
  });
907
+ Object.defineProperty(Control.prototype, "_paddingTopInPixels", {
908
+ /** @hidden */
909
+ get: function () {
910
+ if (this._descendentsOnlyPadding) {
911
+ return 0;
912
+ }
913
+ return this.paddingTopInPixels;
914
+ },
915
+ enumerable: false,
916
+ configurable: true
917
+ });
811
918
  Object.defineProperty(Control.prototype, "paddingBottom", {
812
919
  /**
813
920
  * Gets or sets a value indicating the padding to use on the bottom of the control
@@ -841,6 +948,17 @@ var Control = /** @class */ (function () {
841
948
  enumerable: false,
842
949
  configurable: true
843
950
  });
951
+ Object.defineProperty(Control.prototype, "_paddingBottomInPixels", {
952
+ /** @hidden */
953
+ get: function () {
954
+ if (this._descendentsOnlyPadding) {
955
+ return 0;
956
+ }
957
+ return this.paddingBottomInPixels;
958
+ },
959
+ enumerable: false,
960
+ configurable: true
961
+ });
844
962
  Object.defineProperty(Control.prototype, "left", {
845
963
  /**
846
964
  * Gets or sets a value indicating the left coordinate of the control
@@ -1115,7 +1233,7 @@ var Control = /** @class */ (function () {
1115
1233
  }
1116
1234
  this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
1117
1235
  this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
1118
- var globalViewport = this._host._getGlobalViewport(scene);
1236
+ var globalViewport = this._host._getGlobalViewport();
1119
1237
  var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);
1120
1238
  this._moveToProjectedPosition(projectedPosition);
1121
1239
  if (projectedPosition.z < 0 || projectedPosition.z > 1) {
@@ -1151,7 +1269,7 @@ var Control = /** @class */ (function () {
1151
1269
  * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
1152
1270
  */
1153
1271
  Control.prototype.linkWithMesh = function (mesh) {
1154
- if (!this._host || this.parent && this.parent !== this._host._rootContainer) {
1272
+ if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
1155
1273
  if (mesh) {
1156
1274
  Tools.Error("Cannot link a control to a mesh if the control is not at root level");
1157
1275
  }
@@ -1174,13 +1292,13 @@ var Control = /** @class */ (function () {
1174
1292
  this._host._linkedControls.push(this);
1175
1293
  };
1176
1294
  /**
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
- */
1295
+ * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
1296
+ * @param { string | number} paddingTop - The value of the top padding.
1297
+ * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
1298
+ * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
1299
+ * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
1300
+ * @see https://doc.babylonjs.com/how_to/gui#position-and-size
1301
+ */
1184
1302
  Control.prototype.setPadding = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
1185
1303
  var top = paddingTop;
1186
1304
  var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
@@ -1211,10 +1329,17 @@ var Control = /** @class */ (function () {
1211
1329
  };
1212
1330
  /** @hidden */
1213
1331
  Control.prototype._moveToProjectedPosition = function (projectedPosition) {
1332
+ var _a;
1214
1333
  var oldLeft = this._left.getValue(this._host);
1215
1334
  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);
1335
+ if (this._currentMeasure.width === 0 && this._currentMeasure.height === 0) {
1336
+ var parentMeasure = (_a = this.parent) === null || _a === void 0 ? void 0 : _a._currentMeasure;
1337
+ if (parentMeasure) {
1338
+ this._processMeasures(parentMeasure, this._host.getContext());
1339
+ }
1340
+ }
1341
+ var newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
1342
+ var newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
1218
1343
  if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
1219
1344
  if (Math.abs(newLeft - oldLeft) < 0.5) {
1220
1345
  newLeft = oldLeft;
@@ -1267,6 +1392,14 @@ var Control = /** @class */ (function () {
1267
1392
  return true;
1268
1393
  };
1269
1394
  /** @hidden */
1395
+ Control.prototype._computeAdditionnalOffsetX = function () {
1396
+ return 0;
1397
+ };
1398
+ /** @hidden */
1399
+ Control.prototype._computeAdditionnalOffsetY = function () {
1400
+ return 0;
1401
+ };
1402
+ /** @hidden */
1270
1403
  Control.prototype.invalidateRect = function () {
1271
1404
  this._transform();
1272
1405
  if (this.host && this.host.useInvalidateRectOptimization) {
@@ -1275,20 +1408,17 @@ var Control = /** @class */ (function () {
1275
1408
  // get the boudning box of the current measure and last frames measure in global space and invalidate it
1276
1409
  // the previous measure is used to properly clear a control that is scaled down
1277
1410
  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
- }
1411
+ // Expand rect based on shadows
1412
+ var shadowOffsetX = this.shadowOffsetX;
1413
+ var shadowOffsetY = this.shadowOffsetY;
1414
+ var shadowBlur = Math.max(this._previousShadowBlur, this.shadowBlur);
1415
+ var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
1416
+ var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
1417
+ var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
1418
+ var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
1419
+ var offsetX = this._computeAdditionnalOffsetX();
1420
+ var offsetY = this._computeAdditionnalOffsetY();
1421
+ 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
1422
  }
1293
1423
  };
1294
1424
  /** @hidden */
@@ -1350,8 +1480,8 @@ var Control = /** @class */ (function () {
1350
1480
  return;
1351
1481
  }
1352
1482
  context.save();
1353
- context.strokeStyle = "#4affff";
1354
- context.lineWidth = 2;
1483
+ context.strokeStyle = this._highlightColor;
1484
+ context.lineWidth = this._highlightLineWidth;
1355
1485
  this._renderHighlightSpecific(context);
1356
1486
  context.restore();
1357
1487
  };
@@ -1364,6 +1494,9 @@ var Control = /** @class */ (function () {
1364
1494
  if (this._isFontSizeInPercentage) {
1365
1495
  this._fontSet = true;
1366
1496
  }
1497
+ if (this._host && this._host.useSmallestIdeal && !this._font) {
1498
+ this._fontSet = true;
1499
+ }
1367
1500
  if (this._fontSet) {
1368
1501
  this._prepareFont();
1369
1502
  this._fontSet = false;
@@ -1378,7 +1511,7 @@ var Control = /** @class */ (function () {
1378
1511
  context.globalAlpha *= this._alpha;
1379
1512
  }
1380
1513
  else if (this._alphaSet) {
1381
- context.globalAlpha = this.parent ? this.parent.alpha * this._alpha : this._alpha;
1514
+ context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
1382
1515
  }
1383
1516
  };
1384
1517
  /** @hidden */
@@ -1388,7 +1521,7 @@ var Control = /** @class */ (function () {
1388
1521
  }
1389
1522
  if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
1390
1523
  this.host._numLayoutCalls++;
1391
- this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this.paddingLeftInPixels | 0, -this.paddingTopInPixels | 0, this.paddingRightInPixels | 0, this.paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
1524
+ this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this._paddingLeftInPixels | 0, -this._paddingTopInPixels | 0, this._paddingRightInPixels | 0, this._paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
1392
1525
  context.save();
1393
1526
  this._applyStates(context);
1394
1527
  var rebuildCount = 0;
@@ -1410,39 +1543,49 @@ var Control = /** @class */ (function () {
1410
1543
  };
1411
1544
  /** @hidden */
1412
1545
  Control.prototype._processMeasures = function (parentMeasure, context) {
1413
- this._currentMeasure.copyFrom(parentMeasure);
1546
+ this._tempPaddingMeasure.copyFrom(parentMeasure);
1547
+ // Apply padding if in correct mode
1548
+ if (this.parent && this.parent.descendentsOnlyPadding) {
1549
+ this._tempPaddingMeasure.left += this.parent.paddingLeftInPixels;
1550
+ this._tempPaddingMeasure.top += this.parent.paddingTopInPixels;
1551
+ this._tempPaddingMeasure.width -= this.parent.paddingLeftInPixels + this.parent.paddingRightInPixels;
1552
+ this._tempPaddingMeasure.height -= this.parent.paddingTopInPixels + this.parent.paddingBottomInPixels;
1553
+ }
1554
+ this._currentMeasure.copyFrom(this._tempPaddingMeasure);
1414
1555
  // Let children take some pre-measurement actions
1415
- this._preMeasure(parentMeasure, context);
1556
+ this._preMeasure(this._tempPaddingMeasure, context);
1416
1557
  this._measure();
1417
- this._computeAlignment(parentMeasure, context);
1558
+ this._computeAlignment(this._tempPaddingMeasure, context);
1418
1559
  // Convert to int values
1419
1560
  this._currentMeasure.left = this._currentMeasure.left | 0;
1420
1561
  this._currentMeasure.top = this._currentMeasure.top | 0;
1421
1562
  this._currentMeasure.width = this._currentMeasure.width | 0;
1422
1563
  this._currentMeasure.height = this._currentMeasure.height | 0;
1423
1564
  // Let children add more features
1424
- this._additionalProcessing(parentMeasure, context);
1425
- this._cachedParentMeasure.copyFrom(parentMeasure);
1565
+ this._additionalProcessing(this._tempPaddingMeasure, context);
1566
+ this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure);
1426
1567
  if (this.onDirtyObservable.hasObservers()) {
1427
1568
  this.onDirtyObservable.notifyObservers(this);
1428
1569
  }
1429
1570
  };
1430
1571
  Control.prototype._evaluateClippingState = function (parentMeasure) {
1572
+ this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
1431
1573
  if (this.parent && this.parent.clipChildren) {
1574
+ parentMeasure.transformToRef(this.parent._transformMatrix, this._evaluatedParentMeasure);
1432
1575
  // Early clip
1433
- if (this._currentMeasure.left > parentMeasure.left + parentMeasure.width) {
1576
+ if (this._evaluatedMeasure.left > this._evaluatedParentMeasure.left + this._evaluatedParentMeasure.width) {
1434
1577
  this._isClipped = true;
1435
1578
  return;
1436
1579
  }
1437
- if (this._currentMeasure.left + this._currentMeasure.width < parentMeasure.left) {
1580
+ if (this._evaluatedMeasure.left + this._evaluatedMeasure.width < this._evaluatedParentMeasure.left) {
1438
1581
  this._isClipped = true;
1439
1582
  return;
1440
1583
  }
1441
- if (this._currentMeasure.top > parentMeasure.top + parentMeasure.height) {
1584
+ if (this._evaluatedMeasure.top > this._evaluatedParentMeasure.top + this._evaluatedParentMeasure.height) {
1442
1585
  this._isClipped = true;
1443
1586
  return;
1444
1587
  }
1445
- if (this._currentMeasure.top + this._currentMeasure.height < parentMeasure.top) {
1588
+ if (this._evaluatedMeasure.top + this._evaluatedMeasure.height < this._evaluatedParentMeasure.top) {
1446
1589
  this._isClipped = true;
1447
1590
  return;
1448
1591
  }
@@ -1504,33 +1647,35 @@ var Control = /** @class */ (function () {
1504
1647
  y = (parentHeight - height) / 2;
1505
1648
  break;
1506
1649
  }
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);
1650
+ if (!this.descendentsOnlyPadding) {
1651
+ if (this._paddingLeft.isPixel) {
1652
+ this._currentMeasure.left += this._paddingLeft.getValue(this._host);
1653
+ this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
1654
+ }
1655
+ else {
1656
+ this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
1657
+ this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
1658
+ }
1659
+ if (this._paddingRight.isPixel) {
1660
+ this._currentMeasure.width -= this._paddingRight.getValue(this._host);
1661
+ }
1662
+ else {
1663
+ this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
1664
+ }
1665
+ if (this._paddingTop.isPixel) {
1666
+ this._currentMeasure.top += this._paddingTop.getValue(this._host);
1667
+ this._currentMeasure.height -= this._paddingTop.getValue(this._host);
1668
+ }
1669
+ else {
1670
+ this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
1671
+ this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
1672
+ }
1673
+ if (this._paddingBottom.isPixel) {
1674
+ this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
1675
+ }
1676
+ else {
1677
+ this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
1678
+ }
1534
1679
  }
1535
1680
  if (this._left.isPixel) {
1536
1681
  this._currentMeasure.left += this._left.getValue(this._host);
@@ -1684,7 +1829,8 @@ var Control = /** @class */ (function () {
1684
1829
  if (this._enterCount > 0) {
1685
1830
  return false;
1686
1831
  }
1687
- if (this._enterCount === -1) { // -1 is for touch input, we are now sure we are with a mouse or pencil
1832
+ if (this._enterCount === -1) {
1833
+ // -1 is for touch input, we are now sure we are with a mouse or pencil
1688
1834
  this._enterCount = 0;
1689
1835
  }
1690
1836
  this._enterCount++;
@@ -1815,6 +1961,8 @@ var Control = /** @class */ (function () {
1815
1961
  this._font = this._fontStyle + " " + this._fontWeight + " " + this.fontSizeInPixels + "px " + this._fontFamily;
1816
1962
  }
1817
1963
  this._fontOffset = Control._GetFontOffset(this._font);
1964
+ //children need to be refreshed
1965
+ this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
1818
1966
  };
1819
1967
  /**
1820
1968
  * Serializes the current control
@@ -1825,7 +1973,7 @@ var Control = /** @class */ (function () {
1825
1973
  serializationObject.name = this.name;
1826
1974
  serializationObject.className = this.getClassName();
1827
1975
  if (this._font) {
1828
- serializationObject.fontFamily = this.fontFamily;
1976
+ serializationObject.fontFamily = this._fontFamily;
1829
1977
  serializationObject.fontSize = this.fontSize;
1830
1978
  serializationObject.fontWeight = this.fontWeight;
1831
1979
  serializationObject.fontStyle = this.fontStyle;
@@ -1929,30 +2077,11 @@ var Control = /** @class */ (function () {
1929
2077
  if (Control._FontHeightSizes[font]) {
1930
2078
  return Control._FontHeightSizes[font];
1931
2079
  }
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 };
2080
+ var engine = Engine.LastCreatedEngine;
2081
+ if (!engine) {
2082
+ throw new Error("Invalid engine. Unable to create a canvas.");
2083
+ }
2084
+ var result = engine.getFontOffset(font);
1956
2085
  Control._FontHeightSizes[font] = result;
1957
2086
  return result;
1958
2087
  };
@@ -2090,6 +2219,9 @@ var Control = /** @class */ (function () {
2090
2219
  __decorate([
2091
2220
  serialize()
2092
2221
  ], Control.prototype, "isVisible", null);
2222
+ __decorate([
2223
+ serialize()
2224
+ ], Control.prototype, "descendentsOnlyPadding", null);
2093
2225
  __decorate([
2094
2226
  serialize()
2095
2227
  ], Control.prototype, "paddingLeft", null);
@@ -2123,8 +2255,14 @@ var Control = /** @class */ (function () {
2123
2255
  __decorate([
2124
2256
  serialize()
2125
2257
  ], Control.prototype, "disabledColorItem", null);
2258
+ __decorate([
2259
+ serialize()
2260
+ ], Control.prototype, "overlapGroup", void 0);
2261
+ __decorate([
2262
+ serialize()
2263
+ ], Control.prototype, "overlapDeltaMultiplier", void 0);
2126
2264
  return Control;
2127
2265
  }());
2128
2266
  export { Control };
2129
- _TypeStore.RegisteredTypes["BABYLON.GUI.Control"] = Control;
2267
+ RegisterClass("BABYLON.GUI.Control", Control);
2130
2268
  //# sourceMappingURL=control.js.map