babylonjs-gui 5.0.0-alpha.60 → 5.0.0-alpha.61

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.
package/babylon.gui.js CHANGED
@@ -97,9 +97,9 @@ return /******/ (function(modules) { // webpackBootstrap
97
97
  /******/ ({
98
98
 
99
99
  /***/ "../../node_modules/tslib/tslib.es6.js":
100
- /*!************************************************************************************!*\
101
- !*** C:/Users/raweber/Documents/GitHub/Babylon.js/node_modules/tslib/tslib.es6.js ***!
102
- \************************************************************************************/
100
+ /*!*************************************************************!*\
101
+ !*** E:/Babylon/Babylon.js/node_modules/tslib/tslib.es6.js ***!
102
+ \*************************************************************/
103
103
  /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
104
104
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
105
105
 
@@ -582,21 +582,21 @@ __webpack_require__.r(__webpack_exports__);
582
582
 
583
583
 
584
584
  /**
585
- * Class used to create texture to support 2D GUI elements
586
- * @see https://doc.babylonjs.com/how_to/gui
587
- */
585
+ * Class used to create texture to support 2D GUI elements
586
+ * @see https://doc.babylonjs.com/how_to/gui
587
+ */
588
588
  var AdvancedDynamicTexture = /** @class */ (function (_super) {
589
589
  Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AdvancedDynamicTexture, _super);
590
590
  /**
591
- * Creates a new AdvancedDynamicTexture
592
- * @param name defines the name of the texture
593
- * @param width defines the width of the texture
594
- * @param height defines the height of the texture
595
- * @param scene defines the hosting scene
596
- * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
597
- * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
598
- * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
599
- */
591
+ * Creates a new AdvancedDynamicTexture
592
+ * @param name defines the name of the texture
593
+ * @param width defines the width of the texture
594
+ * @param height defines the height of the texture
595
+ * @param scene defines the hosting scene
596
+ * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
597
+ * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
598
+ * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
599
+ */
600
600
  function AdvancedDynamicTexture(name, width, height, scene, generateMipMaps, samplingMode, invertY) {
601
601
  if (width === void 0) { width = 0; }
602
602
  if (height === void 0) { height = 0; }
@@ -630,37 +630,37 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
630
630
  /** @hidden */
631
631
  _this._numRenderCalls = 0;
632
632
  /**
633
- * Define type to string to ensure compatibility across browsers
634
- * Safari doesn't support DataTransfer constructor
635
- */
633
+ * Define type to string to ensure compatibility across browsers
634
+ * Safari doesn't support DataTransfer constructor
635
+ */
636
636
  _this._clipboardData = "";
637
637
  /**
638
- * Observable event triggered each time an clipboard event is received from the rendering canvas
639
- */
638
+ * Observable event triggered each time an clipboard event is received from the rendering canvas
639
+ */
640
640
  _this.onClipboardObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
641
641
  /**
642
- * Observable event triggered each time a pointer down is intercepted by a control
643
- */
642
+ * Observable event triggered each time a pointer down is intercepted by a control
643
+ */
644
644
  _this.onControlPickedObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
645
645
  /**
646
- * Observable event triggered before layout is evaluated
647
- */
646
+ * Observable event triggered before layout is evaluated
647
+ */
648
648
  _this.onBeginLayoutObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
649
649
  /**
650
- * Observable event triggered after the layout was evaluated
651
- */
650
+ * Observable event triggered after the layout was evaluated
651
+ */
652
652
  _this.onEndLayoutObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
653
653
  /**
654
- * Observable event triggered before the texture is rendered
655
- */
654
+ * Observable event triggered before the texture is rendered
655
+ */
656
656
  _this.onBeginRenderObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
657
657
  /**
658
- * Observable event triggered after the texture was rendered
659
- */
658
+ * Observable event triggered after the texture was rendered
659
+ */
660
660
  _this.onEndRenderObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
661
661
  /**
662
- * Gets or sets a boolean defining if alpha is stored as premultiplied
663
- */
662
+ * Gets or sets a boolean defining if alpha is stored as premultiplied
663
+ */
664
664
  _this.premulAlpha = false;
665
665
  /**
666
666
  * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
@@ -734,9 +734,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
734
734
  });
735
735
  Object.defineProperty(AdvancedDynamicTexture.prototype, "renderScale", {
736
736
  /**
737
- * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
738
- * Useful when you want more antialiasing
739
- */
737
+ * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
738
+ * Useful when you want more antialiasing
739
+ */
740
740
  get: function () {
741
741
  return this._renderScale;
742
742
  },
@@ -767,10 +767,10 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
767
767
  });
768
768
  Object.defineProperty(AdvancedDynamicTexture.prototype, "idealWidth", {
769
769
  /**
770
- * Gets or sets the ideal width used to design controls.
771
- * The GUI will then rescale everything accordingly
772
- * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
773
- */
770
+ * Gets or sets the ideal width used to design controls.
771
+ * The GUI will then rescale everything accordingly
772
+ * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
773
+ */
774
774
  get: function () {
775
775
  return this._idealWidth;
776
776
  },
@@ -787,10 +787,10 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
787
787
  });
788
788
  Object.defineProperty(AdvancedDynamicTexture.prototype, "idealHeight", {
789
789
  /**
790
- * Gets or sets the ideal height used to design controls.
791
- * The GUI will then rescale everything accordingly
792
- * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
793
- */
790
+ * Gets or sets the ideal height used to design controls.
791
+ * The GUI will then rescale everything accordingly
792
+ * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
793
+ */
794
794
  get: function () {
795
795
  return this._idealHeight;
796
796
  },
@@ -807,9 +807,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
807
807
  });
808
808
  Object.defineProperty(AdvancedDynamicTexture.prototype, "useSmallestIdeal", {
809
809
  /**
810
- * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
811
- * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
812
- */
810
+ * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
811
+ * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
812
+ */
813
813
  get: function () {
814
814
  return this._useSmallestIdeal;
815
815
  },
@@ -826,9 +826,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
826
826
  });
827
827
  Object.defineProperty(AdvancedDynamicTexture.prototype, "renderAtIdealSize", {
828
828
  /**
829
- * Gets or sets a boolean indicating if adaptive scaling must be used
830
- * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
831
- */
829
+ * Gets or sets a boolean indicating if adaptive scaling must be used
830
+ * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
831
+ */
832
832
  get: function () {
833
833
  return this._renderAtIdealSize;
834
834
  },
@@ -845,24 +845,26 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
845
845
  Object.defineProperty(AdvancedDynamicTexture.prototype, "idealRatio", {
846
846
  /**
847
847
  * Gets the ratio used when in "ideal mode"
848
- * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
848
+ * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
849
849
  * */
850
850
  get: function () {
851
851
  var rwidth = 0;
852
852
  var rheight = 0;
853
853
  if (this._idealWidth) {
854
- rwidth = (this.getSize().width) / this._idealWidth;
854
+ rwidth = this.getSize().width / this._idealWidth;
855
855
  }
856
856
  if (this._idealHeight) {
857
- rheight = (this.getSize().height) / this._idealHeight;
857
+ rheight = this.getSize().height / this._idealHeight;
858
858
  }
859
859
  if (this._useSmallestIdeal && this._idealWidth && this._idealHeight) {
860
860
  return window.innerWidth < window.innerHeight ? rwidth : rheight;
861
861
  }
862
- if (this._idealWidth) { // horizontal
862
+ if (this._idealWidth) {
863
+ // horizontal
863
864
  return rwidth;
864
865
  }
865
- if (this._idealHeight) { // vertical
866
+ if (this._idealHeight) {
867
+ // vertical
866
868
  return rheight;
867
869
  }
868
870
  return 1;
@@ -872,8 +874,8 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
872
874
  });
873
875
  Object.defineProperty(AdvancedDynamicTexture.prototype, "layer", {
874
876
  /**
875
- * Gets the underlying layer used to render the texture when in fullscreen mode
876
- */
877
+ * Gets the underlying layer used to render the texture when in fullscreen mode
878
+ */
877
879
  get: function () {
878
880
  return this._layerToDispose;
879
881
  },
@@ -882,8 +884,8 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
882
884
  });
883
885
  Object.defineProperty(AdvancedDynamicTexture.prototype, "rootContainer", {
884
886
  /**
885
- * Gets the root container control
886
- */
887
+ * Gets the root container control
888
+ */
887
889
  get: function () {
888
890
  return this._rootContainer;
889
891
  },
@@ -891,35 +893,35 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
891
893
  configurable: true
892
894
  });
893
895
  /**
894
- * Returns an array containing the root container.
895
- * This is mostly used to let the Inspector introspects the ADT
896
- * @returns an array containing the rootContainer
897
- */
896
+ * Returns an array containing the root container.
897
+ * This is mostly used to let the Inspector introspects the ADT
898
+ * @returns an array containing the rootContainer
899
+ */
898
900
  AdvancedDynamicTexture.prototype.getChildren = function () {
899
901
  return [this._rootContainer];
900
902
  };
901
903
  /**
902
- * Will return all controls that are inside this texture
903
- * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
904
- * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
905
- * @return all child controls
906
- */
904
+ * Will return all controls that are inside this texture
905
+ * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
906
+ * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
907
+ * @return all child controls
908
+ */
907
909
  AdvancedDynamicTexture.prototype.getDescendants = function (directDescendantsOnly, predicate) {
908
910
  return this._rootContainer.getDescendants(directDescendantsOnly, predicate);
909
911
  };
910
912
  /**
911
- * Will return all controls with the given type name
912
- * @param typeName defines the type name to search for
913
- * @returns an array of all controls found
914
- */
913
+ * Will return all controls with the given type name
914
+ * @param typeName defines the type name to search for
915
+ * @returns an array of all controls found
916
+ */
915
917
  AdvancedDynamicTexture.prototype.getControlsByType = function (typeName) {
916
918
  return this._rootContainer.getDescendants(false, function (control) { return control.typeName === typeName; });
917
919
  };
918
920
  /**
919
- * Will return the first control with the given name
920
- * @param name defines the name to search for
921
- * @return the first control found or null
922
- */
921
+ * Will return the first control with the given name
922
+ * @param name defines the name to search for
923
+ * @return the first control found or null
924
+ */
923
925
  AdvancedDynamicTexture.prototype.getControlByName = function (name) {
924
926
  return this._getControlByKey("name", name);
925
927
  };
@@ -928,8 +930,8 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
928
930
  };
929
931
  Object.defineProperty(AdvancedDynamicTexture.prototype, "focusedControl", {
930
932
  /**
931
- * Gets or sets the current focused control
932
- */
933
+ * Gets or sets the current focused control
934
+ */
933
935
  get: function () {
934
936
  return this._focusedControl;
935
937
  },
@@ -950,13 +952,13 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
950
952
  });
951
953
  Object.defineProperty(AdvancedDynamicTexture.prototype, "isForeground", {
952
954
  /**
953
- * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
954
- */
955
+ * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
956
+ */
955
957
  get: function () {
956
958
  if (!this.layer) {
957
959
  return true;
958
960
  }
959
- return (!this.layer.isBackground);
961
+ return !this.layer.isBackground;
960
962
  },
961
963
  set: function (value) {
962
964
  if (!this.layer) {
@@ -972,8 +974,8 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
972
974
  });
973
975
  Object.defineProperty(AdvancedDynamicTexture.prototype, "clipboardData", {
974
976
  /**
975
- * Gets or set information about clipboardData
976
- */
977
+ * Gets or set information about clipboardData
978
+ */
977
979
  get: function () {
978
980
  return this._clipboardData;
979
981
  },
@@ -984,17 +986,17 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
984
986
  configurable: true
985
987
  });
986
988
  /**
987
- * Get the current class name of the texture useful for serialization or dynamic coding.
988
- * @returns "AdvancedDynamicTexture"
989
- */
989
+ * Get the current class name of the texture useful for serialization or dynamic coding.
990
+ * @returns "AdvancedDynamicTexture"
991
+ */
990
992
  AdvancedDynamicTexture.prototype.getClassName = function () {
991
993
  return "AdvancedDynamicTexture";
992
994
  };
993
995
  /**
994
- * Function used to execute a function on all controls
995
- * @param func defines the function to execute
996
- * @param container defines the container where controls belong. If null the root container will be used
997
- */
996
+ * Function used to execute a function on all controls
997
+ * @param func defines the function to execute
998
+ * @param container defines the container where controls belong. If null the root container will be used
999
+ */
998
1000
  AdvancedDynamicTexture.prototype.executeOnAllControls = function (func, container) {
999
1001
  if (!container) {
1000
1002
  container = this._rootContainer;
@@ -1047,40 +1049,83 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1047
1049
  }
1048
1050
  };
1049
1051
  /**
1050
- * Marks the texture as dirty forcing a complete update
1051
- */
1052
+ * Marks the texture as dirty forcing a complete update
1053
+ */
1052
1054
  AdvancedDynamicTexture.prototype.markAsDirty = function () {
1053
1055
  this._isDirty = true;
1054
1056
  };
1055
1057
  /**
1056
- * Helper function used to create a new style
1057
- * @returns a new style
1058
- * @see https://doc.babylonjs.com/how_to/gui#styles
1059
- */
1058
+ * Helper function used to create a new style
1059
+ * @returns a new style
1060
+ * @see https://doc.babylonjs.com/how_to/gui#styles
1061
+ */
1060
1062
  AdvancedDynamicTexture.prototype.createStyle = function () {
1061
1063
  return new _style__WEBPACK_IMPORTED_MODULE_4__["Style"](this);
1062
1064
  };
1063
1065
  /**
1064
- * Adds a new control to the root container
1065
- * @param control defines the control to add
1066
- * @returns the current texture
1067
- */
1066
+ * Adds a new control to the root container
1067
+ * @param control defines the control to add
1068
+ * @returns the current texture
1069
+ */
1068
1070
  AdvancedDynamicTexture.prototype.addControl = function (control) {
1069
1071
  this._rootContainer.addControl(control);
1070
1072
  return this;
1071
1073
  };
1072
1074
  /**
1073
- * Removes a control from the root container
1074
- * @param control defines the control to remove
1075
- * @returns the current texture
1076
- */
1075
+ * Removes a control from the root container
1076
+ * @param control defines the control to remove
1077
+ * @returns the current texture
1078
+ */
1077
1079
  AdvancedDynamicTexture.prototype.removeControl = function (control) {
1078
1080
  this._rootContainer.removeControl(control);
1079
1081
  return this;
1080
1082
  };
1081
1083
  /**
1082
- * Release all resources
1083
- */
1084
+ * Moves overlapped controls towards a position where it is not overlapping anymore.
1085
+ * Please note that this method alters linkOffsetXInPixels and linkOffsetYInPixels.
1086
+ * @param overlapGroup the overlap group which will be processed or undefined to process all overlap groups
1087
+ * @param deltaStep the step size (speed) to reach the target non overlapping position (default 0.1)
1088
+ * @param repelFactor how much is the control repelled by other controls
1089
+ */
1090
+ AdvancedDynamicTexture.prototype.moveToNonOverlappedPosition = function (overlapGroup, deltaStep, repelFactor) {
1091
+ if (deltaStep === void 0) { deltaStep = 1; }
1092
+ if (repelFactor === void 0) { repelFactor = 1; }
1093
+ var controlsForGroup;
1094
+ if (Array.isArray(overlapGroup)) {
1095
+ controlsForGroup = overlapGroup;
1096
+ }
1097
+ else {
1098
+ var descendants = this.getDescendants(true);
1099
+ // get only the controls with an overlapGroup property set
1100
+ // if the overlapGroup parameter is set, filter the controls and get only the controls belonging to that overlapGroup
1101
+ controlsForGroup = overlapGroup === undefined ? descendants.filter(function (c) { return c.overlapGroup !== undefined; }) : descendants.filter(function (c) { return c.overlapGroup === overlapGroup; });
1102
+ }
1103
+ controlsForGroup.forEach(function (control1) {
1104
+ var _a;
1105
+ var velocity = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Vector2"].Zero();
1106
+ var center = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Vector2"](control1.centerX, control1.centerY);
1107
+ controlsForGroup.forEach(function (control2) {
1108
+ if (control1 !== control2 && AdvancedDynamicTexture._Overlaps(control1, control2)) {
1109
+ // if the two controls overlaps get a direction vector from one control's center to another control's center
1110
+ var diff = center.subtract(new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Vector2"](control2.centerX, control2.centerY));
1111
+ var diffLength = diff.length();
1112
+ if (diffLength > 0) {
1113
+ // calculate the velocity
1114
+ velocity = velocity.add(diff.normalize().scale(repelFactor / diffLength));
1115
+ }
1116
+ }
1117
+ });
1118
+ if (velocity.length() > 0) {
1119
+ // move the control along the direction vector away from the overlapping control
1120
+ velocity = velocity.normalize().scale(deltaStep * ((_a = control1.overlapDeltaMultiplier) !== null && _a !== void 0 ? _a : 1));
1121
+ control1.linkOffsetXInPixels += velocity.x;
1122
+ control1.linkOffsetYInPixels += velocity.y;
1123
+ }
1124
+ });
1125
+ };
1126
+ /**
1127
+ * Release all resources
1128
+ */
1084
1129
  AdvancedDynamicTexture.prototype.dispose = function () {
1085
1130
  var scene = this.getScene();
1086
1131
  if (!scene) {
@@ -1155,21 +1200,21 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1155
1200
  return this._fullscreenViewport.toGlobal(size.width, size.height);
1156
1201
  };
1157
1202
  /**
1158
- * Get screen coordinates for a vector3
1159
- * @param position defines the position to project
1160
- * @param worldMatrix defines the world matrix to use
1161
- * @returns the projected position
1162
- */
1203
+ * Get screen coordinates for a vector3
1204
+ * @param position defines the position to project
1205
+ * @param worldMatrix defines the world matrix to use
1206
+ * @returns the projected position
1207
+ */
1163
1208
  AdvancedDynamicTexture.prototype.getProjectedPosition = function (position, worldMatrix) {
1164
1209
  var result = this.getProjectedPositionWithZ(position, worldMatrix);
1165
1210
  return new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Vector2"](result.x, result.y);
1166
1211
  };
1167
1212
  /**
1168
- * Get screen coordinates for a vector3
1169
- * @param position defines the position to project
1170
- * @param worldMatrix defines the world matrix to use
1171
- * @returns the projected position with Z
1172
- */
1213
+ * Get screen coordinates for a vector3
1214
+ * @param position defines the position to project
1215
+ * @param worldMatrix defines the world matrix to use
1216
+ * @returns the projected position with Z
1217
+ */
1173
1218
  AdvancedDynamicTexture.prototype.getProjectedPositionWithZ = function (position, worldMatrix) {
1174
1219
  var scene = this.getScene();
1175
1220
  if (!scene) {
@@ -1333,13 +1378,13 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1333
1378
  }
1334
1379
  var tempViewport = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Viewport"](0, 0, 0, 0);
1335
1380
  this._pointerMoveObserver = scene.onPrePointerObservable.add(function (pi, state) {
1336
- if (scene.isPointerCaptured((pi.event).pointerId)) {
1381
+ if (scene.isPointerCaptured(pi.event.pointerId)) {
1337
1382
  return;
1338
1383
  }
1339
- if (pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERMOVE
1340
- && pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERUP
1341
- && pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERDOWN
1342
- && pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERWHEEL) {
1384
+ if (pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERMOVE &&
1385
+ pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERUP &&
1386
+ pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERDOWN &&
1387
+ pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERWHEEL) {
1343
1388
  return;
1344
1389
  }
1345
1390
  if (pi.type === babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERMOVE && pi.event.pointerId) {
@@ -1371,8 +1416,8 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1371
1416
  this._attachToOnBlur(scene);
1372
1417
  };
1373
1418
  /**
1374
- * Register the clipboard Events onto the canvas
1375
- */
1419
+ * Register the clipboard Events onto the canvas
1420
+ */
1376
1421
  AdvancedDynamicTexture.prototype.registerClipboardEvents = function () {
1377
1422
  self.addEventListener("copy", this.onClipboardCopy, false);
1378
1423
  self.addEventListener("cut", this.onClipboardCut, false);
@@ -1387,10 +1432,10 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1387
1432
  self.removeEventListener("paste", this.onClipboardPaste);
1388
1433
  };
1389
1434
  /**
1390
- * Connect the texture to a hosting mesh to enable interactions
1391
- * @param mesh defines the mesh to attach to
1392
- * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
1393
- */
1435
+ * Connect the texture to a hosting mesh to enable interactions
1436
+ * @param mesh defines the mesh to attach to
1437
+ * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
1438
+ */
1394
1439
  AdvancedDynamicTexture.prototype.attachToMesh = function (mesh, supportPointerMove) {
1395
1440
  var _this = this;
1396
1441
  if (supportPointerMove === void 0) { supportPointerMove = true; }
@@ -1399,10 +1444,10 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1399
1444
  return;
1400
1445
  }
1401
1446
  this._pointerObserver = scene.onPointerObservable.add(function (pi, state) {
1402
- if (pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERMOVE
1403
- && pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERUP
1404
- && pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERDOWN
1405
- && pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERWHEEL) {
1447
+ if (pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERMOVE &&
1448
+ pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERUP &&
1449
+ pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERDOWN &&
1450
+ pi.type !== babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERWHEEL) {
1406
1451
  return;
1407
1452
  }
1408
1453
  if (pi.type === babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERMOVE && pi.event.pointerId) {
@@ -1413,7 +1458,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1413
1458
  var uv = pi.pickInfo.getTextureCoordinates();
1414
1459
  if (uv) {
1415
1460
  var size = _this.getSize();
1416
- _this._doPicking(uv.x * size.width, (_this.applyYInversionOnUpdate ? (1.0 - uv.y) : uv.y) * size.height, pi, pi.type, pointerId, pi.event.button, pi.event.deltaX, pi.event.deltaY);
1461
+ _this._doPicking(uv.x * size.width, (_this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height, pi, pi.type, pointerId, pi.event.button, pi.event.deltaX, pi.event.deltaY);
1417
1462
  }
1418
1463
  }
1419
1464
  else if (pi.type === babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerEventTypes"].POINTERUP) {
@@ -1456,9 +1501,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1456
1501
  this._attachToOnBlur(scene);
1457
1502
  };
1458
1503
  /**
1459
- * Move the focus to a specific control
1460
- * @param control defines the control which will receive the focus
1461
- */
1504
+ * Move the focus to a specific control
1505
+ * @param control defines the control which will receive the focus
1506
+ */
1462
1507
  AdvancedDynamicTexture.prototype.moveFocusToControl = function (control) {
1463
1508
  this.focusedControl = control;
1464
1509
  this._lastPickedControl = control;
@@ -1528,7 +1573,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1528
1573
  if (scaleToSize) {
1529
1574
  var width = serializedObject.width;
1530
1575
  var height = serializedObject.height;
1531
- if (typeof (width) === "number" && typeof (height) === "number" && width >= 0 && height >= 0) {
1576
+ if (typeof width === "number" && typeof height === "number" && width >= 0 && height >= 0) {
1532
1577
  this.scaleTo(width, height);
1533
1578
  }
1534
1579
  }
@@ -1565,11 +1610,11 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1565
1610
  });
1566
1611
  };
1567
1612
  /**
1568
- * Recreate the content of the ADT from a url json
1569
- * @param url defines the url to load
1570
- * @param scaleToSize defines whether to scale to texture to the saved size
1571
- * @returns a promise that will resolve on success
1572
- */
1613
+ * Recreate the content of the ADT from a url json
1614
+ * @param url defines the url to load
1615
+ * @param scaleToSize defines whether to scale to texture to the saved size
1616
+ * @returns a promise that will resolve on success
1617
+ */
1573
1618
  AdvancedDynamicTexture.prototype.parseFromURLAsync = function (url, scaleToSize) {
1574
1619
  var _this = this;
1575
1620
  if (url === "") {
@@ -1595,6 +1640,18 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1595
1640
  });
1596
1641
  };
1597
1642
  // Statics
1643
+ /**
1644
+ * Compares two rectangle based controls for pixel overlap
1645
+ * @param control1 The first control to compare
1646
+ * @param control2 The second control to compare
1647
+ * @returns true if overlaps, otherwise false
1648
+ */
1649
+ AdvancedDynamicTexture._Overlaps = function (control1, control2) {
1650
+ return !(control1.centerX > control2.centerX + control2.widthInPixels ||
1651
+ control1.centerX + control1.widthInPixels < control2.centerX ||
1652
+ control1.centerY + control1.heightInPixels < control2.centerY ||
1653
+ control1.centerY > control2.centerY + control2.heightInPixels);
1654
+ };
1598
1655
  /**
1599
1656
  * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
1600
1657
  * @param mesh defines the mesh which will receive the texture
@@ -1646,17 +1703,17 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1646
1703
  return result;
1647
1704
  };
1648
1705
  /**
1649
- * Creates a new AdvancedDynamicTexture in fullscreen mode.
1650
- * In this mode the texture will rely on a layer for its rendering.
1651
- * This allows it to be treated like any other layer.
1652
- * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
1653
- * LayerMask is set through advancedTexture.layer.layerMask
1654
- * @param name defines name for the texture
1655
- * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
1656
- * @param scene defines the hosting scene
1657
- * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
1658
- * @returns a new AdvancedDynamicTexture
1659
- */
1706
+ * Creates a new AdvancedDynamicTexture in fullscreen mode.
1707
+ * In this mode the texture will rely on a layer for its rendering.
1708
+ * This allows it to be treated like any other layer.
1709
+ * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
1710
+ * LayerMask is set through advancedTexture.layer.layerMask
1711
+ * @param name defines name for the texture
1712
+ * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
1713
+ * @param scene defines the hosting scene
1714
+ * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
1715
+ * @returns a new AdvancedDynamicTexture
1716
+ */
1660
1717
  AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene, sampling) {
1661
1718
  if (foreground === void 0) { foreground = true; }
1662
1719
  if (scene === void 0) { scene = null; }
@@ -4216,7 +4273,7 @@ var Control = /** @class */ (function () {
4216
4273
  this._shadowOffsetY = 0;
4217
4274
  this._shadowBlur = 0;
4218
4275
  this._previousShadowBlur = 0;
4219
- this._shadowColor = 'black';
4276
+ this._shadowColor = "black";
4220
4277
  /** Gets or sets the cursor to use when the control is hovered */
4221
4278
  this.hoverCursor = "";
4222
4279
  /** @hidden */
@@ -4224,36 +4281,36 @@ var Control = /** @class */ (function () {
4224
4281
  /** @hidden */
4225
4282
  this._linkOffsetY = new _valueAndUnit__WEBPACK_IMPORTED_MODULE_2__["ValueAndUnit"](0);
4226
4283
  /**
4227
- * An event triggered when pointer wheel is scrolled
4228
- */
4284
+ * An event triggered when pointer wheel is scrolled
4285
+ */
4229
4286
  this.onWheelObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4230
4287
  /**
4231
- * An event triggered when the pointer moves over the control.
4232
- */
4288
+ * An event triggered when the pointer moves over the control.
4289
+ */
4233
4290
  this.onPointerMoveObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4234
4291
  /**
4235
- * An event triggered when the pointer moves out of the control.
4236
- */
4292
+ * An event triggered when the pointer moves out of the control.
4293
+ */
4237
4294
  this.onPointerOutObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4238
4295
  /**
4239
- * An event triggered when the pointer taps the control
4240
- */
4296
+ * An event triggered when the pointer taps the control
4297
+ */
4241
4298
  this.onPointerDownObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4242
4299
  /**
4243
- * An event triggered when pointer up
4244
- */
4300
+ * An event triggered when pointer up
4301
+ */
4245
4302
  this.onPointerUpObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4246
4303
  /**
4247
- * An event triggered when a control is clicked on
4248
- */
4304
+ * An event triggered when a control is clicked on
4305
+ */
4249
4306
  this.onPointerClickObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4250
4307
  /**
4251
- * An event triggered when pointer enters the control
4252
- */
4308
+ * An event triggered when pointer enters the control
4309
+ */
4253
4310
  this.onPointerEnterObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4254
4311
  /**
4255
- * An event triggered when the control is marked as dirty
4256
- */
4312
+ * An event triggered when the control is marked as dirty
4313
+ */
4257
4314
  this.onDirtyObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4258
4315
  /**
4259
4316
  * An event triggered before drawing the control
@@ -4264,8 +4321,8 @@ var Control = /** @class */ (function () {
4264
4321
  */
4265
4322
  this.onAfterDrawObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4266
4323
  /**
4267
- * An event triggered when the control has been disposed
4268
- */
4324
+ * An event triggered when the control has been disposed
4325
+ */
4269
4326
  this.onDisposeObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
4270
4327
  /**
4271
4328
  * Gets or sets a fixed ratio for this control.
@@ -4459,7 +4516,7 @@ var Control = /** @class */ (function () {
4459
4516
  Object.defineProperty(Control.prototype, "scaleX", {
4460
4517
  /** Gets or sets a value indicating the scale factor on X axis (1 by default)
4461
4518
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
4462
- */
4519
+ */
4463
4520
  get: function () {
4464
4521
  return this._scaleX;
4465
4522
  },
@@ -4477,7 +4534,7 @@ var Control = /** @class */ (function () {
4477
4534
  Object.defineProperty(Control.prototype, "scaleY", {
4478
4535
  /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
4479
4536
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
4480
- */
4537
+ */
4481
4538
  get: function () {
4482
4539
  return this._scaleY;
4483
4540
  },
@@ -4495,7 +4552,7 @@ var Control = /** @class */ (function () {
4495
4552
  Object.defineProperty(Control.prototype, "rotation", {
4496
4553
  /** Gets or sets the rotation angle (0 by default)
4497
4554
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
4498
- */
4555
+ */
4499
4556
  get: function () {
4500
4557
  return this._rotation;
4501
4558
  },
@@ -4513,7 +4570,7 @@ var Control = /** @class */ (function () {
4513
4570
  Object.defineProperty(Control.prototype, "transformCenterY", {
4514
4571
  /** Gets or sets the transformation center on Y axis (0 by default)
4515
4572
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
4516
- */
4573
+ */
4517
4574
  get: function () {
4518
4575
  return this._transformCenterY;
4519
4576
  },
@@ -4531,7 +4588,7 @@ var Control = /** @class */ (function () {
4531
4588
  Object.defineProperty(Control.prototype, "transformCenterX", {
4532
4589
  /** Gets or sets the transformation center on X axis (0 by default)
4533
4590
  * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
4534
- */
4591
+ */
4535
4592
  get: function () {
4536
4593
  return this._transformCenterX;
4537
4594
  },
@@ -5295,7 +5352,7 @@ var Control = /** @class */ (function () {
5295
5352
  * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
5296
5353
  */
5297
5354
  Control.prototype.linkWithMesh = function (mesh) {
5298
- if (!this._host || this.parent && this.parent !== this._host._rootContainer) {
5355
+ if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
5299
5356
  if (mesh) {
5300
5357
  babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Cannot link a control to a mesh if the control is not at root level");
5301
5358
  }
@@ -5318,13 +5375,13 @@ var Control = /** @class */ (function () {
5318
5375
  this._host._linkedControls.push(this);
5319
5376
  };
5320
5377
  /**
5321
- * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
5322
- * @param { string | number} paddingTop - The value of the top padding.
5323
- * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
5324
- * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
5325
- * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
5326
- * @see https://doc.babylonjs.com/how_to/gui#position-and-size
5327
- */
5378
+ * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
5379
+ * @param { string | number} paddingTop - The value of the top padding.
5380
+ * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
5381
+ * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
5382
+ * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
5383
+ * @see https://doc.babylonjs.com/how_to/gui#position-and-size
5384
+ */
5328
5385
  Control.prototype.setPadding = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
5329
5386
  var top = paddingTop;
5330
5387
  var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
@@ -5364,8 +5421,8 @@ var Control = /** @class */ (function () {
5364
5421
  this._processMeasures(parentMeasure, this._host.getContext());
5365
5422
  }
5366
5423
  }
5367
- var newLeft = ((projectedPosition.x + this._linkOffsetX.getValue(this._host)) - this._currentMeasure.width / 2);
5368
- var newTop = ((projectedPosition.y + this._linkOffsetY.getValue(this._host)) - this._currentMeasure.height / 2);
5424
+ var newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
5425
+ var newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
5369
5426
  if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
5370
5427
  if (Math.abs(newLeft - oldLeft) < 0.5) {
5371
5428
  newLeft = oldLeft;
@@ -5534,7 +5591,7 @@ var Control = /** @class */ (function () {
5534
5591
  context.globalAlpha *= this._alpha;
5535
5592
  }
5536
5593
  else if (this._alphaSet) {
5537
- context.globalAlpha = (this.parent && !this.parent.renderToIntermediateTexture) ? this.parent.alpha * this._alpha : this._alpha;
5594
+ context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
5538
5595
  }
5539
5596
  };
5540
5597
  /** @hidden */
@@ -5840,7 +5897,8 @@ var Control = /** @class */ (function () {
5840
5897
  if (this._enterCount > 0) {
5841
5898
  return false;
5842
5899
  }
5843
- if (this._enterCount === -1) { // -1 is for touch input, we are now sure we are with a mouse or pencil
5900
+ if (this._enterCount === -1) {
5901
+ // -1 is for touch input, we are now sure we are with a mouse or pencil
5844
5902
  this._enterCount = 0;
5845
5903
  }
5846
5904
  this._enterCount++;
@@ -5971,6 +6029,8 @@ var Control = /** @class */ (function () {
5971
6029
  this._font = this._fontStyle + " " + this._fontWeight + " " + this.fontSizeInPixels + "px " + this._fontFamily;
5972
6030
  }
5973
6031
  this._fontOffset = Control._GetFontOffset(this._font);
6032
+ //children need to be refreshed
6033
+ this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
5974
6034
  };
5975
6035
  /**
5976
6036
  * Serializes the current control
@@ -6260,6 +6320,12 @@ var Control = /** @class */ (function () {
6260
6320
  Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
6261
6321
  Object(babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
6262
6322
  ], Control.prototype, "disabledColorItem", null);
6323
+ Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
6324
+ Object(babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
6325
+ ], Control.prototype, "overlapGroup", void 0);
6326
+ Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
6327
+ Object(babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
6328
+ ], Control.prototype, "overlapDeltaMultiplier", void 0);
6263
6329
  return Control;
6264
6330
  }());
6265
6331
 
@@ -9223,7 +9289,7 @@ var InputText = /** @class */ (function (_super) {
9223
9289
  context.shadowOffsetX = 0;
9224
9290
  context.shadowOffsetY = 0;
9225
9291
  }
9226
- if (!this._fontOffset) {
9292
+ if (!this._fontOffset || this._wasDirty) {
9227
9293
  this._fontOffset = _control__WEBPACK_IMPORTED_MODULE_2__["Control"]._GetFontOffset(context.font);
9228
9294
  }
9229
9295
  // Text
@@ -13944,7 +14010,7 @@ var TextBlock = /** @class */ (function (_super) {
13944
14010
  return "TextBlock";
13945
14011
  };
13946
14012
  TextBlock.prototype._processMeasures = function (parentMeasure, context) {
13947
- if (!this._fontOffset) {
14013
+ if (!this._fontOffset || this.isDirty) {
13948
14014
  this._fontOffset = _control__WEBPACK_IMPORTED_MODULE_3__["Control"]._GetFontOffset(context.font);
13949
14015
  }
13950
14016
  _super.prototype._processMeasures.call(this, parentMeasure, context);