|
@@ -1,35 +1,52 @@
|
|
/// <reference path="../../../../dist/preview release/babylon.d.ts"/>
|
|
/// <reference path="../../../../dist/preview release/babylon.d.ts"/>
|
|
|
|
|
|
module BABYLON.GUI {
|
|
module BABYLON.GUI {
|
|
|
|
+ /**
|
|
|
|
+ * Root class used for all 2D controls
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#controls
|
|
|
|
+ */
|
|
export class Control {
|
|
export class Control {
|
|
private _alpha = 1;
|
|
private _alpha = 1;
|
|
private _alphaSet = false;
|
|
private _alphaSet = false;
|
|
private _zIndex = 0;
|
|
private _zIndex = 0;
|
|
|
|
+ /** @hidden */
|
|
public _root: Nullable<Container>;
|
|
public _root: Nullable<Container>;
|
|
|
|
+ /** @hidden */
|
|
public _host: AdvancedDynamicTexture;
|
|
public _host: AdvancedDynamicTexture;
|
|
|
|
+ /** Gets or sets the control parent */
|
|
public parent: Nullable<Container>;
|
|
public parent: Nullable<Container>;
|
|
|
|
+ /** @hidden */
|
|
public _currentMeasure = Measure.Empty();
|
|
public _currentMeasure = Measure.Empty();
|
|
private _fontFamily = "Arial";
|
|
private _fontFamily = "Arial";
|
|
private _fontStyle = "";
|
|
private _fontStyle = "";
|
|
private _fontWeight = "";
|
|
private _fontWeight = "";
|
|
private _fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);
|
|
private _fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);
|
|
private _font: string;
|
|
private _font: string;
|
|
|
|
+ /** @hidden */
|
|
public _width = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
|
|
public _width = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
|
|
|
|
+ /** @hidden */
|
|
public _height = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
|
|
public _height = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
|
|
|
|
+ /** @hidden */
|
|
protected _fontOffset: { ascent: number, height: number, descent: number };
|
|
protected _fontOffset: { ascent: number, height: number, descent: number };
|
|
private _color = "";
|
|
private _color = "";
|
|
private _style: BABYLON.Nullable<Style> = null;
|
|
private _style: BABYLON.Nullable<Style> = null;
|
|
private _styleObserver: BABYLON.Nullable<BABYLON.Observer<Style>>;
|
|
private _styleObserver: BABYLON.Nullable<BABYLON.Observer<Style>>;
|
|
|
|
+ /** @hidden */
|
|
protected _horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
|
|
protected _horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
|
|
|
|
+ /** @hidden */
|
|
protected _verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
|
|
protected _verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
|
|
private _isDirty = true;
|
|
private _isDirty = true;
|
|
|
|
+ /** @hidden */
|
|
public _tempParentMeasure = Measure.Empty();
|
|
public _tempParentMeasure = Measure.Empty();
|
|
|
|
+ /** @hidden */
|
|
protected _cachedParentMeasure = Measure.Empty();
|
|
protected _cachedParentMeasure = Measure.Empty();
|
|
private _paddingLeft = new ValueAndUnit(0);
|
|
private _paddingLeft = new ValueAndUnit(0);
|
|
private _paddingRight = new ValueAndUnit(0);
|
|
private _paddingRight = new ValueAndUnit(0);
|
|
private _paddingTop = new ValueAndUnit(0);
|
|
private _paddingTop = new ValueAndUnit(0);
|
|
private _paddingBottom = new ValueAndUnit(0);
|
|
private _paddingBottom = new ValueAndUnit(0);
|
|
|
|
+ /** @hidden */
|
|
public _left = new ValueAndUnit(0);
|
|
public _left = new ValueAndUnit(0);
|
|
|
|
+ /** @hidden */
|
|
public _top = new ValueAndUnit(0);
|
|
public _top = new ValueAndUnit(0);
|
|
private _scaleX = 1.0;
|
|
private _scaleX = 1.0;
|
|
private _scaleY = 1.0;
|
|
private _scaleY = 1.0;
|
|
@@ -37,13 +54,16 @@ module BABYLON.GUI {
|
|
private _transformCenterX = 0.5;
|
|
private _transformCenterX = 0.5;
|
|
private _transformCenterY = 0.5;
|
|
private _transformCenterY = 0.5;
|
|
private _transformMatrix = Matrix2D.Identity();
|
|
private _transformMatrix = Matrix2D.Identity();
|
|
|
|
+ /** @hidden */
|
|
protected _invertTransformMatrix = Matrix2D.Identity();
|
|
protected _invertTransformMatrix = Matrix2D.Identity();
|
|
|
|
+ /** @hidden */
|
|
protected _transformedPosition = Vector2.Zero();
|
|
protected _transformedPosition = Vector2.Zero();
|
|
private _onlyMeasureMode = false;
|
|
private _onlyMeasureMode = false;
|
|
private _isMatrixDirty = true;
|
|
private _isMatrixDirty = true;
|
|
private _cachedOffsetX: number;
|
|
private _cachedOffsetX: number;
|
|
private _cachedOffsetY: number;
|
|
private _cachedOffsetY: number;
|
|
private _isVisible = true;
|
|
private _isVisible = true;
|
|
|
|
+ /** @hidden */
|
|
public _linkedMesh: Nullable<AbstractMesh>;
|
|
public _linkedMesh: Nullable<AbstractMesh>;
|
|
private _fontSet = false;
|
|
private _fontSet = false;
|
|
private _dummyVector2 = Vector2.Zero();
|
|
private _dummyVector2 = Vector2.Zero();
|
|
@@ -52,20 +72,30 @@ module BABYLON.GUI {
|
|
private _doNotRender = false;
|
|
private _doNotRender = false;
|
|
private _downPointerIds:{[id:number] : boolean} = {};
|
|
private _downPointerIds:{[id:number] : boolean} = {};
|
|
|
|
|
|
|
|
+ /** Gets or sets a boolean indicating if the control can be hit with pointer events */
|
|
public isHitTestVisible = true;
|
|
public isHitTestVisible = true;
|
|
|
|
+ /** Gets or sets a boolean indicating if the control can block pointer events */
|
|
public isPointerBlocker = false;
|
|
public isPointerBlocker = false;
|
|
|
|
+ /** Gets or sets a boolean indicating if the control can be focusable */
|
|
public isFocusInvisible = false;
|
|
public isFocusInvisible = false;
|
|
|
|
|
|
|
|
+ /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
public shadowOffsetX = 0;
|
|
public shadowOffsetX = 0;
|
|
|
|
+ /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
|
|
public shadowOffsetY = 0;
|
|
public shadowOffsetY = 0;
|
|
|
|
+ /** Gets or sets a value indicating the amount of blur to use to render the shadow */
|
|
public shadowBlur = 0;
|
|
public shadowBlur = 0;
|
|
|
|
+ /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
|
|
public shadowColor = '#000';
|
|
public shadowColor = '#000';
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _linkOffsetX = new ValueAndUnit(0);
|
|
protected _linkOffsetX = new ValueAndUnit(0);
|
|
|
|
+ /** @hidden */
|
|
protected _linkOffsetY = new ValueAndUnit(0);
|
|
protected _linkOffsetY = new ValueAndUnit(0);
|
|
|
|
|
|
// Properties
|
|
// Properties
|
|
|
|
|
|
|
|
+ /** Gets the control type name */
|
|
public get typeName(): string {
|
|
public get typeName(): string {
|
|
return this._getTypeName();
|
|
return this._getTypeName();
|
|
}
|
|
}
|
|
@@ -119,6 +149,7 @@ module BABYLON.GUI {
|
|
this._fontOffset = offset;
|
|
this._fontOffset = offset;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
|
|
public get alpha(): number {
|
|
public get alpha(): number {
|
|
return this._alpha;
|
|
return this._alpha;
|
|
}
|
|
}
|
|
@@ -132,6 +163,9 @@ module BABYLON.GUI {
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
|
|
+ */
|
|
public get scaleX(): number {
|
|
public get scaleX(): number {
|
|
return this._scaleX;
|
|
return this._scaleX;
|
|
}
|
|
}
|
|
@@ -146,6 +180,9 @@ module BABYLON.GUI {
|
|
this._markMatrixAsDirty();
|
|
this._markMatrixAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
|
|
+ */
|
|
public get scaleY(): number {
|
|
public get scaleY(): number {
|
|
return this._scaleY;
|
|
return this._scaleY;
|
|
}
|
|
}
|
|
@@ -160,6 +197,9 @@ module BABYLON.GUI {
|
|
this._markMatrixAsDirty();
|
|
this._markMatrixAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets the rotation angle (0 by default)
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
|
|
+ */
|
|
public get rotation(): number {
|
|
public get rotation(): number {
|
|
return this._rotation;
|
|
return this._rotation;
|
|
}
|
|
}
|
|
@@ -174,6 +214,9 @@ module BABYLON.GUI {
|
|
this._markMatrixAsDirty();
|
|
this._markMatrixAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets the transformation center on Y axis (0 by default)
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
|
|
+ */
|
|
public get transformCenterY(): number {
|
|
public get transformCenterY(): number {
|
|
return this._transformCenterY;
|
|
return this._transformCenterY;
|
|
}
|
|
}
|
|
@@ -188,6 +231,9 @@ module BABYLON.GUI {
|
|
this._markMatrixAsDirty();
|
|
this._markMatrixAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets the transformation center on X axis (0 by default)
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
|
|
+ */
|
|
public get transformCenterX(): number {
|
|
public get transformCenterX(): number {
|
|
return this._transformCenterX;
|
|
return this._transformCenterX;
|
|
}
|
|
}
|
|
@@ -202,6 +248,10 @@ module BABYLON.GUI {
|
|
this._markMatrixAsDirty();
|
|
this._markMatrixAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets the horizontal alignment
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#alignments
|
|
|
|
+ */
|
|
public get horizontalAlignment(): number {
|
|
public get horizontalAlignment(): number {
|
|
return this._horizontalAlignment;
|
|
return this._horizontalAlignment;
|
|
}
|
|
}
|
|
@@ -215,6 +265,10 @@ module BABYLON.GUI {
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets the vertical alignment
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#alignments
|
|
|
|
+ */
|
|
public get verticalAlignment(): number {
|
|
public get verticalAlignment(): number {
|
|
return this._verticalAlignment;
|
|
return this._verticalAlignment;
|
|
}
|
|
}
|
|
@@ -228,10 +282,18 @@ module BABYLON.GUI {
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets control width
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get width(): string | number {
|
|
public get width(): string | number {
|
|
return this._width.toString(this._host);
|
|
return this._width.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets control width in pixel
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get widthInPixels(): number {
|
|
public get widthInPixels(): number {
|
|
return this._width.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
return this._width.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
}
|
|
}
|
|
@@ -246,10 +308,18 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets control height
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get height(): string | number {
|
|
public get height(): string | number {
|
|
return this._height.toString(this._host);
|
|
return this._height.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets control height in pixel
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get heightInPixels(): number {
|
|
public get heightInPixels(): number {
|
|
return this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
return this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
}
|
|
}
|
|
@@ -264,6 +334,7 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or set font family */
|
|
public get fontFamily(): string {
|
|
public get fontFamily(): string {
|
|
return this._fontFamily;
|
|
return this._fontFamily;
|
|
}
|
|
}
|
|
@@ -305,6 +376,10 @@ module BABYLON.GUI {
|
|
this._resetFontCache();
|
|
this._resetFontCache();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets style
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#styles
|
|
|
|
+ */
|
|
public get style(): BABYLON.Nullable<Style> {
|
|
public get style(): BABYLON.Nullable<Style> {
|
|
return this._style;
|
|
return this._style;
|
|
}
|
|
}
|
|
@@ -333,6 +408,7 @@ module BABYLON.GUI {
|
|
return this._fontSize.isPercentage;
|
|
return this._fontSize.isPercentage;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets font size in pixels */
|
|
public get fontSizeInPixels(): number {
|
|
public get fontSizeInPixels(): number {
|
|
let fontSizeToUse = this._style ? this._style._fontSize : this._fontSize;
|
|
let fontSizeToUse = this._style ? this._style._fontSize : this._fontSize;
|
|
|
|
|
|
@@ -343,6 +419,7 @@ module BABYLON.GUI {
|
|
return fontSizeToUse.getValueInPixel(this._host, this._tempParentMeasure.height || this._cachedParentMeasure.height);
|
|
return fontSizeToUse.getValueInPixel(this._host, this._tempParentMeasure.height || this._cachedParentMeasure.height);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets font size */
|
|
public get fontSize(): string | number {
|
|
public get fontSize(): string | number {
|
|
return this._fontSize.toString(this._host);
|
|
return this._fontSize.toString(this._host);
|
|
}
|
|
}
|
|
@@ -358,6 +435,7 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets foreground color */
|
|
public get color(): string {
|
|
public get color(): string {
|
|
return this._color;
|
|
return this._color;
|
|
}
|
|
}
|
|
@@ -371,6 +449,7 @@ module BABYLON.GUI {
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets z index which is used to reorder controls on the z axis */
|
|
public get zIndex(): number {
|
|
public get zIndex(): number {
|
|
return this._zIndex;
|
|
return this._zIndex;
|
|
}
|
|
}
|
|
@@ -387,6 +466,7 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets a boolean indicating if the control can be rendered */
|
|
public get notRenderable(): boolean {
|
|
public get notRenderable(): boolean {
|
|
return this._doNotRender;
|
|
return this._doNotRender;
|
|
}
|
|
}
|
|
@@ -400,6 +480,7 @@ module BABYLON.GUI {
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets or sets a boolean indicating if the control is visible */
|
|
public get isVisible(): boolean {
|
|
public get isVisible(): boolean {
|
|
return this._isVisible;
|
|
return this._isVisible;
|
|
}
|
|
}
|
|
@@ -413,14 +494,23 @@ module BABYLON.GUI {
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets a boolean indicating that the control needs to update its rendering */
|
|
public get isDirty(): boolean {
|
|
public get isDirty(): boolean {
|
|
return this._isDirty;
|
|
return this._isDirty;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a value indicating the padding to use on the left of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get paddingLeft(): string | number {
|
|
public get paddingLeft(): string | number {
|
|
return this._paddingLeft.toString(this._host);
|
|
return this._paddingLeft.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets a value indicating the padding in pixels to use on the left of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get paddingLeftInPixels(): number {
|
|
public get paddingLeftInPixels(): number {
|
|
return this._paddingLeft.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
return this._paddingLeft.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
}
|
|
}
|
|
@@ -431,10 +521,18 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a value indicating the padding to use on the right of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get paddingRight(): string | number {
|
|
public get paddingRight(): string | number {
|
|
return this._paddingRight.toString(this._host);
|
|
return this._paddingRight.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets a value indicating the padding in pixels to use on the right of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get paddingRightInPixels(): number {
|
|
public get paddingRightInPixels(): number {
|
|
return this._paddingRight.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
return this._paddingRight.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
}
|
|
}
|
|
@@ -445,10 +543,18 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a value indicating the padding to use on the top of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get paddingTop(): string | number {
|
|
public get paddingTop(): string | number {
|
|
return this._paddingTop.toString(this._host);
|
|
return this._paddingTop.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets a value indicating the padding in pixels to use on the top of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get paddingTopInPixels(): number {
|
|
public get paddingTopInPixels(): number {
|
|
return this._paddingTop.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
return this._paddingTop.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
}
|
|
}
|
|
@@ -459,10 +565,18 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a value indicating the padding to use on the bottom of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get paddingBottom(): string | number {
|
|
public get paddingBottom(): string | number {
|
|
return this._paddingBottom.toString(this._host);
|
|
return this._paddingBottom.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets a value indicating the padding in pixels to use on the bottom of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get paddingBottomInPixels(): number {
|
|
public get paddingBottomInPixels(): number {
|
|
return this._paddingBottom.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
return this._paddingBottom.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
}
|
|
}
|
|
@@ -473,10 +587,18 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a value indicating the left coordinate of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get left(): string | number {
|
|
public get left(): string | number {
|
|
return this._left.toString(this._host);
|
|
return this._left.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets a value indicating the left coordinate in pixels of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get leftInPixels(): number {
|
|
public get leftInPixels(): number {
|
|
return this._left.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
return this._left.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
}
|
|
}
|
|
@@ -487,10 +609,18 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a value indicating the top coordinate of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get top(): string | number {
|
|
public get top(): string | number {
|
|
return this._top.toString(this._host);
|
|
return this._top.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets a value indicating the top coordinate in pixels of the control
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
public get topInPixels(): number {
|
|
public get topInPixels(): number {
|
|
return this._top.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
return this._top.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
}
|
|
}
|
|
@@ -501,10 +631,18 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a value indicating the offset on X axis to the linked mesh
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
|
|
+ */
|
|
public get linkOffsetX(): string | number {
|
|
public get linkOffsetX(): string | number {
|
|
return this._linkOffsetX.toString(this._host);
|
|
return this._linkOffsetX.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets a value indicating the offset in pixels on X axis to the linked mesh
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
|
|
+ */
|
|
public get linkOffsetXInPixels(): number {
|
|
public get linkOffsetXInPixels(): number {
|
|
return this._linkOffsetX.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
return this._linkOffsetX.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
}
|
|
}
|
|
@@ -515,10 +653,18 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets a value indicating the offset on Y axis to the linked mesh
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
|
|
+ */
|
|
public get linkOffsetY(): string | number {
|
|
public get linkOffsetY(): string | number {
|
|
return this._linkOffsetY.toString(this._host);
|
|
return this._linkOffsetY.toString(this._host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets a value indicating the offset in pixels on Y axis to the linked mesh
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
|
|
+ */
|
|
public get linkOffsetYInPixels(): number {
|
|
public get linkOffsetYInPixels(): number {
|
|
return this._linkOffsetY.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
return this._linkOffsetY.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
}
|
|
}
|
|
@@ -529,18 +675,28 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets the center coordinate on X axis */
|
|
public get centerX(): number {
|
|
public get centerX(): number {
|
|
return this._currentMeasure.left + this._currentMeasure.width / 2;
|
|
return this._currentMeasure.left + this._currentMeasure.width / 2;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Gets the center coordinate on Y axis */
|
|
public get centerY(): number {
|
|
public get centerY(): number {
|
|
return this._currentMeasure.top + this._currentMeasure.height / 2;
|
|
return this._currentMeasure.top + this._currentMeasure.height / 2;
|
|
}
|
|
}
|
|
|
|
|
|
// Functions
|
|
// Functions
|
|
- constructor(public name?: string) {
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Creates a new control
|
|
|
|
+ * @param name defines the name of the control
|
|
|
|
+ */
|
|
|
|
+ constructor(
|
|
|
|
+ /** defines the name of the control */
|
|
|
|
+ public name?: string) {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _getTypeName(): string {
|
|
protected _getTypeName(): string {
|
|
return "Control";
|
|
return "Control";
|
|
}
|
|
}
|
|
@@ -550,6 +706,11 @@ module BABYLON.GUI {
|
|
this._fontSet = true;
|
|
this._fontSet = true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets coordinates in local control space
|
|
|
|
+ * @param globalCoordinates defines the coordinates to transform
|
|
|
|
+ * @returns the new coordinates in local space
|
|
|
|
+ */
|
|
public getLocalCoordinates(globalCoordinates: Vector2): Vector2 {
|
|
public getLocalCoordinates(globalCoordinates: Vector2): Vector2 {
|
|
var result = Vector2.Zero();
|
|
var result = Vector2.Zero();
|
|
|
|
|
|
@@ -558,12 +719,23 @@ module BABYLON.GUI {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets coordinates in local control space
|
|
|
|
+ * @param globalCoordinates defines the coordinates to transform
|
|
|
|
+ * @param result defines the target vector2 where to store the result
|
|
|
|
+ * @returns the current control
|
|
|
|
+ */
|
|
public getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control {
|
|
public getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control {
|
|
result.x = globalCoordinates.x - this._currentMeasure.left;
|
|
result.x = globalCoordinates.x - this._currentMeasure.left;
|
|
result.y = globalCoordinates.y - this._currentMeasure.top;
|
|
result.y = globalCoordinates.y - this._currentMeasure.top;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets coordinates in parent local control space
|
|
|
|
+ * @param globalCoordinates defines the coordinates to transform
|
|
|
|
+ * @returns the new coordinates in parent local space
|
|
|
|
+ */
|
|
public getParentLocalCoordinates(globalCoordinates: Vector2): Vector2 {
|
|
public getParentLocalCoordinates(globalCoordinates: Vector2): Vector2 {
|
|
var result = Vector2.Zero();
|
|
var result = Vector2.Zero();
|
|
|
|
|
|
@@ -573,6 +745,11 @@ module BABYLON.GUI {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Move the current control to a vector3 position projected onto the screen.
|
|
|
|
+ * @param position defines the target position
|
|
|
|
+ * @param scene defines the hosting scene
|
|
|
|
+ */
|
|
public moveToVector3(position: Vector3, scene: Scene): void {
|
|
public moveToVector3(position: Vector3, scene: Scene): void {
|
|
if (!this._host || this._root !== this._host._rootContainer) {
|
|
if (!this._host || this._root !== this._host._rootContainer) {
|
|
Tools.Error("Cannot move a control to a vector3 if the control is not at root level");
|
|
Tools.Error("Cannot move a control to a vector3 if the control is not at root level");
|
|
@@ -594,6 +771,11 @@ module BABYLON.GUI {
|
|
this.notRenderable = false;
|
|
this.notRenderable = false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Link current control with a target mesh
|
|
|
|
+ * @param mesh defines the mesh to link with
|
|
|
|
+ * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
|
|
+ */
|
|
public linkWithMesh(mesh: Nullable<AbstractMesh>): void {
|
|
public linkWithMesh(mesh: Nullable<AbstractMesh>): void {
|
|
if (!this._host || this._root && this._root !== this._host._rootContainer) {
|
|
if (!this._host || this._root && this._root !== this._host._rootContainer) {
|
|
if (mesh) {
|
|
if (mesh) {
|
|
@@ -620,6 +802,7 @@ module BABYLON.GUI {
|
|
this._host._linkedControls.push(this);
|
|
this._host._linkedControls.push(this);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _moveToProjectedPosition(projectedPosition: Vector3): void {
|
|
public _moveToProjectedPosition(projectedPosition: Vector3): void {
|
|
let oldLeft = this._left.getValue(this._host);
|
|
let oldLeft = this._left.getValue(this._host);
|
|
let oldTop = this._top.getValue(this._host);
|
|
let oldTop = this._top.getValue(this._host);
|
|
@@ -644,11 +827,13 @@ module BABYLON.GUI {
|
|
this._top.ignoreAdaptiveScaling = true;
|
|
this._top.ignoreAdaptiveScaling = true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _markMatrixAsDirty(): void {
|
|
public _markMatrixAsDirty(): void {
|
|
this._isMatrixDirty = true;
|
|
this._isMatrixDirty = true;
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _markAsDirty(): void {
|
|
public _markAsDirty(): void {
|
|
this._isDirty = true;
|
|
this._isDirty = true;
|
|
|
|
|
|
@@ -658,6 +843,7 @@ module BABYLON.GUI {
|
|
this._host.markAsDirty();
|
|
this._host.markAsDirty();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _markAllAsDirty(): void {
|
|
public _markAllAsDirty(): void {
|
|
this._markAsDirty();
|
|
this._markAsDirty();
|
|
|
|
|
|
@@ -666,11 +852,13 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void {
|
|
public _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void {
|
|
this._root = root;
|
|
this._root = root;
|
|
this._host = host;
|
|
this._host = host;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _transform(context: CanvasRenderingContext2D): void {
|
|
protected _transform(context: CanvasRenderingContext2D): void {
|
|
if (!this._isMatrixDirty && this._scaleX === 1 && this._scaleY === 1 && this._rotation === 0) {
|
|
if (!this._isMatrixDirty && this._scaleX === 1 && this._scaleY === 1 && this._rotation === 0) {
|
|
return;
|
|
return;
|
|
@@ -702,6 +890,7 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _applyStates(context: CanvasRenderingContext2D): void {
|
|
protected _applyStates(context: CanvasRenderingContext2D): void {
|
|
if (this._fontSet) {
|
|
if (this._fontSet) {
|
|
this._prepareFont();
|
|
this._prepareFont();
|
|
@@ -721,6 +910,7 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean {
|
|
protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean {
|
|
if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
|
|
if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
|
|
this._isDirty = false;
|
|
this._isDirty = false;
|
|
@@ -779,6 +969,7 @@ module BABYLON.GUI {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _clip(context: CanvasRenderingContext2D) {
|
|
protected _clip(context: CanvasRenderingContext2D) {
|
|
context.beginPath();
|
|
context.beginPath();
|
|
|
|
|
|
@@ -801,6 +992,7 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _measure(): void {
|
|
public _measure(): void {
|
|
// Width / Height
|
|
// Width / Height
|
|
if (this._width.isPixel) {
|
|
if (this._width.isPixel) {
|
|
@@ -816,6 +1008,7 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
var width = this._currentMeasure.width;
|
|
var width = this._currentMeasure.width;
|
|
var height = this._currentMeasure.height;
|
|
var height = this._currentMeasure.height;
|
|
@@ -895,18 +1088,27 @@ module BABYLON.GUI {
|
|
this._currentMeasure.top += y;
|
|
this._currentMeasure.top += y;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
// Do nothing
|
|
// Do nothing
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
// Do nothing
|
|
// Do nothing
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
|
|
// Do nothing
|
|
// Do nothing
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Tests if a given coordinates belong to the current control
|
|
|
|
+ * @param x defines x coordinate to test
|
|
|
|
+ * @param y defines y coordinate to test
|
|
|
|
+ * @returns true if the coordinates are inside the control
|
|
|
|
+ */
|
|
public contains(x: number, y: number): boolean {
|
|
public contains(x: number, y: number): boolean {
|
|
// Invert transform
|
|
// Invert transform
|
|
this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);
|
|
this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);
|
|
@@ -937,6 +1139,7 @@ module BABYLON.GUI {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _processPicking(x: number, y: number, type: number, pointerId:number, buttonIndex: number): boolean {
|
|
public _processPicking(x: number, y: number, type: number, pointerId:number, buttonIndex: number): boolean {
|
|
if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {
|
|
if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {
|
|
return false;
|
|
return false;
|
|
@@ -951,12 +1154,14 @@ module BABYLON.GUI {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _onPointerMove(target: Control, coordinates: Vector2): void {
|
|
public _onPointerMove(target: Control, coordinates: Vector2): void {
|
|
var canNotify: boolean = this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this);
|
|
var canNotify: boolean = this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this);
|
|
|
|
|
|
if (canNotify && this.parent != null) this.parent._onPointerMove(target, coordinates);
|
|
if (canNotify && this.parent != null) this.parent._onPointerMove(target, coordinates);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _onPointerEnter(target: Control): boolean {
|
|
public _onPointerEnter(target: Control): boolean {
|
|
if (this._enterCount !== 0) {
|
|
if (this._enterCount !== 0) {
|
|
return false;
|
|
return false;
|
|
@@ -971,6 +1176,7 @@ module BABYLON.GUI {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _onPointerOut(target: Control): void {
|
|
public _onPointerOut(target: Control): void {
|
|
this._enterCount = 0;
|
|
this._enterCount = 0;
|
|
|
|
|
|
@@ -979,6 +1185,7 @@ module BABYLON.GUI {
|
|
if (canNotify && this.parent != null) this.parent._onPointerOut(target);
|
|
if (canNotify && this.parent != null) this.parent._onPointerOut(target);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _onPointerDown(target: Control, coordinates: Vector2, pointerId:number, buttonIndex: number): boolean {
|
|
public _onPointerDown(target: Control, coordinates: Vector2, pointerId:number, buttonIndex: number): boolean {
|
|
if (this._downCount !== 0) {
|
|
if (this._downCount !== 0) {
|
|
return false;
|
|
return false;
|
|
@@ -995,6 +1202,7 @@ module BABYLON.GUI {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _onPointerUp(target: Control, coordinates: Vector2, pointerId:number, buttonIndex: number, notifyClick: boolean): void {
|
|
public _onPointerUp(target: Control, coordinates: Vector2, pointerId:number, buttonIndex: number, notifyClick: boolean): void {
|
|
this._downCount = 0;
|
|
this._downCount = 0;
|
|
|
|
|
|
@@ -1009,7 +1217,8 @@ module BABYLON.GUI {
|
|
if (canNotify && this.parent != null) this.parent._onPointerUp(target, coordinates, pointerId, buttonIndex, canNotifyClick);
|
|
if (canNotify && this.parent != null) this.parent._onPointerUp(target, coordinates, pointerId, buttonIndex, canNotifyClick);
|
|
}
|
|
}
|
|
|
|
|
|
- public forcePointerUp(pointerId:Nullable<number> = null) {
|
|
|
|
|
|
+ /** @hidden */
|
|
|
|
+ public _forcePointerUp(pointerId:Nullable<number> = null) {
|
|
if(pointerId !== null){
|
|
if(pointerId !== null){
|
|
this._onPointerUp(this, Vector2.Zero(), pointerId, 0, true);
|
|
this._onPointerUp(this, Vector2.Zero(), pointerId, 0, true);
|
|
}else{
|
|
}else{
|
|
@@ -1019,6 +1228,7 @@ module BABYLON.GUI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public _processObservables(type: number, x: number, y: number, pointerId:number, buttonIndex: number): boolean {
|
|
public _processObservables(type: number, x: number, y: number, pointerId:number, buttonIndex: number): boolean {
|
|
this._dummyVector2.copyFromFloats(x, y);
|
|
this._dummyVector2.copyFromFloats(x, y);
|
|
if (type === BABYLON.PointerEventTypes.POINTERMOVE) {
|
|
if (type === BABYLON.PointerEventTypes.POINTERMOVE) {
|
|
@@ -1055,7 +1265,6 @@ module BABYLON.GUI {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
private _prepareFont() {
|
|
private _prepareFont() {
|
|
if (!this._font && !this._fontSet) {
|
|
if (!this._font && !this._fontSet) {
|
|
return;
|
|
return;
|
|
@@ -1070,6 +1279,7 @@ module BABYLON.GUI {
|
|
this._fontOffset = Control._GetFontOffset(this._font);
|
|
this._fontOffset = Control._GetFontOffset(this._font);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Releases associated resources */
|
|
public dispose() {
|
|
public dispose() {
|
|
this.onDirtyObservable.clear();
|
|
this.onDirtyObservable.clear();
|
|
this.onAfterDrawObservable.clear();
|
|
this.onAfterDrawObservable.clear();
|
|
@@ -1105,32 +1315,39 @@ module BABYLON.GUI {
|
|
private static _VERTICAL_ALIGNMENT_BOTTOM = 1;
|
|
private static _VERTICAL_ALIGNMENT_BOTTOM = 1;
|
|
private static _VERTICAL_ALIGNMENT_CENTER = 2;
|
|
private static _VERTICAL_ALIGNMENT_CENTER = 2;
|
|
|
|
|
|
|
|
+ /** HORIZONTAL_ALIGNMENT_LEFT */
|
|
public static get HORIZONTAL_ALIGNMENT_LEFT(): number {
|
|
public static get HORIZONTAL_ALIGNMENT_LEFT(): number {
|
|
return Control._HORIZONTAL_ALIGNMENT_LEFT;
|
|
return Control._HORIZONTAL_ALIGNMENT_LEFT;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** HORIZONTAL_ALIGNMENT_RIGHT */
|
|
public static get HORIZONTAL_ALIGNMENT_RIGHT(): number {
|
|
public static get HORIZONTAL_ALIGNMENT_RIGHT(): number {
|
|
return Control._HORIZONTAL_ALIGNMENT_RIGHT;
|
|
return Control._HORIZONTAL_ALIGNMENT_RIGHT;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** HORIZONTAL_ALIGNMENT_CENTER */
|
|
public static get HORIZONTAL_ALIGNMENT_CENTER(): number {
|
|
public static get HORIZONTAL_ALIGNMENT_CENTER(): number {
|
|
return Control._HORIZONTAL_ALIGNMENT_CENTER;
|
|
return Control._HORIZONTAL_ALIGNMENT_CENTER;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** VERTICAL_ALIGNMENT_TOP */
|
|
public static get VERTICAL_ALIGNMENT_TOP(): number {
|
|
public static get VERTICAL_ALIGNMENT_TOP(): number {
|
|
return Control._VERTICAL_ALIGNMENT_TOP;
|
|
return Control._VERTICAL_ALIGNMENT_TOP;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** VERTICAL_ALIGNMENT_BOTTOM */
|
|
public static get VERTICAL_ALIGNMENT_BOTTOM(): number {
|
|
public static get VERTICAL_ALIGNMENT_BOTTOM(): number {
|
|
return Control._VERTICAL_ALIGNMENT_BOTTOM;
|
|
return Control._VERTICAL_ALIGNMENT_BOTTOM;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** VERTICAL_ALIGNMENT_CENTER */
|
|
public static get VERTICAL_ALIGNMENT_CENTER(): number {
|
|
public static get VERTICAL_ALIGNMENT_CENTER(): number {
|
|
return Control._VERTICAL_ALIGNMENT_CENTER;
|
|
return Control._VERTICAL_ALIGNMENT_CENTER;
|
|
}
|
|
}
|
|
|
|
|
|
private static _FontHeightSizes: { [key: string]: { ascent: number, height: number, descent: number } } = {};
|
|
private static _FontHeightSizes: { [key: string]: { ascent: number, height: number, descent: number } } = {};
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
public static _GetFontOffset(font: string): { ascent: number, height: number, descent: number } {
|
|
public static _GetFontOffset(font: string): { ascent: number, height: number, descent: number } {
|
|
|
|
|
|
if (Control._FontHeightSizes[font]) {
|
|
if (Control._FontHeightSizes[font]) {
|
|
@@ -1168,6 +1385,14 @@ module BABYLON.GUI {
|
|
return result;
|
|
return result;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Creates a stack panel that can be used to render headers
|
|
|
|
+ * @param control defines the control to associate with the header
|
|
|
|
+ * @param text defines the text of the header
|
|
|
|
+ * @param size defines the size of the header
|
|
|
|
+ * @param options defines options used to configure the header
|
|
|
|
+ * @returns a new StackPanel
|
|
|
|
+ */
|
|
public static AddHeader(control: Control, text: string, size: string | number, options: { isHorizontal: boolean, controlFirst: boolean }): StackPanel {
|
|
public static AddHeader(control: Control, text: string, size: string | number, options: { isHorizontal: boolean, controlFirst: boolean }): StackPanel {
|
|
let panel = new BABYLON.GUI.StackPanel("panel");
|
|
let panel = new BABYLON.GUI.StackPanel("panel");
|
|
let isHorizontal = options ? options.isHorizontal : true;
|
|
let isHorizontal = options ? options.isHorizontal : true;
|
|
@@ -1202,6 +1427,7 @@ module BABYLON.GUI {
|
|
return panel;
|
|
return panel;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** @hidden */
|
|
protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void {
|
|
protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void {
|
|
context.translate(x, y);
|
|
context.translate(x, y);
|
|
context.scale(width, height);
|
|
context.scale(width, height);
|