@babylonjs/gui 6.39.0 → 6.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/2D/advancedDynamicTexture.d.ts +1 -1
  2. package/2D/advancedDynamicTexture.js +2 -1
  3. package/2D/advancedDynamicTexture.js.map +1 -1
  4. package/2D/controls/button.d.ts +2 -5
  5. package/2D/controls/button.js +6 -6
  6. package/2D/controls/button.js.map +1 -1
  7. package/2D/controls/container.d.ts +6 -1
  8. package/2D/controls/container.js +31 -5
  9. package/2D/controls/container.js.map +1 -1
  10. package/2D/controls/control.d.ts +9 -1
  11. package/2D/controls/control.js +16 -2
  12. package/2D/controls/control.js.map +1 -1
  13. package/2D/controls/focusableButton.d.ts +1 -1
  14. package/2D/controls/focusableButton.js +1 -1
  15. package/2D/controls/focusableButton.js.map +1 -1
  16. package/2D/controls/gradient/BaseGradient.d.ts +17 -5
  17. package/2D/controls/gradient/BaseGradient.js +17 -5
  18. package/2D/controls/gradient/BaseGradient.js.map +1 -1
  19. package/2D/controls/grid.d.ts +2 -1
  20. package/2D/controls/grid.js +6 -2
  21. package/2D/controls/grid.js.map +1 -1
  22. package/2D/controls/image.d.ts +2 -1
  23. package/2D/controls/image.js +2 -1
  24. package/2D/controls/image.js.map +1 -1
  25. package/2D/controls/stackPanel.d.ts +2 -1
  26. package/2D/controls/stackPanel.js +6 -2
  27. package/2D/controls/stackPanel.js.map +1 -1
  28. package/2D/xmlLoader.js +9 -0
  29. package/2D/xmlLoader.js.map +1 -1
  30. package/3D/controls/button3D.d.ts +1 -0
  31. package/3D/controls/button3D.js +1 -0
  32. package/3D/controls/button3D.js.map +1 -1
  33. package/3D/controls/control3D.d.ts +1 -1
  34. package/3D/controls/control3D.js +1 -1
  35. package/3D/controls/control3D.js.map +1 -1
  36. package/3D/controls/holographicSlate.d.ts +1 -1
  37. package/3D/controls/holographicSlate.js +1 -1
  38. package/3D/controls/holographicSlate.js.map +1 -1
  39. package/3D/controls/touchHolographicMenu.d.ts +2 -2
  40. package/3D/controls/touchHolographicMenu.js +2 -2
  41. package/3D/controls/touchHolographicMenu.js.map +1 -1
  42. package/package.json +2 -2
@@ -50,5 +50,5 @@ export declare class FocusableButton extends Button implements IFocusableControl
50
50
  */
51
51
  _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
52
52
  /** @internal */
53
- displose(): void;
53
+ dispose(): void;
54
54
  }
@@ -79,7 +79,7 @@ export class FocusableButton extends Button {
79
79
  return super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi);
80
80
  }
81
81
  /** @internal */
82
- displose() {
82
+ dispose() {
83
83
  super.dispose();
84
84
  this.onBlurObservable.clear();
85
85
  this.onFocusObservable.clear();
@@ -1 +1 @@
1
- {"version":3,"file":"focusableButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/focusableButton.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAGlD;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,MAAM;IAavC,YAAmB,IAAa;QAC5B,KAAK,CAAC,IAAI,CAAC,CAAC;QADG,SAAI,GAAJ,IAAI,CAAS;QAZhC,6CAA6C;QACtC,iBAAY,GAAqB,IAAI,CAAC;QACrC,eAAU,GAAG,KAAK,CAAC;QACnB,oBAAe,GAAqB,IAAI,CAAC;QAEjD,wDAAwD;QACjD,sBAAiB,GAAG,IAAI,UAAU,EAAU,CAAC;QACpD,yDAAyD;QAClD,qBAAgB,GAAG,IAAI,UAAU,EAAU,CAAC;QACnD,uDAAuD;QAChD,uCAAkC,GAAG,IAAI,UAAU,EAAkB,CAAC;QAKzE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC;IACtC,CAAC;IAED,gBAAgB;IACT,MAAM;QACT,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,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E,CAAC,CAAC;IACjF,CAAC;IAED,gBAAgB;IACT,QAAQ;QACX,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,kCAAkC,CAAC,KAAK,EAAE,CAAC;IACpD,CAAC;CACJ;AACD,aAAa,CAAC,6BAA6B,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nimport { Button } from \"./button\";\r\nimport type { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport type { IFocusableControl } from \"./focusableControl\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { IKeyboardEvent } from \"core/Events/deviceInputEvents\";\r\n\r\n/**\r\n * Class used to create a focusable button that can easily handle keyboard events\r\n * @since 5.0.0\r\n */\r\nexport class FocusableButton extends Button implements IFocusableControl {\r\n /** Highlight color when button is focused */\r\n public focusedColor: Nullable<string> = null;\r\n private _isFocused = false;\r\n private _unfocusedColor: Nullable<string> = null;\r\n\r\n /** Observable raised when the control gets the focus */\r\n public onFocusObservable = new Observable<Button>();\r\n /** Observable raised when the control loses the focus */\r\n public onBlurObservable = new Observable<Button>();\r\n /** Observable raised when a key event was processed */\r\n public onKeyboardEventProcessedObservable = new Observable<IKeyboardEvent>();\r\n\r\n constructor(public name?: string) {\r\n super(name);\r\n\r\n this._unfocusedColor = this.color;\r\n }\r\n\r\n /** @internal */\r\n public onBlur(): void {\r\n if (this._isFocused) {\r\n this._isFocused = false;\r\n if (this.focusedColor && this._unfocusedColor != null) {\r\n // Set color back to saved unfocused color\r\n this.color = this._unfocusedColor;\r\n }\r\n this.onBlurObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public onFocus(): void {\r\n this._isFocused = true;\r\n\r\n if (this.focusedColor) {\r\n // Save the unfocused color\r\n this._unfocusedColor = this.color;\r\n this.color = this.focusedColor;\r\n }\r\n this.onFocusObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Function called to get the list of controls that should not steal the focus from this control\r\n * @returns an array of controls\r\n */\r\n public keepsFocusWith(): Nullable<Control[]> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Function to focus a button programmatically\r\n */\r\n public focus() {\r\n this._host.moveFocusToControl(this);\r\n }\r\n\r\n /**\r\n * Function to unfocus a button programmatically\r\n */\r\n public blur() {\r\n this._host.focusedControl = null;\r\n }\r\n\r\n /**\r\n * Handles the keyboard event\r\n * @param evt Defines the KeyboardEvent\r\n */\r\n public processKeyboard(evt: IKeyboardEvent): void {\r\n this.onKeyboardEventProcessedObservable.notifyObservers(evt, -1, this);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean {\r\n if (!this.isReadOnly) {\r\n // Clicking on button should focus\r\n this.focus();\r\n }\r\n\r\n return super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi);\r\n }\r\n\r\n /** @internal */\r\n public displose() {\r\n super.dispose();\r\n\r\n this.onBlurObservable.clear();\r\n this.onFocusObservable.clear();\r\n this.onKeyboardEventProcessedObservable.clear();\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.FocusableButton\", FocusableButton);\r\n"]}
1
+ {"version":3,"file":"focusableButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/focusableButton.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAGlD;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,MAAM;IAavC,YAAmB,IAAa;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I,IAAI;QACP,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,GAAmB;QACtC,IAAI,CAAC,kCAAkC,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,MAAe,EAAE,WAAoB,EAAE,SAAiB,EAAE,WAAmB,EAAE,EAAmB;QACpH,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,kCAAkC;YAClC,IAAI,CAAC,KAAK,EAAE,CAAC;SAChB;QAED,OAAO,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,gBAAgB;IACT,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,kCAAkC,CAAC,KAAK,EAAE,CAAC;IACpD,CAAC;CACJ;AACD,aAAa,CAAC,6BAA6B,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nimport { Button } from \"./button\";\r\nimport type { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport type { IFocusableControl } from \"./focusableControl\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { IKeyboardEvent } from \"core/Events/deviceInputEvents\";\r\n\r\n/**\r\n * Class used to create a focusable button that can easily handle keyboard events\r\n * @since 5.0.0\r\n */\r\nexport class FocusableButton extends Button implements IFocusableControl {\r\n /** Highlight color when button is focused */\r\n public focusedColor: Nullable<string> = null;\r\n private _isFocused = false;\r\n private _unfocusedColor: Nullable<string> = null;\r\n\r\n /** Observable raised when the control gets the focus */\r\n public onFocusObservable = new Observable<Button>();\r\n /** Observable raised when the control loses the focus */\r\n public onBlurObservable = new Observable<Button>();\r\n /** Observable raised when a key event was processed */\r\n public onKeyboardEventProcessedObservable = new Observable<IKeyboardEvent>();\r\n\r\n constructor(public name?: string) {\r\n super(name);\r\n\r\n this._unfocusedColor = this.color;\r\n }\r\n\r\n /** @internal */\r\n public onBlur(): void {\r\n if (this._isFocused) {\r\n this._isFocused = false;\r\n if (this.focusedColor && this._unfocusedColor != null) {\r\n // Set color back to saved unfocused color\r\n this.color = this._unfocusedColor;\r\n }\r\n this.onBlurObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public onFocus(): void {\r\n this._isFocused = true;\r\n\r\n if (this.focusedColor) {\r\n // Save the unfocused color\r\n this._unfocusedColor = this.color;\r\n this.color = this.focusedColor;\r\n }\r\n this.onFocusObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Function called to get the list of controls that should not steal the focus from this control\r\n * @returns an array of controls\r\n */\r\n public keepsFocusWith(): Nullable<Control[]> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Function to focus a button programmatically\r\n */\r\n public focus() {\r\n this._host.moveFocusToControl(this);\r\n }\r\n\r\n /**\r\n * Function to unfocus a button programmatically\r\n */\r\n public blur() {\r\n this._host.focusedControl = null;\r\n }\r\n\r\n /**\r\n * Handles the keyboard event\r\n * @param evt Defines the KeyboardEvent\r\n */\r\n public processKeyboard(evt: IKeyboardEvent): void {\r\n this.onKeyboardEventProcessedObservable.notifyObservers(evt, -1, this);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean {\r\n if (!this.isReadOnly) {\r\n // Clicking on button should focus\r\n this.focus();\r\n }\r\n\r\n return super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this.onBlurObservable.clear();\r\n this.onFocusObservable.clear();\r\n this.onKeyboardEventProcessedObservable.clear();\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.FocusableButton\", FocusableButton);\r\n"]}
@@ -29,7 +29,9 @@ export declare abstract class BaseGradient {
29
29
  /**
30
30
  * If there are any changes or the context changed, regenerate the canvas gradient object. Else,
31
31
  * reuse the existing gradient.
32
- **/
32
+ * @param context the context to create the gradient from
33
+ * @returns the canvas gradient
34
+ */
33
35
  getCanvasGradient(context: ICanvasRenderingContext): CanvasGradient;
34
36
  /**
35
37
  * Adds a new color stop to the gradient.
@@ -46,12 +48,22 @@ export declare abstract class BaseGradient {
46
48
  * Removes all color stops from the gradient
47
49
  */
48
50
  clearColorStops(): void;
49
- /** Color stops of the gradient */
51
+ /**
52
+ * Color stops of the gradient
53
+ */
50
54
  get colorStops(): GradientColorStop[];
51
- /** Type of the gradient */
55
+ /**
56
+ * @returns Type of the gradient
57
+ */
52
58
  getClassName(): string;
53
- /** Serialize into a json object */
59
+ /**
60
+ * Serialize into a json object
61
+ * @param serializationObject object to serialize into
62
+ */
54
63
  serialize(serializationObject: any): void;
55
- /** Parse from json object */
64
+ /**
65
+ * Parse from json object
66
+ * @param serializationObject object to parse from
67
+ */
56
68
  parse(serializationObject: any): void;
57
69
  }
