|
@@ -1170,6 +1170,56 @@ export class Control {
|
|
this._host._linkedControls.push(this);
|
|
this._host._linkedControls.push(this);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
|
|
|
|
+ * @param { string | number} paddingTop - The value of the top padding.
|
|
|
|
+ * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
|
|
|
|
+ * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
|
|
|
|
+ * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
|
|
|
|
+ * @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
|
|
+ public setPadding(
|
|
|
|
+ paddingTop: string | number,
|
|
|
|
+ paddingRight?: string | number,
|
|
|
|
+ paddingBottom?: string | number,
|
|
|
|
+ paddingLeft?: string | number
|
|
|
|
+ ) {
|
|
|
|
+ const top = paddingTop;
|
|
|
|
+ const right = paddingRight ?? top;
|
|
|
|
+ const bottom = paddingBottom ?? top;
|
|
|
|
+ const left = paddingLeft ?? right;
|
|
|
|
+
|
|
|
|
+ this.paddingTop = top;
|
|
|
|
+ this.paddingRight = right;
|
|
|
|
+ this.paddingBottom = bottom;
|
|
|
|
+ this.paddingLeft = left;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Shorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.
|
|
|
|
+ * @param { number} paddingTop - The value in pixels of the top padding.
|
|
|
|
+ * @param { number} paddingRight - The value in pixels of the right padding. If omitted, top is used.
|
|
|
|
+ * @param { number} paddingBottom - The value in pixels of the bottom padding. If omitted, top is used.
|
|
|
|
+ * @param { number} paddingLeft - The value in pixels of the left padding. If omitted, right is used.
|
|
|
|
+ * @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
|
|
+ */
|
|
|
|
+ public setPaddingInPixels(
|
|
|
|
+ paddingTop: number,
|
|
|
|
+ paddingRight?: number,
|
|
|
|
+ paddingBottom?: number,
|
|
|
|
+ paddingLeft?: number
|
|
|
|
+ ) {
|
|
|
|
+ const top = paddingTop;
|
|
|
|
+ const right = paddingRight ?? top;
|
|
|
|
+ const bottom = paddingBottom ?? top;
|
|
|
|
+ const left = paddingLeft ?? right;
|
|
|
|
+
|
|
|
|
+ this.paddingTopInPixels = top;
|
|
|
|
+ this.paddingRightInPixels = right;
|
|
|
|
+ this.paddingBottomInPixels = bottom;
|
|
|
|
+ this.paddingLeftInPixels = left;
|
|
|
|
+ }
|
|
|
|
+
|
|
/** @hidden */
|
|
/** @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);
|