|
@@ -14,6 +14,7 @@ import { Measure } from "../measure";
|
|
import { Style } from "../style";
|
|
import { Style } from "../style";
|
|
import { Matrix2D, Vector2WithInfo } from "../math2D";
|
|
import { Matrix2D, Vector2WithInfo } from "../math2D";
|
|
import { _TypeStore } from 'babylonjs/Misc/typeStore';
|
|
import { _TypeStore } from 'babylonjs/Misc/typeStore';
|
|
|
|
+import { SerializationHelper, serialize } from 'babylonjs/Misc/decorators';
|
|
|
|
|
|
/**
|
|
/**
|
|
* Root class used for all 2D controls
|
|
* Root class used for all 2D controls
|
|
@@ -120,36 +121,44 @@ export class Control {
|
|
/**
|
|
/**
|
|
* Gets or sets an object used to store user defined information for the node
|
|
* Gets or sets an object used to store user defined information for the node
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public metadata: any = null;
|
|
public metadata: any = null;
|
|
|
|
|
|
/** Gets or sets a boolean indicating if the control can be hit with pointer events */
|
|
/** Gets or sets a boolean indicating if the control can be hit with pointer events */
|
|
|
|
+ @serialize()
|
|
public isHitTestVisible = true;
|
|
public isHitTestVisible = true;
|
|
/** Gets or sets a boolean indicating if the control can block pointer events */
|
|
/** Gets or sets a boolean indicating if the control can block pointer events */
|
|
|
|
+ @serialize()
|
|
public isPointerBlocker = false;
|
|
public isPointerBlocker = false;
|
|
/** Gets or sets a boolean indicating if the control can be focusable */
|
|
/** Gets or sets a boolean indicating if the control can be focusable */
|
|
|
|
+ @serialize()
|
|
public isFocusInvisible = false;
|
|
public isFocusInvisible = false;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Gets or sets a boolean indicating if the children are clipped to the current control bounds.
|
|
* Gets or sets a boolean indicating if the children are clipped to the current control bounds.
|
|
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
|
|
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public clipChildren = true;
|
|
public clipChildren = true;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Gets or sets a boolean indicating that control content must be clipped
|
|
* Gets or sets a boolean indicating that control content must be clipped
|
|
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
|
|
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public clipContent = true;
|
|
public clipContent = true;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
|
|
* Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public useBitmapCache = false;
|
|
public useBitmapCache = false;
|
|
|
|
|
|
private _cacheData: Nullable<ImageData>;
|
|
private _cacheData: Nullable<ImageData>;
|
|
|
|
|
|
private _shadowOffsetX = 0;
|
|
private _shadowOffsetX = 0;
|
|
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
|
|
+ @serialize()
|
|
public get shadowOffsetX() {
|
|
public get shadowOffsetX() {
|
|
return this._shadowOffsetX;
|
|
return this._shadowOffsetX;
|
|
}
|
|
}
|
|
@@ -165,6 +174,7 @@ export class Control {
|
|
|
|
|
|
private _shadowOffsetY = 0;
|
|
private _shadowOffsetY = 0;
|
|
/** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
|
|
/** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
|
|
|
|
+ @serialize()
|
|
public get shadowOffsetY() {
|
|
public get shadowOffsetY() {
|
|
return this._shadowOffsetY;
|
|
return this._shadowOffsetY;
|
|
}
|
|
}
|
|
@@ -180,6 +190,7 @@ export class Control {
|
|
|
|
|
|
private _shadowBlur = 0;
|
|
private _shadowBlur = 0;
|
|
/** Gets or sets a value indicating the amount of blur to use to render the shadow */
|
|
/** Gets or sets a value indicating the amount of blur to use to render the shadow */
|
|
|
|
+ @serialize()
|
|
public get shadowBlur() {
|
|
public get shadowBlur() {
|
|
return this._shadowBlur;
|
|
return this._shadowBlur;
|
|
}
|
|
}
|
|
@@ -195,6 +206,7 @@ export class Control {
|
|
|
|
|
|
private _shadowColor = 'black';
|
|
private _shadowColor = 'black';
|
|
/** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
|
|
/** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
|
|
|
|
+ @serialize()
|
|
public get shadowColor() {
|
|
public get shadowColor() {
|
|
return this._shadowColor;
|
|
return this._shadowColor;
|
|
}
|
|
}
|
|
@@ -209,6 +221,7 @@ export class Control {
|
|
}
|
|
}
|
|
|
|
|
|
/** Gets or sets the cursor to use when the control is hovered */
|
|
/** Gets or sets the cursor to use when the control is hovered */
|
|
|
|
+ @serialize()
|
|
public hoverCursor = "";
|
|
public hoverCursor = "";
|
|
|
|
|
|
/** @hidden */
|
|
/** @hidden */
|
|
@@ -293,6 +306,7 @@ export class Control {
|
|
}
|
|
}
|
|
|
|
|
|
/** Gets or set information about font offsets (used to render and align text) */
|
|
/** Gets or set information about font offsets (used to render and align text) */
|
|
|
|
+ @serialize()
|
|
public get fontOffset(): { ascent: number, height: number, descent: number } {
|
|
public get fontOffset(): { ascent: number, height: number, descent: number } {
|
|
return this._fontOffset;
|
|
return this._fontOffset;
|
|
}
|
|
}
|
|
@@ -302,6 +316,7 @@ export class Control {
|
|
}
|
|
}
|
|
|
|
|
|
/** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
|
|
/** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
|
|
|
|
+ @serialize()
|
|
public get alpha(): number {
|
|
public get alpha(): number {
|
|
return this._alpha;
|
|
return this._alpha;
|
|
}
|
|
}
|
|
@@ -334,6 +349,7 @@ export class Control {
|
|
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get scaleX(): number {
|
|
public get scaleX(): number {
|
|
return this._scaleX;
|
|
return this._scaleX;
|
|
}
|
|
}
|
|
@@ -351,6 +367,7 @@ export class Control {
|
|
/** Gets or sets a value indicating the scale factor on Y axis (1 by default)
|
|
/** Gets or sets a value indicating the scale factor on Y axis (1 by default)
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get scaleY(): number {
|
|
public get scaleY(): number {
|
|
return this._scaleY;
|
|
return this._scaleY;
|
|
}
|
|
}
|
|
@@ -368,6 +385,7 @@ export class Control {
|
|
/** Gets or sets the rotation angle (0 by default)
|
|
/** Gets or sets the rotation angle (0 by default)
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get rotation(): number {
|
|
public get rotation(): number {
|
|
return this._rotation;
|
|
return this._rotation;
|
|
}
|
|
}
|
|
@@ -385,6 +403,7 @@ export class Control {
|
|
/** Gets or sets the transformation center on Y axis (0 by default)
|
|
/** Gets or sets the transformation center on Y axis (0 by default)
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get transformCenterY(): number {
|
|
public get transformCenterY(): number {
|
|
return this._transformCenterY;
|
|
return this._transformCenterY;
|
|
}
|
|
}
|
|
@@ -402,6 +421,7 @@ export class Control {
|
|
/** Gets or sets the transformation center on X axis (0 by default)
|
|
/** Gets or sets the transformation center on X axis (0 by default)
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get transformCenterX(): number {
|
|
public get transformCenterX(): number {
|
|
return this._transformCenterX;
|
|
return this._transformCenterX;
|
|
}
|
|
}
|
|
@@ -420,6 +440,7 @@ export class Control {
|
|
* Gets or sets the horizontal alignment
|
|
* Gets or sets the horizontal alignment
|
|
* @see https://doc.babylonjs.com/how_to/gui#alignments
|
|
* @see https://doc.babylonjs.com/how_to/gui#alignments
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get horizontalAlignment(): number {
|
|
public get horizontalAlignment(): number {
|
|
return this._horizontalAlignment;
|
|
return this._horizontalAlignment;
|
|
}
|
|
}
|
|
@@ -437,6 +458,7 @@ export class Control {
|
|
* Gets or sets the vertical alignment
|
|
* Gets or sets the vertical alignment
|
|
* @see https://doc.babylonjs.com/how_to/gui#alignments
|
|
* @see https://doc.babylonjs.com/how_to/gui#alignments
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get verticalAlignment(): number {
|
|
public get verticalAlignment(): number {
|
|
return this._verticalAlignment;
|
|
return this._verticalAlignment;
|
|
}
|
|
}
|
|
@@ -456,6 +478,7 @@ export class Control {
|
|
* The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
|
|
* The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
|
|
* second dimension is computed as first dimension * fixedRatio
|
|
* second dimension is computed as first dimension * fixedRatio
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public fixedRatio = 0;
|
|
public fixedRatio = 0;
|
|
|
|
|
|
private _fixedRatioMasterIsWidth = true;
|
|
private _fixedRatioMasterIsWidth = true;
|
|
@@ -464,6 +487,7 @@ export class Control {
|
|
* Gets or sets control width
|
|
* Gets or sets control width
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get width(): string | number {
|
|
public get width(): string | number {
|
|
return this._width.toString(this._host);
|
|
return this._width.toString(this._host);
|
|
}
|
|
}
|
|
@@ -500,6 +524,7 @@ export class Control {
|
|
* Gets or sets control height
|
|
* Gets or sets control height
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get height(): string | number {
|
|
public get height(): string | number {
|
|
return this._height.toString(this._host);
|
|
return this._height.toString(this._host);
|
|
}
|
|
}
|
|
@@ -581,6 +606,7 @@ export class Control {
|
|
* Gets or sets style
|
|
* Gets or sets style
|
|
* @see https://doc.babylonjs.com/how_to/gui#styles
|
|
* @see https://doc.babylonjs.com/how_to/gui#styles
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get style(): Nullable<Style> {
|
|
public get style(): Nullable<Style> {
|
|
return this._style;
|
|
return this._style;
|
|
}
|
|
}
|
|
@@ -644,6 +670,7 @@ export class Control {
|
|
}
|
|
}
|
|
|
|
|
|
/** Gets or sets foreground color */
|
|
/** Gets or sets foreground color */
|
|
|
|
+ @serialize()
|
|
public get color(): string {
|
|
public get color(): string {
|
|
return this._color;
|
|
return this._color;
|
|
}
|
|
}
|
|
@@ -658,6 +685,7 @@ export class Control {
|
|
}
|
|
}
|
|
|
|
|
|
/** Gets or sets z index which is used to reorder controls on the z axis */
|
|
/** Gets or sets z index which is used to reorder controls on the z axis */
|
|
|
|
+ @serialize()
|
|
public get zIndex(): number {
|
|
public get zIndex(): number {
|
|
return this._zIndex;
|
|
return this._zIndex;
|
|
}
|
|
}
|
|
@@ -675,6 +703,7 @@ export class Control {
|
|
}
|
|
}
|
|
|
|
|
|
/** Gets or sets a boolean indicating if the control can be rendered */
|
|
/** Gets or sets a boolean indicating if the control can be rendered */
|
|
|
|
+ @serialize()
|
|
public get notRenderable(): boolean {
|
|
public get notRenderable(): boolean {
|
|
return this._doNotRender;
|
|
return this._doNotRender;
|
|
}
|
|
}
|
|
@@ -689,6 +718,7 @@ export class Control {
|
|
}
|
|
}
|
|
|
|
|
|
/** Gets or sets a boolean indicating if the control is visible */
|
|
/** Gets or sets a boolean indicating if the control is visible */
|
|
|
|
+ @serialize()
|
|
public get isVisible(): boolean {
|
|
public get isVisible(): boolean {
|
|
return this._isVisible;
|
|
return this._isVisible;
|
|
}
|
|
}
|
|
@@ -718,6 +748,7 @@ export class Control {
|
|
* Gets or sets a value indicating the padding to use on the left of the control
|
|
* Gets or sets a value indicating the padding to use on the left of the control
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get paddingLeft(): string | number {
|
|
public get paddingLeft(): string | number {
|
|
return this._paddingLeft.toString(this._host);
|
|
return this._paddingLeft.toString(this._host);
|
|
}
|
|
}
|
|
@@ -747,6 +778,7 @@ export class Control {
|
|
* Gets or sets a value indicating the padding to use on the right of the control
|
|
* Gets or sets a value indicating the padding to use on the right of the control
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get paddingRight(): string | number {
|
|
public get paddingRight(): string | number {
|
|
return this._paddingRight.toString(this._host);
|
|
return this._paddingRight.toString(this._host);
|
|
}
|
|
}
|
|
@@ -776,6 +808,7 @@ export class Control {
|
|
* Gets or sets a value indicating the padding to use on the top of the control
|
|
* Gets or sets a value indicating the padding to use on the top of the control
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get paddingTop(): string | number {
|
|
public get paddingTop(): string | number {
|
|
return this._paddingTop.toString(this._host);
|
|
return this._paddingTop.toString(this._host);
|
|
}
|
|
}
|
|
@@ -805,6 +838,7 @@ export class Control {
|
|
* Gets or sets a value indicating the padding to use on the bottom of the control
|
|
* Gets or sets a value indicating the padding to use on the bottom of the control
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get paddingBottom(): string | number {
|
|
public get paddingBottom(): string | number {
|
|
return this._paddingBottom.toString(this._host);
|
|
return this._paddingBottom.toString(this._host);
|
|
}
|
|
}
|
|
@@ -834,6 +868,7 @@ export class Control {
|
|
* Gets or sets a value indicating the left coordinate of the control
|
|
* Gets or sets a value indicating the left coordinate of the control
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get left(): string | number {
|
|
public get left(): string | number {
|
|
return this._left.toString(this._host);
|
|
return this._left.toString(this._host);
|
|
}
|
|
}
|
|
@@ -863,6 +898,7 @@ export class Control {
|
|
* Gets or sets a value indicating the top coordinate of the control
|
|
* Gets or sets a value indicating the top coordinate of the control
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get top(): string | number {
|
|
public get top(): string | number {
|
|
return this._top.toString(this._host);
|
|
return this._top.toString(this._host);
|
|
}
|
|
}
|
|
@@ -892,6 +928,7 @@ export class Control {
|
|
* Gets or sets a value indicating the offset on X axis to the linked mesh
|
|
* Gets or sets a value indicating the offset on X axis to the linked mesh
|
|
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get linkOffsetX(): string | number {
|
|
public get linkOffsetX(): string | number {
|
|
return this._linkOffsetX.toString(this._host);
|
|
return this._linkOffsetX.toString(this._host);
|
|
}
|
|
}
|
|
@@ -921,6 +958,7 @@ export class Control {
|
|
* Gets or sets a value indicating the offset on Y axis to the linked mesh
|
|
* Gets or sets a value indicating the offset on Y axis to the linked mesh
|
|
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
*/
|
|
*/
|
|
|
|
+ @serialize()
|
|
public get linkOffsetY(): string | number {
|
|
public get linkOffsetY(): string | number {
|
|
return this._linkOffsetY.toString(this._host);
|
|
return this._linkOffsetY.toString(this._host);
|
|
}
|
|
}
|
|
@@ -956,7 +994,8 @@ export class Control {
|
|
return this._currentMeasure.top + this._currentMeasure.height / 2;
|
|
return this._currentMeasure.top + this._currentMeasure.height / 2;
|
|
}
|
|
}
|
|
|
|
|
|
- /** Gets or sets if control is Enabled*/
|
|
|
|
|
|
+ /** Gets or sets if control is Enabled */
|
|
|
|
+ @serialize()
|
|
public get isEnabled(): boolean {
|
|
public get isEnabled(): boolean {
|
|
return this._isEnabled;
|
|
return this._isEnabled;
|
|
}
|
|
}
|
|
@@ -969,7 +1008,8 @@ export class Control {
|
|
this._isEnabled = value;
|
|
this._isEnabled = value;
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
- /** Gets or sets background color of control if it's disabled*/
|
|
|
|
|
|
+ /** Gets or sets background color of control if it's disabled */
|
|
|
|
+ @serialize()
|
|
public get disabledColor(): string {
|
|
public get disabledColor(): string {
|
|
return this._disabledColor;
|
|
return this._disabledColor;
|
|
}
|
|
}
|
|
@@ -982,7 +1022,8 @@ export class Control {
|
|
this._disabledColor = value;
|
|
this._disabledColor = value;
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
- /** Gets or sets front color of control if it's disabled*/
|
|
|
|
|
|
+ /** Gets or sets front color of control if it's disabled */
|
|
|
|
+ @serialize()
|
|
public get disabledColorItem(): string {
|
|
public get disabledColorItem(): string {
|
|
return this._disabledColorItem;
|
|
return this._disabledColorItem;
|
|
}
|
|
}
|
|
@@ -1972,6 +2013,42 @@ export class Control {
|
|
this._fontOffset = Control._GetFontOffset(this._font);
|
|
this._fontOffset = Control._GetFontOffset(this._font);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Serializes the current control
|
|
|
|
+ * @param serializationObject defined the JSON serialized object
|
|
|
|
+ */
|
|
|
|
+ public serialize(serializationObject: any) {
|
|
|
|
+ SerializationHelper.Serialize(this, serializationObject);
|
|
|
|
+ serializationObject.name = this.name;
|
|
|
|
+ serializationObject.className = this.getClassName();
|
|
|
|
+
|
|
|
|
+ if (this._font) {
|
|
|
|
+ serializationObject.fontFamily = this.fontFamily;
|
|
|
|
+ serializationObject.fontSize = this.fontSize;
|
|
|
|
+ serializationObject.fontWeight = this.fontWeight;
|
|
|
|
+ serializationObject.fontStyle = this.fontStyle;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /** @hidden */
|
|
|
|
+ public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {
|
|
|
|
+ if (serializedObject.fontFamily) {
|
|
|
|
+ this.fontFamily = serializedObject.fontFamily;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (serializedObject.fontSize) {
|
|
|
|
+ this.fontSize = serializedObject.fontSize;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (serializedObject.fontWeight) {
|
|
|
|
+ this.fontWeight = serializedObject.fontWeight;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (serializedObject.fontStyle) {
|
|
|
|
+ this.fontStyle = serializedObject.fontStyle;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/** Releases associated resources */
|
|
/** Releases associated resources */
|
|
public dispose() {
|
|
public dispose() {
|
|
this.onDirtyObservable.clear();
|
|
this.onDirtyObservable.clear();
|
|
@@ -2088,6 +2165,23 @@ export class Control {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Creates a Control from parsed data
|
|
|
|
+ * @param serializedObject defines parsed data
|
|
|
|
+ * @param host defines the hosting AdvancedDynamicTexture
|
|
|
|
+ * @returns a new Control
|
|
|
|
+ */
|
|
|
|
+ public static Parse(serializedObject: any, host: AdvancedDynamicTexture): Control {
|
|
|
|
+ let controlType = Tools.Instantiate("BABYLON.GUI." + serializedObject.className);
|
|
|
|
+ let control = SerializationHelper.Parse(() => new controlType(), serializedObject, null);
|
|
|
|
+
|
|
|
|
+ control.name = serializedObject.name;
|
|
|
|
+
|
|
|
|
+ control._parseFromContent(serializedObject, host);
|
|
|
|
+
|
|
|
|
+ return control;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Creates a stack panel that can be used to render headers
|
|
* Creates a stack panel that can be used to render headers
|
|
* @param control defines the control to associate with the header
|
|
* @param control defines the control to associate with the header
|
|
* @param text defines the text of the header
|
|
* @param text defines the text of the header
|