@@ -17,7 +17,9 @@ export class BaseGradient {
17
17
  /**
18
18
  * If there are any changes or the context changed, regenerate the canvas gradient object. Else,
19
19
  * reuse the existing gradient.
20
- **/
20
+ * @param context the context to create the gradient from
21
+ * @returns the canvas gradient
22
+ */
21
23
  getCanvasGradient(context) {
22
24
  if (this._gradientDirty || this._context !== context) {
23
25
  this._context = context;
@@ -51,20 +53,30 @@ export class BaseGradient {
51
53
  this._colorStops = [];
52
54
  this._gradientDirty = true;
53
55
  }
54
- /** Color stops of the gradient */
56
+ /**
57
+ * Color stops of the gradient
58
+ */
55
59
  get colorStops() {
56
60
  return this._colorStops;
57
61
  }
58
- /** Type of the gradient */
62
+ /**
63
+ * @returns Type of the gradient
64
+ */
59
65
  getClassName() {
60
66
  return "BaseGradient";
61
67
  }
62
- /** Serialize into a json object */
68
+ /**
69
+ * Serialize into a json object
70
+ * @param serializationObject object to serialize into
71
+ */
63
72
  serialize(serializationObject) {
64
73
  serializationObject.colorStops = this._colorStops;
65
74
  serializationObject.className = this.getClassName();
66
75
  }
67
- /** Parse from json object */
76
+ /**
77
+ * Parse from json object
78
+ * @param serializationObject object to parse from
79
+ */
68
80
  parse(serializationObject) {
69
81
  this._colorStops = serializationObject.colorStops;
70
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseGradient.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/2D/controls/gradient/BaseGradient.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH;;GAEG;AACH,MAAM,OAAgB,YAAY;IAAlC;QACY,gBAAW,GAAwB,EAAE,CAAC;QAItC,mBAAc,GAAY,IAAI,CAAC;IA2E3C,CAAC;IAnEW,8BAA8B;QAClC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE;YACjC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;SAC9D;IACL,CAAC;IAED;;;QAGI;IACG,iBAAiB,CAAC,OAAgC;QACrD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,EAAE;YAClD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YACxB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAC3D,IAAI,CAAC,8BAA8B,EAAE,CAAC;YACtC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;SAC/B;QACD,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,MAAc,EAAE,KAAa;QAC7C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,MAAc;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;QACvF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,eAAe;QAClB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,kCAAkC;IAClC,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,2BAA2B;IACpB,YAAY;QACf,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,mCAAmC;IAC5B,SAAS,CAAC,mBAAwB;QACrC,mBAAmB,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QAClD,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IACxD,CAAC;IAED,6BAA6B;IACtB,KAAK,CAAC,mBAAwB;QACjC,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC,UAAU,CAAC;IACtD,CAAC;CACJ","sourcesContent":["/*\r\n * Base Gradient class. Should not be used directly.\r\n */\r\n\r\nimport type { ICanvasGradient, ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Type that represents a single stop on the gradient.\r\n */\r\nexport type GradientColorStop = {\r\n /**\r\n * Offset from the start where the color will be applied.\r\n */\r\n offset: number;\r\n /**\r\n * Color to be applied.\r\n */\r\n color: string;\r\n};\r\n\r\n/**\r\n * Class that serves as a base for all the gradients created from context.\r\n */\r\nexport abstract class BaseGradient {\r\n private _colorStops: GradientColorStop[] = [];\r\n\r\n private _canvasGradient: CanvasGradient;\r\n private _context: ICanvasRenderingContext;\r\n private _gradientDirty: boolean = true;\r\n\r\n /**\r\n * Overwritten by child classes to create the canvas gradient.\r\n * @param context\r\n */\r\n protected abstract _createCanvasGradient(context: ICanvasRenderingContext): ICanvasGradient;\r\n\r\n private _addColorStopsToCanvasGradient() {\r\n for (const stop of this._colorStops) {\r\n this._canvasGradient.addColorStop(stop.offset, stop.color);\r\n }\r\n }\r\n\r\n /**\r\n * If there are any changes or the context changed, regenerate the canvas gradient object. Else,\r\n * reuse the existing gradient.\r\n **/\r\n public getCanvasGradient(context: ICanvasRenderingContext) {\r\n if (this._gradientDirty || this._context !== context) {\r\n this._context = context;\r\n this._canvasGradient = this._createCanvasGradient(context);\r\n this._addColorStopsToCanvasGradient();\r\n this._gradientDirty = false;\r\n }\r\n return this._canvasGradient;\r\n }\r\n\r\n /**\r\n * Adds a new color stop to the gradient.\r\n * @param offset the offset of the stop on the gradient. Should be between 0 and 1\r\n * @param color the color of the stop\r\n */\r\n public addColorStop(offset: number, color: string) {\r\n this._colorStops.push({ offset, color });\r\n this._gradientDirty = true;\r\n }\r\n\r\n /**\r\n * Removes an existing color stop with the specified offset from the gradient\r\n * @param offset the offset of the stop to be removed\r\n */\r\n public removeColorStop(offset: number) {\r\n this._colorStops = this._colorStops.filter((colorStop) => colorStop.offset !== offset);\r\n this._gradientDirty = true;\r\n }\r\n\r\n /**\r\n * Removes all color stops from the gradient\r\n */\r\n public clearColorStops() {\r\n this._colorStops = [];\r\n this._gradientDirty = true;\r\n }\r\n\r\n /** Color stops of the gradient */\r\n public get colorStops() {\r\n return this._colorStops;\r\n }\r\n\r\n /** Type of the gradient */\r\n public getClassName() {\r\n return \"BaseGradient\";\r\n }\r\n\r\n /** Serialize into a json object */\r\n public serialize(serializationObject: any) {\r\n serializationObject.colorStops = this._colorStops;\r\n serializationObject.className = this.getClassName();\r\n }\r\n\r\n /** Parse from json object */\r\n public parse(serializationObject: any) {\r\n this._colorStops = serializationObject.colorStops;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"BaseGradient.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/2D/controls/gradient/BaseGradient.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH;;GAEG;AACH,MAAM,OAAgB,YAAY;IAAlC;QACY,gBAAW,GAAwB,EAAE,CAAC;QAItC,mBAAc,GAAY,IAAI,CAAC;IAuF3C,CAAC;IA/EW,8BAA8B;QAClC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE;YACjC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;SAC9D;IACL,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,OAAgC;QACrD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,EAAE;YAClD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YACxB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAC3D,IAAI,CAAC,8BAA8B,EAAE,CAAC;YACtC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;SAC/B;QACD,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,MAAc,EAAE,KAAa;QAC7C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,MAAc;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;QACvF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,eAAe;QAClB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,YAAY;QACf,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,mBAAwB;QACrC,mBAAmB,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QAClD,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAwB;QACjC,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC,UAAU,CAAC;IACtD,CAAC;CACJ","sourcesContent":["/*\r\n * Base Gradient class. Should not be used directly.\r\n */\r\n\r\nimport type { ICanvasGradient, ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Type that represents a single stop on the gradient.\r\n */\r\nexport type GradientColorStop = {\r\n /**\r\n * Offset from the start where the color will be applied.\r\n */\r\n offset: number;\r\n /**\r\n * Color to be applied.\r\n */\r\n color: string;\r\n};\r\n\r\n/**\r\n * Class that serves as a base for all the gradients created from context.\r\n */\r\nexport abstract class BaseGradient {\r\n private _colorStops: GradientColorStop[] = [];\r\n\r\n private _canvasGradient: CanvasGradient;\r\n private _context: ICanvasRenderingContext;\r\n private _gradientDirty: boolean = true;\r\n\r\n /**\r\n * Overwritten by child classes to create the canvas gradient.\r\n * @param context\r\n */\r\n protected abstract _createCanvasGradient(context: ICanvasRenderingContext): ICanvasGradient;\r\n\r\n private _addColorStopsToCanvasGradient() {\r\n for (const stop of this._colorStops) {\r\n this._canvasGradient.addColorStop(stop.offset, stop.color);\r\n }\r\n }\r\n\r\n /**\r\n * If there are any changes or the context changed, regenerate the canvas gradient object. Else,\r\n * reuse the existing gradient.\r\n * @param context the context to create the gradient from\r\n * @returns the canvas gradient\r\n */\r\n public getCanvasGradient(context: ICanvasRenderingContext) {\r\n if (this._gradientDirty || this._context !== context) {\r\n this._context = context;\r\n this._canvasGradient = this._createCanvasGradient(context);\r\n this._addColorStopsToCanvasGradient();\r\n this._gradientDirty = false;\r\n }\r\n return this._canvasGradient;\r\n }\r\n\r\n /**\r\n * Adds a new color stop to the gradient.\r\n * @param offset the offset of the stop on the gradient. Should be between 0 and 1\r\n * @param color the color of the stop\r\n */\r\n public addColorStop(offset: number, color: string) {\r\n this._colorStops.push({ offset, color });\r\n this._gradientDirty = true;\r\n }\r\n\r\n /**\r\n * Removes an existing color stop with the specified offset from the gradient\r\n * @param offset the offset of the stop to be removed\r\n */\r\n public removeColorStop(offset: number) {\r\n this._colorStops = this._colorStops.filter((colorStop) => colorStop.offset !== offset);\r\n this._gradientDirty = true;\r\n }\r\n\r\n /**\r\n * Removes all color stops from the gradient\r\n */\r\n public clearColorStops() {\r\n this._colorStops = [];\r\n this._gradientDirty = true;\r\n }\r\n\r\n /**\r\n * Color stops of the gradient\r\n */\r\n public get colorStops() {\r\n return this._colorStops;\r\n }\r\n\r\n /**\r\n * @returns Type of the gradient\r\n */\r\n public getClassName() {\r\n return \"BaseGradient\";\r\n }\r\n\r\n /**\r\n * Serialize into a json object\r\n * @param serializationObject object to serialize into\r\n */\r\n public serialize(serializationObject: any) {\r\n serializationObject.colorStops = this._colorStops;\r\n serializationObject.className = this.getClassName();\r\n }\r\n\r\n /**\r\n * Parse from json object\r\n * @param serializationObject object to parse from\r\n */\r\n public parse(serializationObject: any) {\r\n this._colorStops = serializationObject.colorStops;\r\n }\r\n}\r\n"]}
@@ -140,8 +140,9 @@ export declare class Grid extends Container {
140
140
  /**
141
141
  * Serializes the current control
142
142
  * @param serializationObject defined the JSON serialized object
143
+ * @param force force serialization even if isSerializable === false
143
144
  */
144
- serialize(serializationObject: any): void;
145
+ serialize(serializationObject: any, force: boolean): void;
145
146
  /**
146
147
  * @internal
147
148
  */
@@ -459,9 +459,13 @@ export class Grid extends Container {
459
459
  /**
460
460
  * Serializes the current control
461
461
  * @param serializationObject defined the JSON serialized object
462
+ * @param force force serialization even if isSerializable === false
462
463
  */
463
- serialize(serializationObject) {
464
- super.serialize(serializationObject);
464
+ serialize(serializationObject, force) {
465
+ super.serialize(serializationObject, force);
466
+ if (!this.isSerializable && !force) {
467
+ return;
468
+ }
465
469
  serializationObject.columnCount = this.columnCount;
466
470
  serializationObject.rowCount = this.rowCount;
467
471
  serializationObject.columns = [];
@@ -1 +1 @@
1
- {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/grid.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAIpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAEjD;;GAEG;AACH,MAAM,OAAO,IAAK,SAAQ,SAAS;IAQ/B;;;OAGG;IACH,IAAW,WAAW,CAAC,KAAc;QACjC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,gEAAgE;QAChE,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,KAAK,CAAC;SACxC;IACL,CAAC;IAGD,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,IAAW,YAAY,CAAC,KAAc;QAClC,IAAI,CAAC,aAAa,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CAAC,KAAK,CAAC;YAChD,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAC3C,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SAC9D;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACtC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1C,IAAI,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACtE,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE;gBAClB,SAAS,GAAG,CAAC,CAAC;aACjB;YACD,IAAI,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC1E,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE;gBACrB,YAAY,GAAG,CAAC,CAAC;aACpB;YACD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;SACzD;IACL,CAAC;CACJ;AA/jBG;IADC,SAAS,EAAE;uCAGX;AA8jBL,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\n\r\nimport { Container } from \"./container\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport type { Measure } from \"../measure\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\n\r\n/**\r\n * Class used to create a 2D grid container\r\n */\r\nexport class Grid extends Container {\r\n private _rowDefinitions = new Array<ValueAndUnit>();\r\n private _rowDefinitionObservers: Observer<void>[] = [];\r\n private _columnDefinitions = new Array<ValueAndUnit>();\r\n private _columnDefinitionObservers: Observer<void>[] = [];\r\n private _cells: { [key: string]: Container } = {};\r\n private _childControls = new Array<Control>();\r\n\r\n /**\r\n * Sets/Gets a boolean indicating that control content must be clipped\r\n * Please note that not clipping content may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children\r\n */\r\n public set clipContent(value: boolean) {\r\n this._clipContent = value;\r\n\r\n // This value has to be replicated on all of the container cells\r\n for (const key in this._cells) {\r\n this._cells[key].clipContent = value;\r\n }\r\n }\r\n\r\n @serialize()\r\n public get clipContent(): boolean {\r\n return this._clipContent;\r\n }\r\n\r\n /**\r\n * Sets/Gets a boolean indicating if the children are clipped to the current control bounds.\r\n * 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\r\n */\r\n public set clipChildren(value: boolean) {\r\n this._clipChildren = value;\r\n\r\n // This value has to be replicated on all of the container cells\r\n for (const key in this._cells) {\r\n this._cells[key].clipChildren = value;\r\n }\r\n }\r\n\r\n public get clipChildren(): boolean {\r\n return this._clipChildren;\r\n }\r\n\r\n /**\r\n * Gets the number of columns\r\n */\r\n public get columnCount(): number {\r\n return this._columnDefinitions.length;\r\n }\r\n\r\n /**\r\n * Gets the number of rows\r\n */\r\n public get rowCount(): number {\r\n return this._rowDefinitions.length;\r\n }\r\n\r\n /** Gets the list of children */\r\n public get children(): Control[] {\r\n return this._childControls;\r\n }\r\n\r\n /** Gets the list of cells (e.g. the containers) */\r\n public get cells(): { [key: string]: Container } {\r\n return this._cells;\r\n }\r\n\r\n /**\r\n * Gets the definition of a specific row\r\n * @param index defines the index of the row\r\n * @returns the row definition\r\n */\r\n public getRowDefinition(index: number): Nullable<ValueAndUnit> {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return null;\r\n }\r\n\r\n return this._rowDefinitions[index];\r\n }\r\n\r\n /**\r\n * Gets the definition of a specific column\r\n * @param index defines the index of the column\r\n * @returns the column definition\r\n */\r\n public getColumnDefinition(index: number): Nullable<ValueAndUnit> {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return null;\r\n }\r\n\r\n return this._columnDefinitions[index];\r\n }\r\n\r\n /**\r\n * Adds a new row to the grid\r\n * @param height defines the height of the row (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the height is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n public addRowDefinition(height: number, isPixel = false): Grid {\r\n this._rowDefinitions.push(new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));\r\n this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount - 1].onChangedObservable.add(() => this._markAsDirty())!);\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a new column to the grid\r\n * @param width defines the width of the column (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the width is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n public addColumnDefinition(width: number, isPixel = false): Grid {\r\n this._columnDefinitions.push(new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));\r\n this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount - 1].onChangedObservable.add(() => this._markAsDirty())!);\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Update a row definition\r\n * @param index defines the index of the row to update\r\n * @param height defines the height of the row (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the weight is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n public setRowDefinition(index: number, height: number, isPixel = false): Grid {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return this;\r\n }\r\n\r\n const current = this._rowDefinitions[index];\r\n if (current && current.isPixel === isPixel && current.value === height) {\r\n return this;\r\n }\r\n\r\n this._rowDefinitions[index].onChangedObservable.remove(this._rowDefinitionObservers[index]);\r\n this._rowDefinitions[index] = new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);\r\n this._rowDefinitionObservers[index] = this._rowDefinitions[index].onChangedObservable.add(() => this._markAsDirty())!;\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Update a column definition\r\n * @param index defines the index of the column to update\r\n * @param width defines the width of the column (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the width is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n public setColumnDefinition(index: number, width: number, isPixel = false): Grid {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return this;\r\n }\r\n\r\n const current = this._columnDefinitions[index];\r\n if (current && current.isPixel === isPixel && current.value === width) {\r\n return this;\r\n }\r\n\r\n this._columnDefinitions[index].onChangedObservable.remove(this._columnDefinitionObservers[index]);\r\n this._columnDefinitions[index] = new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);\r\n this._columnDefinitionObservers[index] = this._columnDefinitions[index].onChangedObservable.add(() => this._markAsDirty())!;\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the list of children stored in a specific cell\r\n * @param row defines the row to check\r\n * @param column defines the column to check\r\n * @returns the list of controls\r\n */\r\n public getChildrenAt(row: number, column: number): Nullable<Array<Control>> {\r\n const cell = this._cells[`${row}:${column}`];\r\n\r\n if (!cell) {\r\n return null;\r\n }\r\n\r\n return cell.children;\r\n }\r\n\r\n /**\r\n * Gets a string representing the child cell info (row x column)\r\n * @param child defines the control to get info from\r\n * @returns a string containing the child cell info (row x column)\r\n */\r\n public getChildCellInfo(child: Control): string {\r\n return child._tag;\r\n }\r\n\r\n private _removeCell(cell: Container, key: string) {\r\n if (!cell) {\r\n return;\r\n }\r\n\r\n super.removeControl(cell);\r\n\r\n for (const control of cell.children) {\r\n const childIndex = this._childControls.indexOf(control);\r\n\r\n if (childIndex !== -1) {\r\n this._childControls.splice(childIndex, 1);\r\n }\r\n }\r\n\r\n delete this._cells[key];\r\n }\r\n\r\n private _offsetCell(previousKey: string, key: string) {\r\n if (!this._cells[key]) {\r\n return;\r\n }\r\n\r\n this._cells[previousKey] = this._cells[key];\r\n\r\n for (const control of this._cells[previousKey].children) {\r\n control._tag = previousKey;\r\n }\r\n\r\n delete this._cells[key];\r\n }\r\n\r\n /**\r\n * Remove a column definition at specified index\r\n * @param index defines the index of the column to remove\r\n * @returns the current grid\r\n */\r\n public removeColumnDefinition(index: number): Grid {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return this;\r\n }\r\n\r\n for (let x = 0; x < this._rowDefinitions.length; x++) {\r\n const key = `${x}:${index}`;\r\n const cell = this._cells[key];\r\n\r\n this._removeCell(cell, key);\r\n }\r\n\r\n for (let x = 0; x < this._rowDefinitions.length; x++) {\r\n for (let y = index + 1; y < this._columnDefinitions.length; y++) {\r\n const previousKey = `${x}:${y - 1}`;\r\n const key = `${x}:${y}`;\r\n\r\n this._offsetCell(previousKey, key);\r\n }\r\n }\r\n\r\n this._columnDefinitions[index].onChangedObservable.remove(this._columnDefinitionObservers[index]);\r\n this._columnDefinitions.splice(index, 1);\r\n this._columnDefinitionObservers.splice(index, 1);\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove a row definition at specified index\r\n * @param index defines the index of the row to remove\r\n * @returns the current grid\r\n */\r\n public removeRowDefinition(index: number): Grid {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return this;\r\n }\r\n\r\n for (let y = 0; y < this._columnDefinitions.length; y++) {\r\n const key = `${index}:${y}`;\r\n const cell = this._cells[key];\r\n\r\n this._removeCell(cell, key);\r\n }\r\n\r\n for (let y = 0; y < this._columnDefinitions.length; y++) {\r\n for (let x = index + 1; x < this._rowDefinitions.length; x++) {\r\n const previousKey = `${x - 1}:${y}`;\r\n const key = `${x}:${y}`;\r\n\r\n this._offsetCell(previousKey, key);\r\n }\r\n }\r\n\r\n this._rowDefinitions[index].onChangedObservable.remove(this._rowDefinitionObservers[index]);\r\n this._rowDefinitions.splice(index, 1);\r\n this._rowDefinitionObservers.splice(index, 1);\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a new control to the current grid\r\n * @param control defines the control to add\r\n * @param row defines the row where to add the control (0 by default)\r\n * @param column defines the column where to add the control (0 by default)\r\n * @returns the current grid\r\n */\r\n public addControl(control: Control, row: number = 0, column: number = 0): Grid {\r\n if (this._rowDefinitions.length === 0) {\r\n // Add default row definition\r\n this.addRowDefinition(1, false);\r\n }\r\n\r\n if (this._columnDefinitions.length === 0) {\r\n // Add default column definition\r\n this.addColumnDefinition(1, false);\r\n }\r\n\r\n if (this._childControls.indexOf(control) !== -1) {\r\n Tools.Warn(`Control (Name:${control.name}, UniqueId:${control.uniqueId}) is already associated with this grid. You must remove it before reattaching it`);\r\n return this;\r\n }\r\n\r\n const x = Math.min(row, this._rowDefinitions.length - 1);\r\n const y = Math.min(column, this._columnDefinitions.length - 1);\r\n const key = `${x}:${y}`;\r\n let goodContainer = this._cells[key];\r\n\r\n if (!goodContainer) {\r\n goodContainer = new Container(key);\r\n this._cells[key] = goodContainer;\r\n goodContainer.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n goodContainer.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n goodContainer.clipContent = this.clipContent;\r\n goodContainer.clipChildren = this.clipChildren;\r\n super.addControl(goodContainer);\r\n }\r\n\r\n goodContainer.addControl(control);\r\n this._childControls.push(control);\r\n control._tag = key;\r\n control.parent = this;\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n public removeControl(control: Control): Container {\r\n const index = this._childControls.indexOf(control);\r\n\r\n if (index !== -1) {\r\n this._childControls.splice(index, 1);\r\n }\r\n\r\n const cell = this._cells[control._tag];\r\n\r\n if (cell) {\r\n cell.removeControl(control);\r\n control._tag = null;\r\n }\r\n\r\n this._markAsDirty();\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a new Grid\r\n * @param name defines control name\r\n */\r\n constructor(public name?: string) {\r\n super(name);\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Grid\";\r\n }\r\n\r\n protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void) {\r\n const widths = [];\r\n const heights = [];\r\n const lefts = [];\r\n const tops = [];\r\n\r\n let availableWidth = this._currentMeasure.width;\r\n let globalWidthPercentage = 0;\r\n let availableHeight = this._currentMeasure.height;\r\n let globalHeightPercentage = 0;\r\n\r\n // Heights\r\n let index = 0;\r\n for (const rowDefinition of this._rowDefinitions) {\r\n if (rowDefinition.isPixel) {\r\n const height = rowDefinition.getValue(this._host);\r\n availableHeight -= height;\r\n heights[index] = height;\r\n } else {\r\n globalHeightPercentage += rowDefinition.value;\r\n }\r\n index++;\r\n }\r\n\r\n let top = 0;\r\n index = 0;\r\n for (const rowDefinition of this._rowDefinitions) {\r\n tops.push(top);\r\n\r\n if (!rowDefinition.isPixel) {\r\n const height = Math.round((rowDefinition.value / globalHeightPercentage) * availableHeight);\r\n top += height;\r\n heights[index] = height;\r\n } else {\r\n top += rowDefinition.getValue(this._host);\r\n }\r\n index++;\r\n }\r\n\r\n // Widths\r\n index = 0;\r\n for (const columnDefinition of this._columnDefinitions) {\r\n if (columnDefinition.isPixel) {\r\n const width = columnDefinition.getValue(this._host);\r\n availableWidth -= width;\r\n widths[index] = width;\r\n } else {\r\n globalWidthPercentage += columnDefinition.value;\r\n }\r\n index++;\r\n }\r\n\r\n let left = 0;\r\n index = 0;\r\n for (const columnDefinition of this._columnDefinitions) {\r\n lefts.push(left);\r\n if (!columnDefinition.isPixel) {\r\n const width = Math.round((columnDefinition.value / globalWidthPercentage) * availableWidth);\r\n left += width;\r\n widths[index] = width;\r\n } else {\r\n left += columnDefinition.getValue(this._host);\r\n }\r\n index++;\r\n }\r\n\r\n definitionCallback(lefts, tops, widths, heights);\r\n }\r\n\r\n protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n this._getGridDefinitions((lefts: number[], tops: number[], widths: number[], heights: number[]) => {\r\n // Setting child sizes\r\n for (const key in this._cells) {\r\n if (!Object.prototype.hasOwnProperty.call(this._cells, key)) {\r\n continue;\r\n }\r\n const split = key.split(\":\");\r\n const x = parseInt(split[0]);\r\n const y = parseInt(split[1]);\r\n const cell = this._cells[key];\r\n\r\n cell.leftInPixels = lefts[y];\r\n cell.topInPixels = tops[x];\r\n cell.widthInPixels = widths[y];\r\n cell.heightInPixels = heights[x];\r\n cell._left.ignoreAdaptiveScaling = true;\r\n cell._top.ignoreAdaptiveScaling = true;\r\n cell._width.ignoreAdaptiveScaling = true;\r\n cell._height.ignoreAdaptiveScaling = true;\r\n }\r\n });\r\n\r\n super._additionalProcessing(parentMeasure, context);\r\n }\r\n\r\n public _flagDescendantsAsMatrixDirty(): void {\r\n for (const key in this._cells) {\r\n if (!Object.prototype.hasOwnProperty.call(this._cells, key)) {\r\n continue;\r\n }\r\n\r\n const child = this._cells[key];\r\n child._markMatrixAsDirty();\r\n }\r\n }\r\n\r\n public _renderHighlightSpecific(context: ICanvasRenderingContext): void {\r\n super._renderHighlightSpecific(context);\r\n\r\n this._getGridDefinitions((lefts: number[], tops: number[], widths: number[], heights: number[]) => {\r\n // Columns\r\n for (let index = 0; index < lefts.length; index++) {\r\n const left = this._currentMeasure.left + lefts[index] + widths[index];\r\n context.beginPath();\r\n context.moveTo(left, this._currentMeasure.top);\r\n context.lineTo(left, this._currentMeasure.top + this._currentMeasure.height);\r\n context.stroke();\r\n }\r\n\r\n // Rows\r\n for (let index = 0; index < tops.length; index++) {\r\n const top = this._currentMeasure.top + tops[index] + heights[index];\r\n context.beginPath();\r\n context.moveTo(this._currentMeasure.left, top);\r\n context.lineTo(this._currentMeasure.left + this._currentMeasure.width, top);\r\n context.stroke();\r\n }\r\n });\r\n\r\n context.restore();\r\n }\r\n\r\n /** Releases associated resources */\r\n public dispose() {\r\n super.dispose();\r\n\r\n for (const control of this._childControls) {\r\n control.dispose();\r\n }\r\n for (let index = 0; index < this._rowDefinitions.length; index++) {\r\n this._rowDefinitions[index].onChangedObservable.remove(this._rowDefinitionObservers[index]);\r\n }\r\n for (let index = 0; index < this._columnDefinitions.length; index++) {\r\n this._columnDefinitions[index].onChangedObservable.remove(this._columnDefinitionObservers[index]);\r\n }\r\n this._rowDefinitionObservers.length = 0;\r\n this._rowDefinitions.length = 0;\r\n this._columnDefinitionObservers.length = 0;\r\n this._columnDefinitions.length = 0;\r\n this._cells = {};\r\n this._childControls.length = 0;\r\n }\r\n\r\n /**\r\n * Serializes the current control\r\n * @param serializationObject defined the JSON serialized object\r\n */\r\n public serialize(serializationObject: any) {\r\n super.serialize(serializationObject);\r\n serializationObject.columnCount = this.columnCount;\r\n serializationObject.rowCount = this.rowCount;\r\n serializationObject.columns = [];\r\n serializationObject.rows = [];\r\n serializationObject.tags = [];\r\n for (let i = 0; i < this.columnCount; ++i) {\r\n const cd = this.getColumnDefinition(i);\r\n const childSerializationObject = { value: cd?.getValue(this.host), unit: cd?.unit };\r\n serializationObject.columns.push(childSerializationObject);\r\n }\r\n for (let i = 0; i < this.rowCount; ++i) {\r\n const rd = this.getRowDefinition(i);\r\n const childSerializationObject = { value: rd?.getValue(this.host), unit: rd?.unit };\r\n serializationObject.rows.push(childSerializationObject);\r\n }\r\n this.children.forEach((child) => {\r\n serializationObject.tags.push(child._tag);\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n const children: Control[] = [];\r\n this.children.forEach((child) => {\r\n children.push(child);\r\n });\r\n this.removeRowDefinition(0);\r\n this.removeColumnDefinition(0);\r\n for (let i = 0; i < serializedObject.columnCount; ++i) {\r\n const columnValue = serializedObject.columns[i].value;\r\n const unit = serializedObject.columns[i].unit;\r\n this.addColumnDefinition(columnValue, unit === 1 ? true : false);\r\n }\r\n for (let i = 0; i < serializedObject.rowCount; ++i) {\r\n const rowValue = serializedObject.rows[i].value;\r\n const unit = serializedObject.rows[i].unit;\r\n this.addRowDefinition(rowValue, unit === 1 ? true : false);\r\n }\r\n\r\n for (let i = 0; i < children.length; ++i) {\r\n const cellInfo = serializedObject.tags[i];\r\n let rowNumber = parseInt(cellInfo.substring(0, cellInfo.search(\":\")));\r\n if (isNaN(rowNumber)) {\r\n rowNumber = 0;\r\n }\r\n let columnNumber = parseInt(cellInfo.substring(cellInfo.search(\":\") + 1));\r\n if (isNaN(columnNumber)) {\r\n columnNumber = 0;\r\n }\r\n this.addControl(children[i], rowNumber, columnNumber);\r\n }\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Grid\", Grid);\r\n"]}
1
+ {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/grid.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAIpD,OAAO,EAAE,SAAS,EAAE,2CAA6B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AG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC1E,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE;gBACrB,YAAY,GAAG,CAAC,CAAC;aACpB;YACD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;SACzD;IACL,CAAC;CACJ;AAnkBG;IADC,SAAS,EAAE;uCAGX;AAkkBL,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\n\r\nimport { Container } from \"./container\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport type { Measure } from \"../measure\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\n\r\n/**\r\n * Class used to create a 2D grid container\r\n */\r\nexport class Grid extends Container {\r\n private _rowDefinitions = new Array<ValueAndUnit>();\r\n private _rowDefinitionObservers: Observer<void>[] = [];\r\n private _columnDefinitions = new Array<ValueAndUnit>();\r\n private _columnDefinitionObservers: Observer<void>[] = [];\r\n private _cells: { [key: string]: Container } = {};\r\n private _childControls = new Array<Control>();\r\n\r\n /**\r\n * Sets/Gets a boolean indicating that control content must be clipped\r\n * Please note that not clipping content may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children\r\n */\r\n public set clipContent(value: boolean) {\r\n this._clipContent = value;\r\n\r\n // This value has to be replicated on all of the container cells\r\n for (const key in this._cells) {\r\n this._cells[key].clipContent = value;\r\n }\r\n }\r\n\r\n @serialize()\r\n public get clipContent(): boolean {\r\n return this._clipContent;\r\n }\r\n\r\n /**\r\n * Sets/Gets a boolean indicating if the children are clipped to the current control bounds.\r\n * 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\r\n */\r\n public set clipChildren(value: boolean) {\r\n this._clipChildren = value;\r\n\r\n // This value has to be replicated on all of the container cells\r\n for (const key in this._cells) {\r\n this._cells[key].clipChildren = value;\r\n }\r\n }\r\n\r\n public get clipChildren(): boolean {\r\n return this._clipChildren;\r\n }\r\n\r\n /**\r\n * Gets the number of columns\r\n */\r\n public get columnCount(): number {\r\n return this._columnDefinitions.length;\r\n }\r\n\r\n /**\r\n * Gets the number of rows\r\n */\r\n public get rowCount(): number {\r\n return this._rowDefinitions.length;\r\n }\r\n\r\n /** Gets the list of children */\r\n public get children(): Control[] {\r\n return this._childControls;\r\n }\r\n\r\n /** Gets the list of cells (e.g. the containers) */\r\n public get cells(): { [key: string]: Container } {\r\n return this._cells;\r\n }\r\n\r\n /**\r\n * Gets the definition of a specific row\r\n * @param index defines the index of the row\r\n * @returns the row definition\r\n */\r\n public getRowDefinition(index: number): Nullable<ValueAndUnit> {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return null;\r\n }\r\n\r\n return this._rowDefinitions[index];\r\n }\r\n\r\n /**\r\n * Gets the definition of a specific column\r\n * @param index defines the index of the column\r\n * @returns the column definition\r\n */\r\n public getColumnDefinition(index: number): Nullable<ValueAndUnit> {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return null;\r\n }\r\n\r\n return this._columnDefinitions[index];\r\n }\r\n\r\n /**\r\n * Adds a new row to the grid\r\n * @param height defines the height of the row (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the height is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n public addRowDefinition(height: number, isPixel = false): Grid {\r\n this._rowDefinitions.push(new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));\r\n this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount - 1].onChangedObservable.add(() => this._markAsDirty())!);\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a new column to the grid\r\n * @param width defines the width of the column (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the width is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n public addColumnDefinition(width: number, isPixel = false): Grid {\r\n this._columnDefinitions.push(new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));\r\n this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount - 1].onChangedObservable.add(() => this._markAsDirty())!);\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Update a row definition\r\n * @param index defines the index of the row to update\r\n * @param height defines the height of the row (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the weight is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n public setRowDefinition(index: number, height: number, isPixel = false): Grid {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return this;\r\n }\r\n\r\n const current = this._rowDefinitions[index];\r\n if (current && current.isPixel === isPixel && current.value === height) {\r\n return this;\r\n }\r\n\r\n this._rowDefinitions[index].onChangedObservable.remove(this._rowDefinitionObservers[index]);\r\n this._rowDefinitions[index] = new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);\r\n this._rowDefinitionObservers[index] = this._rowDefinitions[index].onChangedObservable.add(() => this._markAsDirty())!;\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Update a column definition\r\n * @param index defines the index of the column to update\r\n * @param width defines the width of the column (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the width is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n public setColumnDefinition(index: number, width: number, isPixel = false): Grid {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return this;\r\n }\r\n\r\n const current = this._columnDefinitions[index];\r\n if (current && current.isPixel === isPixel && current.value === width) {\r\n return this;\r\n }\r\n\r\n this._columnDefinitions[index].onChangedObservable.remove(this._columnDefinitionObservers[index]);\r\n this._columnDefinitions[index] = new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);\r\n this._columnDefinitionObservers[index] = this._columnDefinitions[index].onChangedObservable.add(() => this._markAsDirty())!;\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the list of children stored in a specific cell\r\n * @param row defines the row to check\r\n * @param column defines the column to check\r\n * @returns the list of controls\r\n */\r\n public getChildrenAt(row: number, column: number): Nullable<Array<Control>> {\r\n const cell = this._cells[`${row}:${column}`];\r\n\r\n if (!cell) {\r\n return null;\r\n }\r\n\r\n return cell.children;\r\n }\r\n\r\n /**\r\n * Gets a string representing the child cell info (row x column)\r\n * @param child defines the control to get info from\r\n * @returns a string containing the child cell info (row x column)\r\n */\r\n public getChildCellInfo(child: Control): string {\r\n return child._tag;\r\n }\r\n\r\n private _removeCell(cell: Container, key: string) {\r\n if (!cell) {\r\n return;\r\n }\r\n\r\n super.removeControl(cell);\r\n\r\n for (const control of cell.children) {\r\n const childIndex = this._childControls.indexOf(control);\r\n\r\n if (childIndex !== -1) {\r\n this._childControls.splice(childIndex, 1);\r\n }\r\n }\r\n\r\n delete this._cells[key];\r\n }\r\n\r\n private _offsetCell(previousKey: string, key: string) {\r\n if (!this._cells[key]) {\r\n return;\r\n }\r\n\r\n this._cells[previousKey] = this._cells[key];\r\n\r\n for (const control of this._cells[previousKey].children) {\r\n control._tag = previousKey;\r\n }\r\n\r\n delete this._cells[key];\r\n }\r\n\r\n /**\r\n * Remove a column definition at specified index\r\n * @param index defines the index of the column to remove\r\n * @returns the current grid\r\n */\r\n public removeColumnDefinition(index: number): Grid {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return this;\r\n }\r\n\r\n for (let x = 0; x < this._rowDefinitions.length; x++) {\r\n const key = `${x}:${index}`;\r\n const cell = this._cells[key];\r\n\r\n this._removeCell(cell, key);\r\n }\r\n\r\n for (let x = 0; x < this._rowDefinitions.length; x++) {\r\n for (let y = index + 1; y < this._columnDefinitions.length; y++) {\r\n const previousKey = `${x}:${y - 1}`;\r\n const key = `${x}:${y}`;\r\n\r\n this._offsetCell(previousKey, key);\r\n }\r\n }\r\n\r\n this._columnDefinitions[index].onChangedObservable.remove(this._columnDefinitionObservers[index]);\r\n this._columnDefinitions.splice(index, 1);\r\n this._columnDefinitionObservers.splice(index, 1);\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove a row definition at specified index\r\n * @param index defines the index of the row to remove\r\n * @returns the current grid\r\n */\r\n public removeRowDefinition(index: number): Grid {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return this;\r\n }\r\n\r\n for (let y = 0; y < this._columnDefinitions.length; y++) {\r\n const key = `${index}:${y}`;\r\n const cell = this._cells[key];\r\n\r\n this._removeCell(cell, key);\r\n }\r\n\r\n for (let y = 0; y < this._columnDefinitions.length; y++) {\r\n for (let x = index + 1; x < this._rowDefinitions.length; x++) {\r\n const previousKey = `${x - 1}:${y}`;\r\n const key = `${x}:${y}`;\r\n\r\n this._offsetCell(previousKey, key);\r\n }\r\n }\r\n\r\n this._rowDefinitions[index].onChangedObservable.remove(this._rowDefinitionObservers[index]);\r\n this._rowDefinitions.splice(index, 1);\r\n this._rowDefinitionObservers.splice(index, 1);\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a new control to the current grid\r\n * @param control defines the control to add\r\n * @param row defines the row where to add the control (0 by default)\r\n * @param column defines the column where to add the control (0 by default)\r\n * @returns the current grid\r\n */\r\n public addControl(control: Control, row: number = 0, column: number = 0): Grid {\r\n if (this._rowDefinitions.length === 0) {\r\n // Add default row definition\r\n this.addRowDefinition(1, false);\r\n }\r\n\r\n if (this._columnDefinitions.length === 0) {\r\n // Add default column definition\r\n this.addColumnDefinition(1, false);\r\n }\r\n\r\n if (this._childControls.indexOf(control) !== -1) {\r\n Tools.Warn(`Control (Name:${control.name}, UniqueId:${control.uniqueId}) is already associated with this grid. You must remove it before reattaching it`);\r\n return this;\r\n }\r\n\r\n const x = Math.min(row, this._rowDefinitions.length - 1);\r\n const y = Math.min(column, this._columnDefinitions.length - 1);\r\n const key = `${x}:${y}`;\r\n let goodContainer = this._cells[key];\r\n\r\n if (!goodContainer) {\r\n goodContainer = new Container(key);\r\n this._cells[key] = goodContainer;\r\n goodContainer.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n goodContainer.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n goodContainer.clipContent = this.clipContent;\r\n goodContainer.clipChildren = this.clipChildren;\r\n super.addControl(goodContainer);\r\n }\r\n\r\n goodContainer.addControl(control);\r\n this._childControls.push(control);\r\n control._tag = key;\r\n control.parent = this;\r\n\r\n this._markAsDirty();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n public removeControl(control: Control): Container {\r\n const index = this._childControls.indexOf(control);\r\n\r\n if (index !== -1) {\r\n this._childControls.splice(index, 1);\r\n }\r\n\r\n const cell = this._cells[control._tag];\r\n\r\n if (cell) {\r\n cell.removeControl(control);\r\n control._tag = null;\r\n }\r\n\r\n this._markAsDirty();\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a new Grid\r\n * @param name defines control name\r\n */\r\n constructor(public name?: string) {\r\n super(name);\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Grid\";\r\n }\r\n\r\n protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void) {\r\n const widths = [];\r\n const heights = [];\r\n const lefts = [];\r\n const tops = [];\r\n\r\n let availableWidth = this._currentMeasure.width;\r\n let globalWidthPercentage = 0;\r\n let availableHeight = this._currentMeasure.height;\r\n let globalHeightPercentage = 0;\r\n\r\n // Heights\r\n let index = 0;\r\n for (const rowDefinition of this._rowDefinitions) {\r\n if (rowDefinition.isPixel) {\r\n const height = rowDefinition.getValue(this._host);\r\n availableHeight -= height;\r\n heights[index] = height;\r\n } else {\r\n globalHeightPercentage += rowDefinition.value;\r\n }\r\n index++;\r\n }\r\n\r\n let top = 0;\r\n index = 0;\r\n for (const rowDefinition of this._rowDefinitions) {\r\n tops.push(top);\r\n\r\n if (!rowDefinition.isPixel) {\r\n const height = Math.round((rowDefinition.value / globalHeightPercentage) * availableHeight);\r\n top += height;\r\n heights[index] = height;\r\n } else {\r\n top += rowDefinition.getValue(this._host);\r\n }\r\n index++;\r\n }\r\n\r\n // Widths\r\n index = 0;\r\n for (const columnDefinition of this._columnDefinitions) {\r\n if (columnDefinition.isPixel) {\r\n const width = columnDefinition.getValue(this._host);\r\n availableWidth -= width;\r\n widths[index] = width;\r\n } else {\r\n globalWidthPercentage += columnDefinition.value;\r\n }\r\n index++;\r\n }\r\n\r\n let left = 0;\r\n index = 0;\r\n for (const columnDefinition of this._columnDefinitions) {\r\n lefts.push(left);\r\n if (!columnDefinition.isPixel) {\r\n const width = Math.round((columnDefinition.value / globalWidthPercentage) * availableWidth);\r\n left += width;\r\n widths[index] = width;\r\n } else {\r\n left += columnDefinition.getValue(this._host);\r\n }\r\n index++;\r\n }\r\n\r\n definitionCallback(lefts, tops, widths, heights);\r\n }\r\n\r\n protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n this._getGridDefinitions((lefts: number[], tops: number[], widths: number[], heights: number[]) => {\r\n // Setting child sizes\r\n for (const key in this._cells) {\r\n if (!Object.prototype.hasOwnProperty.call(this._cells, key)) {\r\n continue;\r\n }\r\n const split = key.split(\":\");\r\n const x = parseInt(split[0]);\r\n const y = parseInt(split[1]);\r\n const cell = this._cells[key];\r\n\r\n cell.leftInPixels = lefts[y];\r\n cell.topInPixels = tops[x];\r\n cell.widthInPixels = widths[y];\r\n cell.heightInPixels = heights[x];\r\n cell._left.ignoreAdaptiveScaling = true;\r\n cell._top.ignoreAdaptiveScaling = true;\r\n cell._width.ignoreAdaptiveScaling = true;\r\n cell._height.ignoreAdaptiveScaling = true;\r\n }\r\n });\r\n\r\n super._additionalProcessing(parentMeasure, context);\r\n }\r\n\r\n public _flagDescendantsAsMatrixDirty(): void {\r\n for (const key in this._cells) {\r\n if (!Object.prototype.hasOwnProperty.call(this._cells, key)) {\r\n continue;\r\n }\r\n\r\n const child = this._cells[key];\r\n child._markMatrixAsDirty();\r\n }\r\n }\r\n\r\n public _renderHighlightSpecific(context: ICanvasRenderingContext): void {\r\n super._renderHighlightSpecific(context);\r\n\r\n this._getGridDefinitions((lefts: number[], tops: number[], widths: number[], heights: number[]) => {\r\n // Columns\r\n for (let index = 0; index < lefts.length; index++) {\r\n const left = this._currentMeasure.left + lefts[index] + widths[index];\r\n context.beginPath();\r\n context.moveTo(left, this._currentMeasure.top);\r\n context.lineTo(left, this._currentMeasure.top + this._currentMeasure.height);\r\n context.stroke();\r\n }\r\n\r\n // Rows\r\n for (let index = 0; index < tops.length; index++) {\r\n const top = this._currentMeasure.top + tops[index] + heights[index];\r\n context.beginPath();\r\n context.moveTo(this._currentMeasure.left, top);\r\n context.lineTo(this._currentMeasure.left + this._currentMeasure.width, top);\r\n context.stroke();\r\n }\r\n });\r\n\r\n context.restore();\r\n }\r\n\r\n /** Releases associated resources */\r\n public dispose() {\r\n super.dispose();\r\n\r\n for (const control of this._childControls) {\r\n control.dispose();\r\n }\r\n for (let index = 0; index < this._rowDefinitions.length; index++) {\r\n this._rowDefinitions[index].onChangedObservable.remove(this._rowDefinitionObservers[index]);\r\n }\r\n for (let index = 0; index < this._columnDefinitions.length; index++) {\r\n this._columnDefinitions[index].onChangedObservable.remove(this._columnDefinitionObservers[index]);\r\n }\r\n this._rowDefinitionObservers.length = 0;\r\n this._rowDefinitions.length = 0;\r\n this._columnDefinitionObservers.length = 0;\r\n this._columnDefinitions.length = 0;\r\n this._cells = {};\r\n this._childControls.length = 0;\r\n }\r\n\r\n /**\r\n * Serializes the current control\r\n * @param serializationObject defined the JSON serialized object\r\n * @param force force serialization even if isSerializable === false\r\n */\r\n public serialize(serializationObject: any, force: boolean) {\r\n super.serialize(serializationObject, force);\r\n if (!this.isSerializable && !force) {\r\n return;\r\n }\r\n serializationObject.columnCount = this.columnCount;\r\n serializationObject.rowCount = this.rowCount;\r\n serializationObject.columns = [];\r\n serializationObject.rows = [];\r\n serializationObject.tags = [];\r\n for (let i = 0; i < this.columnCount; ++i) {\r\n const cd = this.getColumnDefinition(i);\r\n const childSerializationObject = { value: cd?.getValue(this.host), unit: cd?.unit };\r\n serializationObject.columns.push(childSerializationObject);\r\n }\r\n for (let i = 0; i < this.rowCount; ++i) {\r\n const rd = this.getRowDefinition(i);\r\n const childSerializationObject = { value: rd?.getValue(this.host), unit: rd?.unit };\r\n serializationObject.rows.push(childSerializationObject);\r\n }\r\n this.children.forEach((child) => {\r\n serializationObject.tags.push(child._tag);\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n const children: Control[] = [];\r\n this.children.forEach((child) => {\r\n children.push(child);\r\n });\r\n this.removeRowDefinition(0);\r\n this.removeColumnDefinition(0);\r\n for (let i = 0; i < serializedObject.columnCount; ++i) {\r\n const columnValue = serializedObject.columns[i].value;\r\n const unit = serializedObject.columns[i].unit;\r\n this.addColumnDefinition(columnValue, unit === 1 ? true : false);\r\n }\r\n for (let i = 0; i < serializedObject.rowCount; ++i) {\r\n const rowValue = serializedObject.rows[i].value;\r\n const unit = serializedObject.rows[i].unit;\r\n this.addRowDefinition(rowValue, unit === 1 ? true : false);\r\n }\r\n\r\n for (let i = 0; i < children.length; ++i) {\r\n const cellInfo = serializedObject.tags[i];\r\n let rowNumber = parseInt(cellInfo.substring(0, cellInfo.search(\":\")));\r\n if (isNaN(rowNumber)) {\r\n rowNumber = 0;\r\n }\r\n let columnNumber = parseInt(cellInfo.substring(cellInfo.search(\":\") + 1));\r\n if (isNaN(columnNumber)) {\r\n columnNumber = 0;\r\n }\r\n this.addControl(children[i], rowNumber, columnNumber);\r\n }\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Grid\", Grid);\r\n"]}
@@ -163,7 +163,8 @@ export declare class Image extends Control {
163
163
  set source(value: Nullable<string>);
164
164
  /**
165
165
  * Checks for svg document with icon id present
166
- * @param value
166
+ * @param value the source svg
167
+ * @returns the svg
167
168
  */
168
169
  private _svgCheck;
169
170
  /**
@@ -422,7 +422,8 @@ export class Image extends Control {
422
422
  }
423
423
  /**
424
424
  * Checks for svg document with icon id present
425
- * @param value
425
+ * @param value the source svg
426
+ * @returns the svg
426
427
  */
427
428
  _svgCheck(value) {
428
429
  if (window.SVGSVGElement && value.search(/.svg#/gi) !== -1 && value.indexOf("#") === value.lastIndexOf("#")) {