@babylonjs/gui 7.3.1 → 7.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/2D/advancedDynamicTexture.js.map +1 -1
  2. package/2D/controls/button.js.map +1 -1
  3. package/2D/controls/checkbox.js.map +1 -1
  4. package/2D/controls/colorpicker.js.map +1 -1
  5. package/2D/controls/container.js.map +1 -1
  6. package/2D/controls/control.d.ts +2 -1
  7. package/2D/controls/control.js +5 -2
  8. package/2D/controls/control.js.map +1 -1
  9. package/2D/controls/displayGrid.js.map +1 -1
  10. package/2D/controls/ellipse.js.map +1 -1
  11. package/2D/controls/focusableButton.js.map +1 -1
  12. package/2D/controls/gradient/LinearGradient.js.map +1 -1
  13. package/2D/controls/gradient/RadialGradient.js.map +1 -1
  14. package/2D/controls/grid.js.map +1 -1
  15. package/2D/controls/image.js.map +1 -1
  16. package/2D/controls/inputPassword.js.map +1 -1
  17. package/2D/controls/inputText.js.map +1 -1
  18. package/2D/controls/inputTextArea.js.map +1 -1
  19. package/2D/controls/line.js.map +1 -1
  20. package/2D/controls/multiLine.js.map +1 -1
  21. package/2D/controls/radioButton.js.map +1 -1
  22. package/2D/controls/rectangle.js.map +1 -1
  23. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
  24. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  25. package/2D/controls/selector.js.map +1 -1
  26. package/2D/controls/sliders/baseSlider.js.map +1 -1
  27. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  28. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  29. package/2D/controls/sliders/scrollBar.js.map +1 -1
  30. package/2D/controls/sliders/slider.js.map +1 -1
  31. package/2D/controls/stackPanel.js.map +1 -1
  32. package/2D/controls/textBlock.js.map +1 -1
  33. package/2D/controls/toggleButton.js.map +1 -1
  34. package/2D/controls/virtualKeyboard.js.map +1 -1
  35. package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
  36. package/3D/controls/abstractButton3D.js.map +1 -1
  37. package/3D/controls/button3D.js.map +1 -1
  38. package/3D/controls/container3D.js.map +1 -1
  39. package/3D/controls/handMenu.js.map +1 -1
  40. package/3D/controls/holographicBackplate.js.map +1 -1
  41. package/3D/controls/holographicButton.js.map +1 -1
  42. package/3D/controls/holographicSlate.js.map +1 -1
  43. package/3D/controls/meshButton3D.js.map +1 -1
  44. package/3D/controls/nearMenu.js.map +1 -1
  45. package/3D/controls/scatterPanel.js.map +1 -1
  46. package/3D/controls/slider3D.js.map +1 -1
  47. package/3D/controls/stackPanel3D.js.map +1 -1
  48. package/3D/controls/touchButton3D.js.map +1 -1
  49. package/3D/controls/touchHolographicButton.js.map +1 -1
  50. package/3D/controls/touchHolographicMenu.js.map +1 -1
  51. package/3D/controls/touchMeshButton3D.js.map +1 -1
  52. package/3D/controls/volumeBasedPanel.js.map +1 -1
  53. package/3D/gizmos/slateGizmo.js.map +1 -1
  54. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  55. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  56. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  57. package/3D/materials/handle/handleMaterial.js.map +1 -1
  58. package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
  59. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  60. package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
  61. package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
  62. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  63. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  64. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/2D/controls/sliders/slider.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAA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;AA5QG;IADC,SAAS,EAAE;6CAGX;AAaD;IADC,SAAS,EAAE;yCAGX;AAaD;IADC,SAAS,EAAE;wCAGX;AA2BD;IADC,SAAS,EAAE;wCAGX;AAaD;IADC,SAAS,EAAE;2CAGX;AAiML,aAAa,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import { BaseSlider } from \"./baseSlider\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { BaseGradient } from \"../gradient/BaseGradient\";\r\nimport type { AdvancedDynamicTexture } from \"gui/2D/advancedDynamicTexture\";\r\nimport { Tools } from \"core/Misc/tools\";\r\n\r\n/**\r\n * Class used to create slider controls\r\n */\r\nexport class Slider extends BaseSlider {\r\n private _background = \"black\";\r\n private _borderColor = \"white\";\r\n private _thumbColor = \"\";\r\n private _isThumbCircle = false;\r\n protected _displayValueBar = true;\r\n private _backgroundGradient: Nullable<BaseGradient> = null;\r\n\r\n /** Gets or sets a boolean indicating if the value bar must be rendered */\r\n @serialize()\r\n public get displayValueBar(): boolean {\r\n return this._displayValueBar;\r\n }\r\n\r\n public set displayValueBar(value: boolean) {\r\n if (this._displayValueBar === value) {\r\n return;\r\n }\r\n\r\n this._displayValueBar = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets border color */\r\n @serialize()\r\n public get borderColor(): string {\r\n return this._borderColor;\r\n }\r\n\r\n public set borderColor(value: string) {\r\n if (this._borderColor === value) {\r\n return;\r\n }\r\n\r\n this._borderColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background color */\r\n @serialize()\r\n public get background(): string {\r\n return this._background;\r\n }\r\n\r\n public set background(value: string) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n\r\n this._background = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background gradient */\r\n public get backgroundGradient(): Nullable<BaseGradient> {\r\n return this._backgroundGradient;\r\n }\r\n\r\n public set backgroundGradient(value: Nullable<BaseGradient>) {\r\n if (this._backgroundGradient === value) {\r\n return;\r\n }\r\n\r\n this._backgroundGradient = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets thumb's color */\r\n @serialize()\r\n public get thumbColor(): string {\r\n return this._thumbColor;\r\n }\r\n\r\n public set thumbColor(value: string) {\r\n if (this._thumbColor === value) {\r\n return;\r\n }\r\n\r\n this._thumbColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the thumb should be round or square */\r\n @serialize()\r\n public get isThumbCircle(): boolean {\r\n return this._isThumbCircle;\r\n }\r\n\r\n public set isThumbCircle(value: boolean) {\r\n if (this._isThumbCircle === value) {\r\n return;\r\n }\r\n\r\n this._isThumbCircle = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new Slider\r\n * @param name defines the 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 \"Slider\";\r\n }\r\n\r\n protected _getBackgroundColor(context: ICanvasRenderingContext) {\r\n return this._backgroundGradient ? this._backgroundGradient.getCanvasGradient(context) : this._background;\r\n }\r\n\r\n public _draw(context: ICanvasRenderingContext): void {\r\n context.save();\r\n\r\n this._applyStates(context);\r\n this._prepareRenderingData(this.isThumbCircle ? \"circle\" : \"rectangle\");\r\n let left = this._renderLeft;\r\n let top = this._renderTop;\r\n const width = this._renderWidth;\r\n const height = this._renderHeight;\r\n\r\n let radius = 0;\r\n\r\n if (this.isThumbClamped && this.isThumbCircle) {\r\n if (this.isVertical) {\r\n top += this._effectiveThumbThickness / 2;\r\n } else {\r\n left += this._effectiveThumbThickness / 2;\r\n }\r\n\r\n radius = this._backgroundBoxThickness / 2;\r\n } else {\r\n radius = (this._effectiveThumbThickness - this._effectiveBarOffset) / 2;\r\n }\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n\r\n const thumbPosition = this._getThumbPosition();\r\n context.fillStyle = this._getBackgroundColor(context);\r\n\r\n if (this.isVertical) {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxThickness / 2, top, radius, Math.PI, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, width, height);\r\n } else {\r\n context.fillRect(left, top, width, height + this._effectiveThumbThickness);\r\n }\r\n } else {\r\n context.fillRect(left, top, width, height);\r\n }\r\n } else {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxLength, top + this._backgroundBoxThickness / 2, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, width, height);\r\n } else {\r\n context.fillRect(left, top, width + this._effectiveThumbThickness, height);\r\n }\r\n } else {\r\n context.fillRect(left, top, width, height);\r\n }\r\n }\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n\r\n // Value bar\r\n context.fillStyle = this._getColor(context);\r\n if (this._displayValueBar) {\r\n if (this.isVertical) {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxThickness / 2, top + this._backgroundBoxLength, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition);\r\n } else {\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition + this._effectiveThumbThickness);\r\n }\r\n } else {\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition);\r\n }\r\n } else {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left, top + this._backgroundBoxThickness / 2, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, thumbPosition, height);\r\n } else {\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n } else {\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n }\r\n }\r\n\r\n // Thumb\r\n context.fillStyle = this._thumbColor || this._getColor(context);\r\n if (this.displayThumb) {\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n if (this._isThumbCircle) {\r\n context.beginPath();\r\n if (this.isVertical) {\r\n context.arc(left + this._backgroundBoxThickness / 2, top + thumbPosition, radius, 0, 2 * Math.PI);\r\n } else {\r\n context.arc(left + thumbPosition, top + this._backgroundBoxThickness / 2, radius, 0, 2 * Math.PI);\r\n }\r\n context.fill();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this._borderColor;\r\n context.stroke();\r\n } else {\r\n if (this.isVertical) {\r\n context.fillRect(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n } else {\r\n context.fillRect(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this._borderColor;\r\n if (this.isVertical) {\r\n context.strokeRect(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n } else {\r\n context.strokeRect(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n }\r\n }\r\n context.restore();\r\n }\r\n\r\n public serialize(serializationObject: any) {\r\n super.serialize(serializationObject);\r\n\r\n if (this.backgroundGradient) {\r\n serializationObject.backgroundGradient = {};\r\n this.backgroundGradient.serialize(serializationObject.backgroundGradient);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n\r\n if (serializedObject.backgroundGradient) {\r\n const className = Tools.Instantiate(\"BABYLON.GUI.\" + serializedObject.backgroundGradient.className);\r\n this.backgroundGradient = new className();\r\n this.backgroundGradient!.parse(serializedObject.backgroundGradient);\r\n }\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Slider\", Slider);\r\n"]}
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/2D/controls/sliders/slider.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAKjD,OAAO,EAAE,KAAK,EAAE,sCAAwB;AAExC;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU;IAQlC,0EAA0E;IAE1E,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,IAAW,eAAe,CAAC,KAAc;QACrC,IAAI,IAAI,CAAC,gBAAgB,KAAK,KAAK,EAAE;YACjC,OAAO;SACV;QAED,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED,gCAAgC;IAEhC,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY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E,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;iBACvJ;aACJ;SACJ;QACD,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAEe,SAAS,CAAC,mBAAwB;QAC9C,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAErC,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,mBAAmB,CAAC,kBAAkB,GAAG,EAAE,CAAC;YAC5C,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;SAC7E;IACL,CAAC;IAED,gBAAgB;IACA,iBAAiB,CAAC,gBAAqB,EAAE,IAA4B;QACjF,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAEhD,IAAI,gBAAgB,CAAC,kBAAkB,EAAE;YACrC,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,cAAc,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACpG,IAAI,CAAC,kBAAkB,GAAG,IAAI,SAAS,EAAE,CAAC;YAC1C,IAAI,CAAC,kBAAmB,CAAC,KAAK,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;SACvE;IACL,CAAC;CACJ;AA5QG;IADC,SAAS,EAAE;6CAGX;AAaD;IADC,SAAS,EAAE;yCAGX;AAaD;IADC,SAAS,EAAE;wCAGX;AA2BD;IADC,SAAS,EAAE;wCAGX;AAaD;IADC,SAAS,EAAE;2CAGX;AAiML,aAAa,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import { BaseSlider } from \"./baseSlider\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { BaseGradient } from \"../gradient/BaseGradient\";\r\nimport type { AdvancedDynamicTexture } from \"gui/2D/advancedDynamicTexture\";\r\nimport { Tools } from \"core/Misc/tools\";\r\n\r\n/**\r\n * Class used to create slider controls\r\n */\r\nexport class Slider extends BaseSlider {\r\n private _background = \"black\";\r\n private _borderColor = \"white\";\r\n private _thumbColor = \"\";\r\n private _isThumbCircle = false;\r\n protected _displayValueBar = true;\r\n private _backgroundGradient: Nullable<BaseGradient> = null;\r\n\r\n /** Gets or sets a boolean indicating if the value bar must be rendered */\r\n @serialize()\r\n public get displayValueBar(): boolean {\r\n return this._displayValueBar;\r\n }\r\n\r\n public set displayValueBar(value: boolean) {\r\n if (this._displayValueBar === value) {\r\n return;\r\n }\r\n\r\n this._displayValueBar = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets border color */\r\n @serialize()\r\n public get borderColor(): string {\r\n return this._borderColor;\r\n }\r\n\r\n public set borderColor(value: string) {\r\n if (this._borderColor === value) {\r\n return;\r\n }\r\n\r\n this._borderColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background color */\r\n @serialize()\r\n public get background(): string {\r\n return this._background;\r\n }\r\n\r\n public set background(value: string) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n\r\n this._background = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background gradient */\r\n public get backgroundGradient(): Nullable<BaseGradient> {\r\n return this._backgroundGradient;\r\n }\r\n\r\n public set backgroundGradient(value: Nullable<BaseGradient>) {\r\n if (this._backgroundGradient === value) {\r\n return;\r\n }\r\n\r\n this._backgroundGradient = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets thumb's color */\r\n @serialize()\r\n public get thumbColor(): string {\r\n return this._thumbColor;\r\n }\r\n\r\n public set thumbColor(value: string) {\r\n if (this._thumbColor === value) {\r\n return;\r\n }\r\n\r\n this._thumbColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the thumb should be round or square */\r\n @serialize()\r\n public get isThumbCircle(): boolean {\r\n return this._isThumbCircle;\r\n }\r\n\r\n public set isThumbCircle(value: boolean) {\r\n if (this._isThumbCircle === value) {\r\n return;\r\n }\r\n\r\n this._isThumbCircle = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new Slider\r\n * @param name defines the control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"Slider\";\r\n }\r\n\r\n protected _getBackgroundColor(context: ICanvasRenderingContext) {\r\n return this._backgroundGradient ? this._backgroundGradient.getCanvasGradient(context) : this._background;\r\n }\r\n\r\n public override _draw(context: ICanvasRenderingContext): void {\r\n context.save();\r\n\r\n this._applyStates(context);\r\n this._prepareRenderingData(this.isThumbCircle ? \"circle\" : \"rectangle\");\r\n let left = this._renderLeft;\r\n let top = this._renderTop;\r\n const width = this._renderWidth;\r\n const height = this._renderHeight;\r\n\r\n let radius = 0;\r\n\r\n if (this.isThumbClamped && this.isThumbCircle) {\r\n if (this.isVertical) {\r\n top += this._effectiveThumbThickness / 2;\r\n } else {\r\n left += this._effectiveThumbThickness / 2;\r\n }\r\n\r\n radius = this._backgroundBoxThickness / 2;\r\n } else {\r\n radius = (this._effectiveThumbThickness - this._effectiveBarOffset) / 2;\r\n }\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n\r\n const thumbPosition = this._getThumbPosition();\r\n context.fillStyle = this._getBackgroundColor(context);\r\n\r\n if (this.isVertical) {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxThickness / 2, top, radius, Math.PI, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, width, height);\r\n } else {\r\n context.fillRect(left, top, width, height + this._effectiveThumbThickness);\r\n }\r\n } else {\r\n context.fillRect(left, top, width, height);\r\n }\r\n } else {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxLength, top + this._backgroundBoxThickness / 2, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, width, height);\r\n } else {\r\n context.fillRect(left, top, width + this._effectiveThumbThickness, height);\r\n }\r\n } else {\r\n context.fillRect(left, top, width, height);\r\n }\r\n }\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n\r\n // Value bar\r\n context.fillStyle = this._getColor(context);\r\n if (this._displayValueBar) {\r\n if (this.isVertical) {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxThickness / 2, top + this._backgroundBoxLength, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition);\r\n } else {\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition + this._effectiveThumbThickness);\r\n }\r\n } else {\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition);\r\n }\r\n } else {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left, top + this._backgroundBoxThickness / 2, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, thumbPosition, height);\r\n } else {\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n } else {\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n }\r\n }\r\n\r\n // Thumb\r\n context.fillStyle = this._thumbColor || this._getColor(context);\r\n if (this.displayThumb) {\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n if (this._isThumbCircle) {\r\n context.beginPath();\r\n if (this.isVertical) {\r\n context.arc(left + this._backgroundBoxThickness / 2, top + thumbPosition, radius, 0, 2 * Math.PI);\r\n } else {\r\n context.arc(left + thumbPosition, top + this._backgroundBoxThickness / 2, radius, 0, 2 * Math.PI);\r\n }\r\n context.fill();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this._borderColor;\r\n context.stroke();\r\n } else {\r\n if (this.isVertical) {\r\n context.fillRect(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n } else {\r\n context.fillRect(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this._borderColor;\r\n if (this.isVertical) {\r\n context.strokeRect(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n } else {\r\n context.strokeRect(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n }\r\n }\r\n context.restore();\r\n }\r\n\r\n public override serialize(serializationObject: any) {\r\n super.serialize(serializationObject);\r\n\r\n if (this.backgroundGradient) {\r\n serializationObject.backgroundGradient = {};\r\n this.backgroundGradient.serialize(serializationObject.backgroundGradient);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n\r\n if (serializedObject.backgroundGradient) {\r\n const className = Tools.Instantiate(\"BABYLON.GUI.\" + serializedObject.backgroundGradient.className);\r\n this.backgroundGradient = new className();\r\n this.backgroundGradient!.parse(serializedObject.backgroundGradient);\r\n }\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Slider\", Slider);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stackPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/stackPanel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAE1C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,SAAS;IAarC,oFAAoF;IAEpF,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAc;QAChC,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE;YAC5B,OAAO;SACV;QAED,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IAEH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAW,OAAO,CAAC,KAAa;QAC5B,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;YACzB,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED;;;OAGG;IAEH,IAAW,KAAK,CAAC,KAAsB;QACnC,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE;YAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC5B;QAED,IAAI,IAAI,CAAC,MAAM,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YAAY,CAAC;QACpD,mBAAmB,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,iBAAiB,CAAC,gBAAqB,EAAE,IAA4B;QACxE,IAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC;QACjD,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAEnD,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACJ;AAtPU;IADN,SAAS,EAAE;wDACwB;AAIpC;IADC,SAAS,EAAE;4CAGX;AAeD;IADC,SAAS,EAAE;yCAGX;AAgBD;IADC,SAAS,EAAE;uCAaX;AAWD;IADC,SAAS,EAAE;wCAaX;AA6KL,aAAa,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { Container } from \"./container\";\r\nimport type { Measure } from \"../measure\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Class used to create a 2D stack panel container\r\n */\r\nexport class StackPanel extends Container {\r\n private _isVertical = true;\r\n private _manualWidth = false;\r\n private _manualHeight = false;\r\n private _doNotTrackManualChanges = false;\r\n private _spacing = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that layout warnings should be ignored\r\n */\r\n @serialize()\r\n public ignoreLayoutWarnings = false;\r\n\r\n /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/\r\n @serialize()\r\n public get isVertical(): boolean {\r\n return this._isVertical;\r\n }\r\n\r\n public set isVertical(value: boolean) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the spacing (in pixels) between each child.\r\n */\r\n @serialize()\r\n public get spacing(): number {\r\n return this._spacing;\r\n }\r\n\r\n public set spacing(value: number) {\r\n if (this._spacing === value) {\r\n return;\r\n }\r\n\r\n this._spacing = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets panel width.\r\n * This value should not be set when in horizontal mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public set width(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualWidth = true;\r\n }\r\n\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public get width(): string | number {\r\n return this._width.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets panel height.\r\n * This value should not be set when in vertical mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public set height(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualHeight = true;\r\n }\r\n\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public get height(): string | number {\r\n return this._height.toString(this._host);\r\n }\r\n\r\n /**\r\n * Creates a new StackPanel\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 \"StackPanel\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _preMeasure(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n for (const child of this._children) {\r\n if (this._isVertical) {\r\n child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n } else {\r\n child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n }\r\n }\r\n\r\n super._preMeasure(parentMeasure, context);\r\n }\r\n\r\n protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.copyFrom(parentMeasure);\r\n\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n\r\n if (!this.isVertical || this._manualWidth) {\r\n this._measureForChildren.width = this._currentMeasure.width;\r\n }\r\n\r\n if (this.isVertical || this._manualHeight) {\r\n this._measureForChildren.height = this._currentMeasure.height;\r\n }\r\n }\r\n\r\n protected _postMeasure(): void {\r\n let stackWidth = 0;\r\n let stackHeight = 0;\r\n const childrenCount = this._children.length;\r\n for (let index = 0; index < childrenCount; index++) {\r\n const child = this._children[index];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n\r\n if (this._isVertical) {\r\n if (child.top !== stackHeight + \"px\") {\r\n child.top = stackHeight + \"px\";\r\n this._rebuildLayout = true;\r\n child._top.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"height\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using height in percentage mode inside a vertical StackPanel`, 1);\r\n } else {\r\n stackHeight += child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels + (index < childrenCount - 1 ? this._spacing : 0);\r\n }\r\n } else {\r\n if (child.left !== stackWidth + \"px\") {\r\n child.left = stackWidth + \"px\";\r\n this._rebuildLayout = true;\r\n child._left.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"width\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using width in percentage mode inside a horizontal StackPanel`, 1);\r\n } else {\r\n stackWidth += child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels + (index < childrenCount - 1 ? this._spacing : 0);\r\n }\r\n }\r\n }\r\n\r\n stackWidth += this._paddingLeftInPixels + this._paddingRightInPixels;\r\n stackHeight += this._paddingTopInPixels + this._paddingBottomInPixels;\r\n\r\n this._doNotTrackManualChanges = true;\r\n\r\n // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.\r\n // User can now define their own height and width for stack panel.\r\n\r\n let panelWidthChanged = false;\r\n let panelHeightChanged = false;\r\n\r\n if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {\r\n // do not specify height if strictly defined by user\r\n const previousHeight = this.height;\r\n this.height = stackHeight + \"px\";\r\n panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;\r\n }\r\n if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {\r\n // do not specify width if strictly defined by user\r\n const previousWidth = this.width;\r\n this.width = stackWidth + \"px\";\r\n panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;\r\n }\r\n\r\n if (panelHeightChanged) {\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (panelWidthChanged) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._doNotTrackManualChanges = false;\r\n\r\n if (panelWidthChanged || panelHeightChanged) {\r\n this._rebuildLayout = true;\r\n }\r\n\r\n super._postMeasure();\r\n }\r\n\r\n private _getManualDim(dim: \"width\" | \"height\") {\r\n if (dim === \"width\") {\r\n return this._manualWidth;\r\n } else {\r\n return this._manualHeight;\r\n }\r\n }\r\n\r\n public isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (dim === \"height\" ? this.isVertical : !this.isVertical && !this._getManualDim(dim)) {\r\n for (const child of this._children) {\r\n if (!child.isDimensionFullyDefined(dim)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n return this.getDimension(dim).isPixel || this._getAdaptDimTo(dim);\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.manualWidth = this._manualWidth;\r\n serializationObject.manualHeight = this._manualHeight;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n this._manualWidth = serializedObject.manualWidth;\r\n this._manualHeight = serializedObject.manualHeight;\r\n\r\n super._parseFromContent(serializedObject, host);\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.StackPanel\", StackPanel);\r\n"]}
1
+ {"version":3,"file":"stackPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/stackPanel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAE1C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,SAAS;IAarC,oFAAoF;IAEpF,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAc;QAChC,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE;YAC5B,OAAO;SACV;QAED,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IAEH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAW,OAAO,CAAC,KAAa;QAC5B,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;YACzB,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED;;;OAGG;IAEH,IAAoB,KAAK,CAAC,KAAsB;QAC5C,IAAI,C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CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,EAAE;YAChC,OAAO;SACV;QACD,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;QACpD,mBAAmB,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC;IAC1D,CAAC;IAED;;OAEG;IACa,iBAAiB,CAAC,gBAAqB,EAAE,IAA4B;QACjF,IAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC;QACjD,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAEnD,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACJ;AAtPU;IADN,SAAS,EAAE;wDACwB;AAIpC;IADC,SAAS,EAAE;4CAGX;AAeD;IADC,SAAS,EAAE;yCAGX;AAgBD;IADC,SAAS,EAAE;uCAaX;AAWD;IADC,SAAS,EAAE;wCAaX;AA6KL,aAAa,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { Container } from \"./container\";\r\nimport type { Measure } from \"../measure\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Class used to create a 2D stack panel container\r\n */\r\nexport class StackPanel extends Container {\r\n private _isVertical = true;\r\n private _manualWidth = false;\r\n private _manualHeight = false;\r\n private _doNotTrackManualChanges = false;\r\n private _spacing = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that layout warnings should be ignored\r\n */\r\n @serialize()\r\n public ignoreLayoutWarnings = false;\r\n\r\n /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/\r\n @serialize()\r\n public get isVertical(): boolean {\r\n return this._isVertical;\r\n }\r\n\r\n public set isVertical(value: boolean) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the spacing (in pixels) between each child.\r\n */\r\n @serialize()\r\n public get spacing(): number {\r\n return this._spacing;\r\n }\r\n\r\n public set spacing(value: number) {\r\n if (this._spacing === value) {\r\n return;\r\n }\r\n\r\n this._spacing = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets panel width.\r\n * This value should not be set when in horizontal mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public override set width(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualWidth = true;\r\n }\r\n\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public override get width(): string | number {\r\n return this._width.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets panel height.\r\n * This value should not be set when in vertical mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public override set height(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualHeight = true;\r\n }\r\n\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public override get height(): string | number {\r\n return this._height.toString(this._host);\r\n }\r\n\r\n /**\r\n * Creates a new StackPanel\r\n * @param name defines control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"StackPanel\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected override _preMeasure(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n for (const child of this._children) {\r\n if (this._isVertical) {\r\n child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n } else {\r\n child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n }\r\n }\r\n\r\n super._preMeasure(parentMeasure, context);\r\n }\r\n\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.copyFrom(parentMeasure);\r\n\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n\r\n if (!this.isVertical || this._manualWidth) {\r\n this._measureForChildren.width = this._currentMeasure.width;\r\n }\r\n\r\n if (this.isVertical || this._manualHeight) {\r\n this._measureForChildren.height = this._currentMeasure.height;\r\n }\r\n }\r\n\r\n protected override _postMeasure(): void {\r\n let stackWidth = 0;\r\n let stackHeight = 0;\r\n const childrenCount = this._children.length;\r\n for (let index = 0; index < childrenCount; index++) {\r\n const child = this._children[index];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n\r\n if (this._isVertical) {\r\n if (child.top !== stackHeight + \"px\") {\r\n child.top = stackHeight + \"px\";\r\n this._rebuildLayout = true;\r\n child._top.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"height\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using height in percentage mode inside a vertical StackPanel`, 1);\r\n } else {\r\n stackHeight += child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels + (index < childrenCount - 1 ? this._spacing : 0);\r\n }\r\n } else {\r\n if (child.left !== stackWidth + \"px\") {\r\n child.left = stackWidth + \"px\";\r\n this._rebuildLayout = true;\r\n child._left.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"width\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using width in percentage mode inside a horizontal StackPanel`, 1);\r\n } else {\r\n stackWidth += child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels + (index < childrenCount - 1 ? this._spacing : 0);\r\n }\r\n }\r\n }\r\n\r\n stackWidth += this._paddingLeftInPixels + this._paddingRightInPixels;\r\n stackHeight += this._paddingTopInPixels + this._paddingBottomInPixels;\r\n\r\n this._doNotTrackManualChanges = true;\r\n\r\n // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.\r\n // User can now define their own height and width for stack panel.\r\n\r\n let panelWidthChanged = false;\r\n let panelHeightChanged = false;\r\n\r\n if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {\r\n // do not specify height if strictly defined by user\r\n const previousHeight = this.height;\r\n this.height = stackHeight + \"px\";\r\n panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;\r\n }\r\n if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {\r\n // do not specify width if strictly defined by user\r\n const previousWidth = this.width;\r\n this.width = stackWidth + \"px\";\r\n panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;\r\n }\r\n\r\n if (panelHeightChanged) {\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (panelWidthChanged) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._doNotTrackManualChanges = false;\r\n\r\n if (panelWidthChanged || panelHeightChanged) {\r\n this._rebuildLayout = true;\r\n }\r\n\r\n super._postMeasure();\r\n }\r\n\r\n private _getManualDim(dim: \"width\" | \"height\") {\r\n if (dim === \"width\") {\r\n return this._manualWidth;\r\n } else {\r\n return this._manualHeight;\r\n }\r\n }\r\n\r\n public override isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (dim === \"height\" ? this.isVertical : !this.isVertical && !this._getManualDim(dim)) {\r\n for (const child of this._children) {\r\n if (!child.isDimensionFullyDefined(dim)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n return this.getDimension(dim).isPixel || this._getAdaptDimTo(dim);\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 override 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.manualWidth = this._manualWidth;\r\n serializationObject.manualHeight = this._manualHeight;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n this._manualWidth = serializedObject.manualWidth;\r\n this._manualHeight = serializedObject.manualHeight;\r\n\r\n super._parseFromContent(serializedObject, host);\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.StackPanel\", StackPanel);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"textBlock.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/textBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAEjD,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD;;GAEG;AACH,MAAM,CAAN,IAAY,YAoBX;AApBD,WAAY,YAAY;IACpB;;OAEG;IACH,+CAAQ,CAAA;IAER;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uEAAgB,CAAA;AACpB,CAAC,EApBW,YAAY,KAAZ,YAAY,QAoBvB;AAED;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,OAAO;IAgClC;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IAEH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;I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BACb,CAAC,CAAC,IAAI,CAAC,WAAW,CACZ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAC3E,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,EAC5E,OAAO,CACV,CAAC;gBACR,OAAO,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aACtD;SACJ;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IAED,OAAO;QACH,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;CACJ;AA5lBG;IADC,SAAS,EAAE;4CAGX;AAwBD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;qCAGX;AAmBD;IADC,SAAS,EAAE;wDAGX;AAkBD;IADC,SAAS,EAAE;sDAGX;AAkBD;IADC,SAAS,EAAE;4CAKX;AAaD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;0CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAiBD;IADC,SAAS,EAAE;wDAGX;AAcD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAmBD;IADC,SAAS,EAAE;iDAGX;AA+WL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Measure } from \"../measure\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext, ITextMetrics } from \"core/Engines/ICanvas\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\n\r\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nexport enum TextWrapping {\r\n /**\r\n * Clip the text when it's larger than Control.width; this is the default mode.\r\n */\r\n Clip = 0,\r\n\r\n /**\r\n * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.\r\n */\r\n WordWrap = 1,\r\n\r\n /**\r\n * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.\r\n */\r\n Ellipsis = 2,\r\n\r\n /**\r\n * Wrap the text word-wise and clip the text when the text's height is larger than the Control.height, and shrink the last line with trailing … .\r\n */\r\n WordWrapEllipsis,\r\n}\r\n\r\n/**\r\n * Class used to create text block control\r\n */\r\nexport class TextBlock extends Control {\r\n private _text = \"\";\r\n private _textWrapping = TextWrapping.Clip;\r\n private _textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n private _textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n\r\n private _lines: any[];\r\n private _resizeToFit: boolean = false;\r\n private _lineSpacing: ValueAndUnit = new ValueAndUnit(0);\r\n private _outlineWidth: number = 0;\r\n private _outlineColor: string = \"white\";\r\n private _underline: boolean = false;\r\n private _lineThrough: boolean = false;\r\n private _wordDivider: string = \" \";\r\n private _forceResizeWidth: boolean = false;\r\n private _applyOutlineToUnderline: boolean = false;\r\n\r\n /**\r\n * An event triggered after the text is changed\r\n */\r\n public onTextChangedObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * An event triggered after the text was broken up into lines\r\n */\r\n public onLinesReadyObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * Function used to split a string into words. By default, a string is split at each space character found\r\n */\r\n public wordSplittingFunction: Nullable<(line: string) => string[]>;\r\n\r\n /**\r\n * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)\r\n */\r\n public get lines(): any[] {\r\n return this._lines;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n @serialize()\r\n public get resizeToFit(): boolean {\r\n return this._resizeToFit;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n public set resizeToFit(value: boolean) {\r\n if (this._resizeToFit === value) {\r\n return;\r\n }\r\n this._resizeToFit = value;\r\n\r\n if (this._resizeToFit) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n @serialize()\r\n public get textWrapping(): TextWrapping | boolean {\r\n return this._textWrapping;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n public set textWrapping(value: TextWrapping | boolean) {\r\n if (this._textWrapping === value) {\r\n return;\r\n }\r\n this._textWrapping = +value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n @serialize()\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n this._text = value + \"\"; // Making sure it is a text\r\n this._markAsDirty();\r\n\r\n this.onTextChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textHorizontalAlignment(): number {\r\n return this._textHorizontalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textHorizontalAlignment(value: number) {\r\n if (this._textHorizontalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textHorizontalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textVerticalAlignment(): number {\r\n return this._textVerticalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textVerticalAlignment(value: number) {\r\n if (this._textVerticalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textVerticalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n @serialize()\r\n public set lineSpacing(value: string | number) {\r\n if (this._lineSpacing.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n public get lineSpacing(): string | number {\r\n return this._lineSpacing.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n @serialize()\r\n public get outlineWidth(): number {\r\n return this._outlineWidth;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n public set outlineWidth(value: number) {\r\n if (this._outlineWidth === value) {\r\n return;\r\n }\r\n this._outlineWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n @serialize()\r\n public get underline(): boolean {\r\n return this._underline;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n public set underline(value: boolean) {\r\n if (this._underline === value) {\r\n return;\r\n }\r\n this._underline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n @serialize()\r\n public get lineThrough(): boolean {\r\n return this._lineThrough;\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n public set lineThrough(value: boolean) {\r\n if (this._lineThrough === value) {\r\n return;\r\n }\r\n this._lineThrough = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * If the outline should be applied to the underline/strike-through too. Has different behavior in Edge/Chrome vs Firefox.\r\n */\r\n @serialize()\r\n public get applyOutlineToUnderline(): boolean {\r\n return this._applyOutlineToUnderline;\r\n }\r\n\r\n public set applyOutlineToUnderline(value: boolean) {\r\n if (this._applyOutlineToUnderline === value) {\r\n return;\r\n }\r\n this._applyOutlineToUnderline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n @serialize()\r\n public get outlineColor(): string {\r\n return this._outlineColor;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n public set outlineColor(value: string) {\r\n if (this._outlineColor === value) {\r\n return;\r\n }\r\n this._outlineColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n @serialize()\r\n public get wordDivider(): string {\r\n return this._wordDivider;\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n public set wordDivider(value: string) {\r\n if (this._wordDivider === value) {\r\n return;\r\n }\r\n this._wordDivider = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * By default, if a text block has text wrapping other than Clip, its width\r\n * is not resized even if resizeToFit = true. This parameter forces the width\r\n * to be resized.\r\n */\r\n @serialize()\r\n public get forceResizeWidth(): boolean {\r\n return this._forceResizeWidth;\r\n }\r\n\r\n public set forceResizeWidth(value: boolean) {\r\n if (this._forceResizeWidth === value) {\r\n return;\r\n }\r\n this._forceResizeWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new TextBlock object\r\n * @param name defines the name of the control\r\n * @param text defines the text to display (empty string by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the control\r\n */\r\n public name?: string,\r\n text: string = \"\"\r\n ) {\r\n super(name);\r\n\r\n this.text = text;\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"TextBlock\";\r\n }\r\n\r\n protected _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || this.isDirty) {\r\n this._fontOffset = Control._GetFontOffset(context.font);\r\n }\r\n super._processMeasures(parentMeasure, context);\r\n\r\n // Prepare lines\r\n this._lines = this._breakLines(this._currentMeasure.width, this._currentMeasure.height, context);\r\n this.onLinesReadyObservable.notifyObservers(this);\r\n\r\n let maxLineWidth: number = 0;\r\n\r\n for (let i = 0; i < this._lines.length; i++) {\r\n const line = this._lines[i];\r\n\r\n if (line.width > maxLineWidth) {\r\n maxLineWidth = line.width;\r\n }\r\n }\r\n\r\n if (this._resizeToFit) {\r\n if (this._textWrapping === TextWrapping.Clip || this._forceResizeWidth) {\r\n const newWidth = Math.ceil(this._paddingLeftInPixels) + Math.ceil(this._paddingRightInPixels) + Math.ceil(maxLineWidth);\r\n if (newWidth !== this._width.getValueInPixel(this._host, this._tempParentMeasure.width)) {\r\n this._width.updateInPlace(newWidth, ValueAndUnit.UNITMODE_PIXEL);\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n let newHeight = (this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * this._lines.length) | 0;\r\n\r\n if (this._lines.length > 0 && this._lineSpacing.internalValue !== 0) {\r\n let lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n } else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n\r\n newHeight += (this._lines.length - 1) * lineSpacing;\r\n }\r\n\r\n if (newHeight !== this._height.internalValue) {\r\n this._height.updateInPlace(newHeight, ValueAndUnit.UNITMODE_PIXEL);\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n }\r\n\r\n private _drawText(text: string, textWidth: number, y: number, context: ICanvasRenderingContext): void {\r\n const width = this._currentMeasure.width;\r\n let x = 0;\r\n switch (this._textHorizontalAlignment) {\r\n case Control.HORIZONTAL_ALIGNMENT_LEFT:\r\n x = 0;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_RIGHT:\r\n x = width - textWidth;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_CENTER:\r\n x = (width - textWidth) / 2;\r\n break;\r\n }\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n\r\n if (this.outlineWidth) {\r\n context.strokeText(text, this._currentMeasure.left + x, y);\r\n }\r\n context.fillText(text, this._currentMeasure.left + x, y);\r\n\r\n if (this._underline) {\r\n this._drawLine(this._currentMeasure.left + x, y + 3, this._currentMeasure.left + x + textWidth, y + 3, context);\r\n }\r\n\r\n if (this._lineThrough) {\r\n this._drawLine(this._currentMeasure.left + x, y - this.fontSizeInPixels / 3, this._currentMeasure.left + x + textWidth, y - this.fontSizeInPixels / 3, context);\r\n }\r\n }\r\n\r\n private _drawLine(xFrom: number, yFrom: number, xTo: number, yTo: number, context: ICanvasRenderingContext): void {\r\n context.beginPath();\r\n context.lineWidth = Math.round(this.fontSizeInPixels * 0.05);\r\n context.moveTo(xFrom, yFrom);\r\n context.lineTo(xTo, yTo);\r\n if (this.outlineWidth && this.applyOutlineToUnderline) {\r\n context.stroke();\r\n context.fill();\r\n } else {\r\n const currentStroke = context.strokeStyle;\r\n context.strokeStyle = context.fillStyle;\r\n context.stroke();\r\n context.strokeStyle = currentStroke;\r\n }\r\n context.closePath();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _draw(context: ICanvasRenderingContext): void {\r\n context.save();\r\n\r\n this._applyStates(context);\r\n\r\n // Render lines\r\n this._renderLines(context);\r\n\r\n context.restore();\r\n }\r\n\r\n protected _applyStates(context: ICanvasRenderingContext): void {\r\n super._applyStates(context);\r\n if (this.outlineWidth) {\r\n context.lineWidth = this.outlineWidth;\r\n context.strokeStyle = this.outlineColor;\r\n context.lineJoin = \"miter\";\r\n context.miterLimit = 2;\r\n }\r\n }\r\n\r\n private _linesTemp: object[] = [];\r\n\r\n protected _breakLines(refWidth: number, refHeight: number, context: ICanvasRenderingContext): object[] {\r\n this._linesTemp.length = 0;\r\n const _lines = this.text.split(\"\\n\");\r\n\r\n if (this._textWrapping === TextWrapping.Ellipsis) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLineEllipsis(_line, refWidth, context));\r\n }\r\n } else if (this._textWrapping === TextWrapping.WordWrap) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrap(_line, refWidth, context));\r\n }\r\n } else if (this._textWrapping === TextWrapping.WordWrapEllipsis) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrapEllipsis(_line, refWidth, refHeight!, context));\r\n }\r\n } else {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLine(_line, context));\r\n }\r\n }\r\n\r\n return this._linesTemp;\r\n }\r\n\r\n protected _parseLine(line: string = \"\", context: ICanvasRenderingContext): object {\r\n return { text: line, width: this._getTextMetricsWidth(context.measureText(line)) };\r\n }\r\n\r\n //Calculate how many characters approximately we need to remove\r\n private _getCharsToRemove(lineWidth: number, width: number, lineLength: number) {\r\n const diff = lineWidth > width ? lineWidth - width : 0;\r\n // This isn't exact unless the font is monospaced\r\n const charWidth = lineWidth / lineLength;\r\n const removeChars = Math.max(Math.floor(diff / charWidth), 1);\r\n return removeChars;\r\n }\r\n\r\n protected _parseLineEllipsis(line: string = \"\", width: number, context: ICanvasRenderingContext): object {\r\n let lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n let removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n\r\n // unicode support. split('') does not work with unicode!\r\n // make sure Array.from is available\r\n const characters = Array.from && Array.from(line);\r\n if (!characters) {\r\n // no array.from, use the old method\r\n while (line.length > 2 && lineWidth > width) {\r\n line = line.slice(0, -removeChars);\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line + \"…\"));\r\n\r\n removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n }\r\n // Add on the end\r\n line += \"…\";\r\n } else {\r\n while (characters.length && lineWidth > width) {\r\n characters.splice(characters.length - removeChars, removeChars);\r\n line = `${characters.join(\"\")}…`;\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n }\r\n }\r\n\r\n return { text: line, width: lineWidth };\r\n }\r\n\r\n private _getTextMetricsWidth(textMetrics: ITextMetrics) {\r\n if (textMetrics.actualBoundingBoxLeft !== undefined) {\r\n return Math.abs(textMetrics.actualBoundingBoxLeft) + Math.abs(textMetrics.actualBoundingBoxRight);\r\n }\r\n return textMetrics.width;\r\n }\r\n\r\n protected _parseLineWordWrap(line: string = \"\", width: number, context: ICanvasRenderingContext): object[] {\r\n const lines = [];\r\n const words = this.wordSplittingFunction ? this.wordSplittingFunction(line) : line.split(this._wordDivider);\r\n let lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n for (let n = 0; n < words.length; n++) {\r\n const testLine = n > 0 ? line + this._wordDivider + words[n] : words[0];\r\n const testWidth = this._getTextMetricsWidth(context.measureText(testLine));\r\n if (testWidth > width && n > 0) {\r\n lines.push({ text: line, width: lineWidth });\r\n line = words[n];\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n } else {\r\n lineWidth = testWidth;\r\n line = testLine;\r\n }\r\n }\r\n lines.push({ text: line, width: lineWidth });\r\n\r\n return lines;\r\n }\r\n\r\n protected _parseLineWordWrapEllipsis(line: string = \"\", width: number, height: number, context: ICanvasRenderingContext): object[] {\r\n const lines = this._parseLineWordWrap(line, width, context);\r\n for (let n = 1; n <= lines.length; n++) {\r\n const currentHeight = this._computeHeightForLinesOf(n);\r\n if (currentHeight > height && n > 1) {\r\n const lastLine = lines[n - 2] as { text: string; width: number };\r\n const currentLine = lines[n - 1] as { text: string; width: number };\r\n lines[n - 2] = this._parseLineEllipsis(lastLine.text + this._wordDivider + currentLine.text, width, context);\r\n const linesToRemove = lines.length - n + 1;\r\n for (let i = 0; i < linesToRemove; i++) {\r\n lines.pop();\r\n }\r\n return lines;\r\n }\r\n }\r\n\r\n return lines;\r\n }\r\n\r\n protected _renderLines(context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || !this._lines) {\r\n return;\r\n }\r\n const height = this._currentMeasure.height;\r\n let rootY = 0;\r\n switch (this._textVerticalAlignment) {\r\n case Control.VERTICAL_ALIGNMENT_TOP:\r\n rootY = this._fontOffset.ascent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_BOTTOM:\r\n rootY = height - this._fontOffset.height * (this._lines.length - 1) - this._fontOffset.descent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_CENTER:\r\n rootY = this._fontOffset.ascent + (height - this._fontOffset.height * this._lines.length) / 2;\r\n break;\r\n }\r\n\r\n rootY += this._currentMeasure.top;\r\n\r\n for (let i = 0; i < this._lines.length; i++) {\r\n const line = this._lines[i];\r\n\r\n if (i !== 0 && this._lineSpacing.internalValue !== 0) {\r\n if (this._lineSpacing.isPixel) {\r\n rootY += this._lineSpacing.getValue(this._host);\r\n } else {\r\n rootY = rootY + this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n }\r\n\r\n this._drawText(line.text, line.width, rootY, context);\r\n rootY += this._fontOffset.height;\r\n }\r\n }\r\n\r\n private _computeHeightForLinesOf(lineCount: number): number {\r\n let newHeight = this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * lineCount;\r\n\r\n if (lineCount > 0 && this._lineSpacing.internalValue !== 0) {\r\n let lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n } else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n\r\n newHeight += (lineCount - 1) * lineSpacing;\r\n }\r\n\r\n return newHeight;\r\n }\r\n\r\n public isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (this.resizeToFit) {\r\n return true;\r\n }\r\n return super.isDimensionFullyDefined(dim);\r\n }\r\n\r\n /**\r\n * Given a width constraint applied on the text block, find the expected height\r\n * @returns expected height\r\n */\r\n public computeExpectedHeight(): number {\r\n if (this.text && this.widthInPixels) {\r\n // Should abstract platform instead of using LastCreatedEngine\r\n const context = EngineStore.LastCreatedEngine?.createCanvas(0, 0).getContext(\"2d\");\r\n if (context) {\r\n this._applyStates(context);\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context.font);\r\n }\r\n const lines = this._lines\r\n ? this._lines\r\n : this._breakLines(\r\n this.widthInPixels - this._paddingLeftInPixels - this._paddingRightInPixels,\r\n this.heightInPixels - this._paddingTopInPixels - this._paddingBottomInPixels,\r\n context\r\n );\r\n return this._computeHeightForLinesOf(lines.length);\r\n }\r\n }\r\n return 0;\r\n }\r\n\r\n dispose(): void {\r\n super.dispose();\r\n\r\n this.onTextChangedObservable.clear();\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.TextBlock\", TextBlock);\r\n"]}
1
+ {"version":3,"file":"textBlock.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/textBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAEjD,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD;;GAEG;AACH,MAAM,CAAN,IAAY,YAoBX;AApBD,WAAY,YAAY;IACpB;;OAEG;IACH,+CAAQ,CAAA;IAER;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uEAAgB,CAAA;AACpB,C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AI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;gBAC3B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;oBACnB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;iBAC3D;gBACD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM;oBACrB,CAAC,CAAC,IAAI,CAAC,MAAM;oBACb,CAAC,CAAC,IAAI,CAAC,WAAW,CACZ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAC3E,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,EAC5E,OAAO,CACV,CAAC;gBACR,OAAO,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aACtD;SACJ;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IAEQ,OAAO;QACZ,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;CACJ;AA5lBG;IADC,SAAS,EAAE;4CAGX;AAwBD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;qCAGX;AAmBD;IADC,SAAS,EAAE;wDAGX;AAkBD;IADC,SAAS,EAAE;sDAGX;AAkBD;IADC,SAAS,EAAE;4CAKX;AAaD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;0CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAiBD;IADC,SAAS,EAAE;wDAGX;AAcD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAmBD;IADC,SAAS,EAAE;iDAGX;AA+WL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Measure } from \"../measure\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext, ITextMetrics } from \"core/Engines/ICanvas\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\n\r\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nexport enum TextWrapping {\r\n /**\r\n * Clip the text when it's larger than Control.width; this is the default mode.\r\n */\r\n Clip = 0,\r\n\r\n /**\r\n * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.\r\n */\r\n WordWrap = 1,\r\n\r\n /**\r\n * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.\r\n */\r\n Ellipsis = 2,\r\n\r\n /**\r\n * Wrap the text word-wise and clip the text when the text's height is larger than the Control.height, and shrink the last line with trailing … .\r\n */\r\n WordWrapEllipsis,\r\n}\r\n\r\n/**\r\n * Class used to create text block control\r\n */\r\nexport class TextBlock extends Control {\r\n private _text = \"\";\r\n private _textWrapping = TextWrapping.Clip;\r\n private _textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n private _textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n\r\n private _lines: any[];\r\n private _resizeToFit: boolean = false;\r\n private _lineSpacing: ValueAndUnit = new ValueAndUnit(0);\r\n private _outlineWidth: number = 0;\r\n private _outlineColor: string = \"white\";\r\n private _underline: boolean = false;\r\n private _lineThrough: boolean = false;\r\n private _wordDivider: string = \" \";\r\n private _forceResizeWidth: boolean = false;\r\n private _applyOutlineToUnderline: boolean = false;\r\n\r\n /**\r\n * An event triggered after the text is changed\r\n */\r\n public onTextChangedObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * An event triggered after the text was broken up into lines\r\n */\r\n public onLinesReadyObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * Function used to split a string into words. By default, a string is split at each space character found\r\n */\r\n public wordSplittingFunction: Nullable<(line: string) => string[]>;\r\n\r\n /**\r\n * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)\r\n */\r\n public get lines(): any[] {\r\n return this._lines;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n @serialize()\r\n public get resizeToFit(): boolean {\r\n return this._resizeToFit;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n public set resizeToFit(value: boolean) {\r\n if (this._resizeToFit === value) {\r\n return;\r\n }\r\n this._resizeToFit = value;\r\n\r\n if (this._resizeToFit) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n @serialize()\r\n public get textWrapping(): TextWrapping | boolean {\r\n return this._textWrapping;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n public set textWrapping(value: TextWrapping | boolean) {\r\n if (this._textWrapping === value) {\r\n return;\r\n }\r\n this._textWrapping = +value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n @serialize()\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n this._text = value + \"\"; // Making sure it is a text\r\n this._markAsDirty();\r\n\r\n this.onTextChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textHorizontalAlignment(): number {\r\n return this._textHorizontalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textHorizontalAlignment(value: number) {\r\n if (this._textHorizontalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textHorizontalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textVerticalAlignment(): number {\r\n return this._textVerticalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textVerticalAlignment(value: number) {\r\n if (this._textVerticalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textVerticalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n @serialize()\r\n public set lineSpacing(value: string | number) {\r\n if (this._lineSpacing.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n public get lineSpacing(): string | number {\r\n return this._lineSpacing.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n @serialize()\r\n public get outlineWidth(): number {\r\n return this._outlineWidth;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n public set outlineWidth(value: number) {\r\n if (this._outlineWidth === value) {\r\n return;\r\n }\r\n this._outlineWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n @serialize()\r\n public get underline(): boolean {\r\n return this._underline;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n public set underline(value: boolean) {\r\n if (this._underline === value) {\r\n return;\r\n }\r\n this._underline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n @serialize()\r\n public get lineThrough(): boolean {\r\n return this._lineThrough;\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n public set lineThrough(value: boolean) {\r\n if (this._lineThrough === value) {\r\n return;\r\n }\r\n this._lineThrough = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * If the outline should be applied to the underline/strike-through too. Has different behavior in Edge/Chrome vs Firefox.\r\n */\r\n @serialize()\r\n public get applyOutlineToUnderline(): boolean {\r\n return this._applyOutlineToUnderline;\r\n }\r\n\r\n public set applyOutlineToUnderline(value: boolean) {\r\n if (this._applyOutlineToUnderline === value) {\r\n return;\r\n }\r\n this._applyOutlineToUnderline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n @serialize()\r\n public get outlineColor(): string {\r\n return this._outlineColor;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n public set outlineColor(value: string) {\r\n if (this._outlineColor === value) {\r\n return;\r\n }\r\n this._outlineColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n @serialize()\r\n public get wordDivider(): string {\r\n return this._wordDivider;\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n public set wordDivider(value: string) {\r\n if (this._wordDivider === value) {\r\n return;\r\n }\r\n this._wordDivider = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * By default, if a text block has text wrapping other than Clip, its width\r\n * is not resized even if resizeToFit = true. This parameter forces the width\r\n * to be resized.\r\n */\r\n @serialize()\r\n public get forceResizeWidth(): boolean {\r\n return this._forceResizeWidth;\r\n }\r\n\r\n public set forceResizeWidth(value: boolean) {\r\n if (this._forceResizeWidth === value) {\r\n return;\r\n }\r\n this._forceResizeWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new TextBlock object\r\n * @param name defines the name of the control\r\n * @param text defines the text to display (empty string by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the control\r\n */\r\n public override name?: string,\r\n text: string = \"\"\r\n ) {\r\n super(name);\r\n\r\n this.text = text;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TextBlock\";\r\n }\r\n\r\n protected override _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || this.isDirty) {\r\n this._fontOffset = Control._GetFontOffset(context.font);\r\n }\r\n super._processMeasures(parentMeasure, context);\r\n\r\n // Prepare lines\r\n this._lines = this._breakLines(this._currentMeasure.width, this._currentMeasure.height, context);\r\n this.onLinesReadyObservable.notifyObservers(this);\r\n\r\n let maxLineWidth: number = 0;\r\n\r\n for (let i = 0; i < this._lines.length; i++) {\r\n const line = this._lines[i];\r\n\r\n if (line.width > maxLineWidth) {\r\n maxLineWidth = line.width;\r\n }\r\n }\r\n\r\n if (this._resizeToFit) {\r\n if (this._textWrapping === TextWrapping.Clip || this._forceResizeWidth) {\r\n const newWidth = Math.ceil(this._paddingLeftInPixels) + Math.ceil(this._paddingRightInPixels) + Math.ceil(maxLineWidth);\r\n if (newWidth !== this._width.getValueInPixel(this._host, this._tempParentMeasure.width)) {\r\n this._width.updateInPlace(newWidth, ValueAndUnit.UNITMODE_PIXEL);\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n let newHeight = (this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * this._lines.length) | 0;\r\n\r\n if (this._lines.length > 0 && this._lineSpacing.internalValue !== 0) {\r\n let lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n } else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n\r\n newHeight += (this._lines.length - 1) * lineSpacing;\r\n }\r\n\r\n if (newHeight !== this._height.internalValue) {\r\n this._height.updateInPlace(newHeight, ValueAndUnit.UNITMODE_PIXEL);\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n }\r\n\r\n private _drawText(text: string, textWidth: number, y: number, context: ICanvasRenderingContext): void {\r\n const width = this._currentMeasure.width;\r\n let x = 0;\r\n switch (this._textHorizontalAlignment) {\r\n case Control.HORIZONTAL_ALIGNMENT_LEFT:\r\n x = 0;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_RIGHT:\r\n x = width - textWidth;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_CENTER:\r\n x = (width - textWidth) / 2;\r\n break;\r\n }\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n\r\n if (this.outlineWidth) {\r\n context.strokeText(text, this._currentMeasure.left + x, y);\r\n }\r\n context.fillText(text, this._currentMeasure.left + x, y);\r\n\r\n if (this._underline) {\r\n this._drawLine(this._currentMeasure.left + x, y + 3, this._currentMeasure.left + x + textWidth, y + 3, context);\r\n }\r\n\r\n if (this._lineThrough) {\r\n this._drawLine(this._currentMeasure.left + x, y - this.fontSizeInPixels / 3, this._currentMeasure.left + x + textWidth, y - this.fontSizeInPixels / 3, context);\r\n }\r\n }\r\n\r\n private _drawLine(xFrom: number, yFrom: number, xTo: number, yTo: number, context: ICanvasRenderingContext): void {\r\n context.beginPath();\r\n context.lineWidth = Math.round(this.fontSizeInPixels * 0.05);\r\n context.moveTo(xFrom, yFrom);\r\n context.lineTo(xTo, yTo);\r\n if (this.outlineWidth && this.applyOutlineToUnderline) {\r\n context.stroke();\r\n context.fill();\r\n } else {\r\n const currentStroke = context.strokeStyle;\r\n context.strokeStyle = context.fillStyle;\r\n context.stroke();\r\n context.strokeStyle = currentStroke;\r\n }\r\n context.closePath();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _draw(context: ICanvasRenderingContext): void {\r\n context.save();\r\n\r\n this._applyStates(context);\r\n\r\n // Render lines\r\n this._renderLines(context);\r\n\r\n context.restore();\r\n }\r\n\r\n protected override _applyStates(context: ICanvasRenderingContext): void {\r\n super._applyStates(context);\r\n if (this.outlineWidth) {\r\n context.lineWidth = this.outlineWidth;\r\n context.strokeStyle = this.outlineColor;\r\n context.lineJoin = \"miter\";\r\n context.miterLimit = 2;\r\n }\r\n }\r\n\r\n private _linesTemp: object[] = [];\r\n\r\n protected _breakLines(refWidth: number, refHeight: number, context: ICanvasRenderingContext): object[] {\r\n this._linesTemp.length = 0;\r\n const _lines = this.text.split(\"\\n\");\r\n\r\n if (this._textWrapping === TextWrapping.Ellipsis) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLineEllipsis(_line, refWidth, context));\r\n }\r\n } else if (this._textWrapping === TextWrapping.WordWrap) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrap(_line, refWidth, context));\r\n }\r\n } else if (this._textWrapping === TextWrapping.WordWrapEllipsis) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrapEllipsis(_line, refWidth, refHeight!, context));\r\n }\r\n } else {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLine(_line, context));\r\n }\r\n }\r\n\r\n return this._linesTemp;\r\n }\r\n\r\n protected _parseLine(line: string = \"\", context: ICanvasRenderingContext): object {\r\n return { text: line, width: this._getTextMetricsWidth(context.measureText(line)) };\r\n }\r\n\r\n //Calculate how many characters approximately we need to remove\r\n private _getCharsToRemove(lineWidth: number, width: number, lineLength: number) {\r\n const diff = lineWidth > width ? lineWidth - width : 0;\r\n // This isn't exact unless the font is monospaced\r\n const charWidth = lineWidth / lineLength;\r\n const removeChars = Math.max(Math.floor(diff / charWidth), 1);\r\n return removeChars;\r\n }\r\n\r\n protected _parseLineEllipsis(line: string = \"\", width: number, context: ICanvasRenderingContext): object {\r\n let lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n let removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n\r\n // unicode support. split('') does not work with unicode!\r\n // make sure Array.from is available\r\n const characters = Array.from && Array.from(line);\r\n if (!characters) {\r\n // no array.from, use the old method\r\n while (line.length > 2 && lineWidth > width) {\r\n line = line.slice(0, -removeChars);\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line + \"…\"));\r\n\r\n removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n }\r\n // Add on the end\r\n line += \"…\";\r\n } else {\r\n while (characters.length && lineWidth > width) {\r\n characters.splice(characters.length - removeChars, removeChars);\r\n line = `${characters.join(\"\")}…`;\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n }\r\n }\r\n\r\n return { text: line, width: lineWidth };\r\n }\r\n\r\n private _getTextMetricsWidth(textMetrics: ITextMetrics) {\r\n if (textMetrics.actualBoundingBoxLeft !== undefined) {\r\n return Math.abs(textMetrics.actualBoundingBoxLeft) + Math.abs(textMetrics.actualBoundingBoxRight);\r\n }\r\n return textMetrics.width;\r\n }\r\n\r\n protected _parseLineWordWrap(line: string = \"\", width: number, context: ICanvasRenderingContext): object[] {\r\n const lines = [];\r\n const words = this.wordSplittingFunction ? this.wordSplittingFunction(line) : line.split(this._wordDivider);\r\n let lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n for (let n = 0; n < words.length; n++) {\r\n const testLine = n > 0 ? line + this._wordDivider + words[n] : words[0];\r\n const testWidth = this._getTextMetricsWidth(context.measureText(testLine));\r\n if (testWidth > width && n > 0) {\r\n lines.push({ text: line, width: lineWidth });\r\n line = words[n];\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n } else {\r\n lineWidth = testWidth;\r\n line = testLine;\r\n }\r\n }\r\n lines.push({ text: line, width: lineWidth });\r\n\r\n return lines;\r\n }\r\n\r\n protected _parseLineWordWrapEllipsis(line: string = \"\", width: number, height: number, context: ICanvasRenderingContext): object[] {\r\n const lines = this._parseLineWordWrap(line, width, context);\r\n for (let n = 1; n <= lines.length; n++) {\r\n const currentHeight = this._computeHeightForLinesOf(n);\r\n if (currentHeight > height && n > 1) {\r\n const lastLine = lines[n - 2] as { text: string; width: number };\r\n const currentLine = lines[n - 1] as { text: string; width: number };\r\n lines[n - 2] = this._parseLineEllipsis(lastLine.text + this._wordDivider + currentLine.text, width, context);\r\n const linesToRemove = lines.length - n + 1;\r\n for (let i = 0; i < linesToRemove; i++) {\r\n lines.pop();\r\n }\r\n return lines;\r\n }\r\n }\r\n\r\n return lines;\r\n }\r\n\r\n protected _renderLines(context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || !this._lines) {\r\n return;\r\n }\r\n const height = this._currentMeasure.height;\r\n let rootY = 0;\r\n switch (this._textVerticalAlignment) {\r\n case Control.VERTICAL_ALIGNMENT_TOP:\r\n rootY = this._fontOffset.ascent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_BOTTOM:\r\n rootY = height - this._fontOffset.height * (this._lines.length - 1) - this._fontOffset.descent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_CENTER:\r\n rootY = this._fontOffset.ascent + (height - this._fontOffset.height * this._lines.length) / 2;\r\n break;\r\n }\r\n\r\n rootY += this._currentMeasure.top;\r\n\r\n for (let i = 0; i < this._lines.length; i++) {\r\n const line = this._lines[i];\r\n\r\n if (i !== 0 && this._lineSpacing.internalValue !== 0) {\r\n if (this._lineSpacing.isPixel) {\r\n rootY += this._lineSpacing.getValue(this._host);\r\n } else {\r\n rootY = rootY + this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n }\r\n\r\n this._drawText(line.text, line.width, rootY, context);\r\n rootY += this._fontOffset.height;\r\n }\r\n }\r\n\r\n private _computeHeightForLinesOf(lineCount: number): number {\r\n let newHeight = this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * lineCount;\r\n\r\n if (lineCount > 0 && this._lineSpacing.internalValue !== 0) {\r\n let lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n } else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n\r\n newHeight += (lineCount - 1) * lineSpacing;\r\n }\r\n\r\n return newHeight;\r\n }\r\n\r\n public override isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (this.resizeToFit) {\r\n return true;\r\n }\r\n return super.isDimensionFullyDefined(dim);\r\n }\r\n\r\n /**\r\n * Given a width constraint applied on the text block, find the expected height\r\n * @returns expected height\r\n */\r\n public computeExpectedHeight(): number {\r\n if (this.text && this.widthInPixels) {\r\n // Should abstract platform instead of using LastCreatedEngine\r\n const context = EngineStore.LastCreatedEngine?.createCanvas(0, 0).getContext(\"2d\");\r\n if (context) {\r\n this._applyStates(context);\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context.font);\r\n }\r\n const lines = this._lines\r\n ? this._lines\r\n : this._breakLines(\r\n this.widthInPixels - this._paddingLeftInPixels - this._paddingRightInPixels,\r\n this.heightInPixels - this._paddingTopInPixels - this._paddingBottomInPixels,\r\n context\r\n );\r\n return this._computeHeightForLinesOf(lines.length);\r\n }\r\n }\r\n return 0;\r\n }\r\n\r\n override dispose(): void {\r\n super.dispose();\r\n\r\n this.onTextChangedObservable.clear();\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.TextBlock\", TextBlock);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"toggleButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/toggleButton.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ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S,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IACrF,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nimport { Rectangle } from \"./rectangle\";\r\nimport type { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\n\r\n/**\r\n * Class used to create toggle buttons\r\n * @since 5.0.0\r\n */\r\nexport class ToggleButton extends Rectangle {\r\n /**\r\n * Function called to generate the toActive animation\r\n */\r\n public toActiveAnimation: () => void;\r\n\r\n /**\r\n * Function called to generate the toInactive animation\r\n */\r\n public toInactiveAnimation: () => void;\r\n\r\n /**\r\n * Function called to generate a pointer enter animation when the toggle button is active.\r\n */\r\n public pointerEnterActiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer out animation when the toggle button is active.\r\n */\r\n public pointerOutActiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer down animation when the toggle button is active.\r\n */\r\n public pointerDownActiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer up animation when the toggle button is active.\r\n */\r\n public pointerUpActiveAnimation: () => void;\r\n\r\n /**\r\n * Function called to generate a pointer enter animation when the toggle button is inactive.\r\n */\r\n public pointerEnterInactiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer out animation when the toggle button is inactive.\r\n */\r\n public pointerOutInactiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer down animation when the toggle button is inactive.\r\n */\r\n public pointerDownInactiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer up animation when the toggle button is inactive.\r\n */\r\n public pointerUpInactiveAnimation: () => void;\r\n\r\n /** Observable raised when isActive is changed */\r\n public onIsActiveChangedObservable = new Observable<boolean>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the toggle button will let internal controls handle picking instead of doing it directly using its bounding info\r\n */\r\n public delegatePickingToChildren = false;\r\n\r\n private _group: string;\r\n /** Gets or sets group name this toggle button belongs to */\r\n public get group(): string {\r\n return this._group;\r\n }\r\n public set group(value: string) {\r\n if (this._group === value) {\r\n return;\r\n }\r\n\r\n this._group = value;\r\n }\r\n\r\n private _isActive = false;\r\n /** Gets or sets a boolean indicating if the toggle button is active or not */\r\n public get isActive(): boolean {\r\n return this._isActive;\r\n }\r\n public set isActive(value: boolean) {\r\n // Function modeled after radioButton.ts\r\n if (this._isActive === value) {\r\n return;\r\n }\r\n\r\n this._isActive = value;\r\n\r\n // Update the visual state based on the new value\r\n if (this._isActive) {\r\n this.toActiveAnimation?.();\r\n } else {\r\n this.toInactiveAnimation?.();\r\n }\r\n\r\n this._markAsDirty();\r\n\r\n this.onIsActiveChangedObservable.notifyObservers(value);\r\n\r\n if (this._isActive && this._host && this._group) {\r\n // A toggle button in a group can only have 1 active element at a given time.\r\n // If this toggle button has a group, set other toggle buttons in the group to inactive.\r\n this._host.executeOnAllControls((control) => {\r\n // Check for control type ToggleButton\r\n if (control.typeName === \"ToggleButton\") {\r\n // Don't do anything to this toggle button\r\n if (control === this) {\r\n return;\r\n }\r\n\r\n const childToggle = <ToggleButton>control;\r\n // If toggle button is in same group, set isActive to false\r\n if (childToggle.group === this.group) {\r\n childToggle.isActive = false;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new ToggleButton\r\n * @param name defines the control name\r\n * @param group defines the toggle group this toggle belongs to\r\n */\r\n constructor(\r\n public name?: string,\r\n group?: string\r\n ) {\r\n super(name);\r\n this.group = group ?? \"\";\r\n\r\n this.thickness = 0;\r\n this.isPointerBlocker = true;\r\n\r\n let alphaStore: Nullable<number> = null;\r\n\r\n this.toActiveAnimation = () => {\r\n this.thickness = 1;\r\n };\r\n this.toInactiveAnimation = () => {\r\n this.thickness = 0;\r\n };\r\n\r\n this.pointerEnterActiveAnimation = () => {\r\n alphaStore = this.alpha;\r\n this.alpha -= 0.1;\r\n };\r\n\r\n this.pointerOutActiveAnimation = () => {\r\n if (alphaStore !== null) {\r\n this.alpha = alphaStore;\r\n }\r\n };\r\n\r\n this.pointerDownActiveAnimation = () => {\r\n this.scaleX -= 0.05;\r\n this.scaleY -= 0.05;\r\n };\r\n\r\n this.pointerUpActiveAnimation = () => {\r\n this.scaleX += 0.05;\r\n this.scaleY += 0.05;\r\n };\r\n\r\n this.pointerEnterInactiveAnimation = () => {\r\n alphaStore = this.alpha;\r\n this.alpha -= 0.1;\r\n };\r\n\r\n this.pointerOutInactiveAnimation = () => {\r\n if (alphaStore !== null) {\r\n this.alpha = alphaStore;\r\n }\r\n };\r\n\r\n this.pointerDownInactiveAnimation = () => {\r\n this.scaleX -= 0.05;\r\n this.scaleY -= 0.05;\r\n };\r\n\r\n this.pointerUpInactiveAnimation = () => {\r\n this.scaleX += 0.05;\r\n this.scaleY += 0.05;\r\n };\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"ToggleButton\";\r\n }\r\n\r\n // While being a container, the toggle button behaves like a control.\r\n /**\r\n * @internal\r\n */\r\n public _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean {\r\n if (!this._isEnabled || !this.isHitTestVisible || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n\r\n if (!super.contains(x, y)) {\r\n return false;\r\n }\r\n\r\n if (this.delegatePickingToChildren) {\r\n let contains = false;\r\n for (let index = this._children.length - 1; index >= 0; index--) {\r\n const child = this._children[index];\r\n if (child.isEnabled && child.isHitTestVisible && child.isVisible && !child.notRenderable && child.contains(x, y)) {\r\n contains = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!contains) {\r\n return false;\r\n }\r\n }\r\n\r\n this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerEnter(target: Control, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerEnter(target, pi)) {\r\n return false;\r\n }\r\n\r\n if (this.isReadOnly) {\r\n return true;\r\n }\r\n\r\n if (this._isActive) {\r\n if (this.pointerEnterActiveAnimation) {\r\n this.pointerEnterActiveAnimation();\r\n }\r\n } else {\r\n if (this.pointerEnterInactiveAnimation) {\r\n this.pointerEnterInactiveAnimation();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerOut(target: Control, pi: PointerInfoBase, force = false): void {\r\n if (!this.isReadOnly) {\r\n if (this._isActive) {\r\n if (this.pointerOutActiveAnimation) {\r\n this.pointerOutActiveAnimation();\r\n }\r\n } else {\r\n if (this.pointerOutInactiveAnimation) {\r\n this.pointerOutInactiveAnimation();\r\n }\r\n }\r\n }\r\n\r\n super._onPointerOut(target, pi, force);\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 (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n\r\n if (this.isReadOnly) {\r\n return true;\r\n }\r\n\r\n if (this._isActive) {\r\n if (this.pointerDownActiveAnimation) {\r\n this.pointerDownActiveAnimation();\r\n }\r\n } else {\r\n if (this.pointerDownInactiveAnimation) {\r\n this.pointerDownInactiveAnimation();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: PointerInfoBase): void {\r\n if (!this.isReadOnly) {\r\n if (this._isActive) {\r\n if (this.pointerUpActiveAnimation) {\r\n this.pointerUpActiveAnimation();\r\n }\r\n } else {\r\n if (this.pointerUpInactiveAnimation) {\r\n this.pointerUpInactiveAnimation();\r\n }\r\n }\r\n }\r\n\r\n super._onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick, pi);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.ToggleButton\", ToggleButton);\r\n"]}
1
+ {"version":3,"file":"toggleButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/toggleButton.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IAsDvC,4DAA4D;IAC5D,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,EAAE;YACvB,OAAO;SACV;QAED,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAGD,8EAA8E;IAC9E,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD,IAAW,QAAQ,CAAC,KAAc;QAC9B,wCAAwC;QACxC,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE;YAC1B,OAAO;SACV;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QAEvB,iDAAiD;QACjD,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;SAC9B;aAAM;YACH,IAAI,CAAC,mBAAmB,EAAE,EAAE,CAAC;SAChC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,IAAI,CAAC,2BAA2B,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAExD,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;YAC7C,6EAA6E;YAC7E,wFAAwF;YACxF,IAAI,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,SAAiB,EAAE,WAAmB,EAAE,WAAoB,EAAE,EAAmB;QACjJ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,IAAI,CAAC,SAAS,EAAE;gBAChB,IAAI,IAAI,CAAC,wBAAwB,EAAE;oBAC/B,IAAI,CAAC,wBAAwB,EAAE,CAAC;iBACnC;aACJ;iBAAM;gBACH,IAAI,IAAI,CAAC,0BAA0B,EAAE;oBACjC,IAAI,CAAC,0BAA0B,EAAE,CAAC;iBACrC;aACJ;SACJ;QAED,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IACrF,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nimport { Rectangle } from \"./rectangle\";\r\nimport type { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\n\r\n/**\r\n * Class used to create toggle buttons\r\n * @since 5.0.0\r\n */\r\nexport class ToggleButton extends Rectangle {\r\n /**\r\n * Function called to generate the toActive animation\r\n */\r\n public toActiveAnimation: () => void;\r\n\r\n /**\r\n * Function called to generate the toInactive animation\r\n */\r\n public toInactiveAnimation: () => void;\r\n\r\n /**\r\n * Function called to generate a pointer enter animation when the toggle button is active.\r\n */\r\n public pointerEnterActiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer out animation when the toggle button is active.\r\n */\r\n public pointerOutActiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer down animation when the toggle button is active.\r\n */\r\n public pointerDownActiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer up animation when the toggle button is active.\r\n */\r\n public pointerUpActiveAnimation: () => void;\r\n\r\n /**\r\n * Function called to generate a pointer enter animation when the toggle button is inactive.\r\n */\r\n public pointerEnterInactiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer out animation when the toggle button is inactive.\r\n */\r\n public pointerOutInactiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer down animation when the toggle button is inactive.\r\n */\r\n public pointerDownInactiveAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer up animation when the toggle button is inactive.\r\n */\r\n public pointerUpInactiveAnimation: () => void;\r\n\r\n /** Observable raised when isActive is changed */\r\n public onIsActiveChangedObservable = new Observable<boolean>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the toggle button will let internal controls handle picking instead of doing it directly using its bounding info\r\n */\r\n public override delegatePickingToChildren = false;\r\n\r\n private _group: string;\r\n /** Gets or sets group name this toggle button belongs to */\r\n public get group(): string {\r\n return this._group;\r\n }\r\n public set group(value: string) {\r\n if (this._group === value) {\r\n return;\r\n }\r\n\r\n this._group = value;\r\n }\r\n\r\n private _isActive = false;\r\n /** Gets or sets a boolean indicating if the toggle button is active or not */\r\n public get isActive(): boolean {\r\n return this._isActive;\r\n }\r\n public set isActive(value: boolean) {\r\n // Function modeled after radioButton.ts\r\n if (this._isActive === value) {\r\n return;\r\n }\r\n\r\n this._isActive = value;\r\n\r\n // Update the visual state based on the new value\r\n if (this._isActive) {\r\n this.toActiveAnimation?.();\r\n } else {\r\n this.toInactiveAnimation?.();\r\n }\r\n\r\n this._markAsDirty();\r\n\r\n this.onIsActiveChangedObservable.notifyObservers(value);\r\n\r\n if (this._isActive && this._host && this._group) {\r\n // A toggle button in a group can only have 1 active element at a given time.\r\n // If this toggle button has a group, set other toggle buttons in the group to inactive.\r\n this._host.executeOnAllControls((control) => {\r\n // Check for control type ToggleButton\r\n if (control.typeName === \"ToggleButton\") {\r\n // Don't do anything to this toggle button\r\n if (control === this) {\r\n return;\r\n }\r\n\r\n const childToggle = <ToggleButton>control;\r\n // If toggle button is in same group, set isActive to false\r\n if (childToggle.group === this.group) {\r\n childToggle.isActive = false;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new ToggleButton\r\n * @param name defines the control name\r\n * @param group defines the toggle group this toggle belongs to\r\n */\r\n constructor(\r\n public override name?: string,\r\n group?: string\r\n ) {\r\n super(name);\r\n this.group = group ?? \"\";\r\n\r\n this.thickness = 0;\r\n this.isPointerBlocker = true;\r\n\r\n let alphaStore: Nullable<number> = null;\r\n\r\n this.toActiveAnimation = () => {\r\n this.thickness = 1;\r\n };\r\n this.toInactiveAnimation = () => {\r\n this.thickness = 0;\r\n };\r\n\r\n this.pointerEnterActiveAnimation = () => {\r\n alphaStore = this.alpha;\r\n this.alpha -= 0.1;\r\n };\r\n\r\n this.pointerOutActiveAnimation = () => {\r\n if (alphaStore !== null) {\r\n this.alpha = alphaStore;\r\n }\r\n };\r\n\r\n this.pointerDownActiveAnimation = () => {\r\n this.scaleX -= 0.05;\r\n this.scaleY -= 0.05;\r\n };\r\n\r\n this.pointerUpActiveAnimation = () => {\r\n this.scaleX += 0.05;\r\n this.scaleY += 0.05;\r\n };\r\n\r\n this.pointerEnterInactiveAnimation = () => {\r\n alphaStore = this.alpha;\r\n this.alpha -= 0.1;\r\n };\r\n\r\n this.pointerOutInactiveAnimation = () => {\r\n if (alphaStore !== null) {\r\n this.alpha = alphaStore;\r\n }\r\n };\r\n\r\n this.pointerDownInactiveAnimation = () => {\r\n this.scaleX -= 0.05;\r\n this.scaleY -= 0.05;\r\n };\r\n\r\n this.pointerUpInactiveAnimation = () => {\r\n this.scaleX += 0.05;\r\n this.scaleY += 0.05;\r\n };\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"ToggleButton\";\r\n }\r\n\r\n // While being a container, the toggle button behaves like a control.\r\n /**\r\n * @internal\r\n */\r\n public override _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean {\r\n if (!this._isEnabled || !this.isHitTestVisible || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n\r\n if (!super.contains(x, y)) {\r\n return false;\r\n }\r\n\r\n if (this.delegatePickingToChildren) {\r\n let contains = false;\r\n for (let index = this._children.length - 1; index >= 0; index--) {\r\n const child = this._children[index];\r\n if (child.isEnabled && child.isHitTestVisible && child.isVisible && !child.notRenderable && child.contains(x, y)) {\r\n contains = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!contains) {\r\n return false;\r\n }\r\n }\r\n\r\n this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _onPointerEnter(target: Control, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerEnter(target, pi)) {\r\n return false;\r\n }\r\n\r\n if (this.isReadOnly) {\r\n return true;\r\n }\r\n\r\n if (this._isActive) {\r\n if (this.pointerEnterActiveAnimation) {\r\n this.pointerEnterActiveAnimation();\r\n }\r\n } else {\r\n if (this.pointerEnterInactiveAnimation) {\r\n this.pointerEnterInactiveAnimation();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _onPointerOut(target: Control, pi: PointerInfoBase, force = false): void {\r\n if (!this.isReadOnly) {\r\n if (this._isActive) {\r\n if (this.pointerOutActiveAnimation) {\r\n this.pointerOutActiveAnimation();\r\n }\r\n } else {\r\n if (this.pointerOutInactiveAnimation) {\r\n this.pointerOutInactiveAnimation();\r\n }\r\n }\r\n }\r\n\r\n super._onPointerOut(target, pi, force);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n\r\n if (this.isReadOnly) {\r\n return true;\r\n }\r\n\r\n if (this._isActive) {\r\n if (this.pointerDownActiveAnimation) {\r\n this.pointerDownActiveAnimation();\r\n }\r\n } else {\r\n if (this.pointerDownInactiveAnimation) {\r\n this.pointerDownInactiveAnimation();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: PointerInfoBase): void {\r\n if (!this.isReadOnly) {\r\n if (this._isActive) {\r\n if (this.pointerUpActiveAnimation) {\r\n this.pointerUpActiveAnimation();\r\n }\r\n } else {\r\n if (this.pointerUpInactiveAnimation) {\r\n this.pointerUpInactiveAnimation();\r\n }\r\n }\r\n }\r\n\r\n super._onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick, pi);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.ToggleButton\", ToggleButton);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"virtualKeyboard.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/virtualKeyboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,cAAc;CAiB1B;AAQD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAA/C;;QACI,8CAA8C;QACvC,yBAAoB,GAAG,IAAI,UAAU,EAAU,CAAC;QAEvD,4CAA4C;QACrC,uBAAkB,GAAG,MAAM,CAAC;QACnC,6CAA6C;QACtC,wBAAmB,GAAG,MAAM,CAAC;QAEpC,mDAAmD;QAC5C,6BAAwB,GAAG,KAAK,CAAC;QACxC,oDAAoD;QAC7C,8BAAyB,GAAG,KAAK,CAAC;QACzC,kDAAkD;QAC3C,4BAAuB,GAAG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AAG,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,EAAE;4BAC/B,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,GAAG,CAAC,IAAc,CAAC,CAAC;wBAClE,CAAC,CAAC,CAAC;qBACN;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { Button } from \"./button\";\r\nimport type { Container } from \"./container\";\r\nimport type { TextBlock } from \"./textBlock\";\r\nimport type { InputText } from \"./inputText\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport { InputTextArea } from \"./inputTextArea\";\r\n\r\n/**\r\n * Class used to store key control properties\r\n */\r\nexport class KeyPropertySet {\r\n /** Width */\r\n width?: string;\r\n /** Height */\r\n height?: string;\r\n /** Left padding */\r\n paddingLeft?: string;\r\n /** Right padding */\r\n paddingRight?: string;\r\n /** Top padding */\r\n paddingTop?: string;\r\n /** Bottom padding */\r\n paddingBottom?: string;\r\n /** Foreground color */\r\n color?: string;\r\n /** Background color */\r\n background?: string;\r\n}\r\n\r\ntype ConnectedInputText = {\r\n input: InputText;\r\n onFocusObserver: Nullable<Observer<InputText>>;\r\n onBlurObserver: Nullable<Observer<InputText>>;\r\n};\r\n\r\n/**\r\n * Class used to create virtual keyboard\r\n */\r\nexport class VirtualKeyboard extends StackPanel {\r\n /** Observable raised when a key is pressed */\r\n public onKeyPressObservable = new Observable<string>();\r\n\r\n /** Gets or sets default key button width */\r\n public defaultButtonWidth = \"40px\";\r\n /** Gets or sets default key button height */\r\n public defaultButtonHeight = \"40px\";\r\n\r\n /** Gets or sets default key button left padding */\r\n public defaultButtonPaddingLeft = \"2px\";\r\n /** Gets or sets default key button right padding */\r\n public defaultButtonPaddingRight = \"2px\";\r\n /** Gets or sets default key button top padding */\r\n public defaultButtonPaddingTop = \"2px\";\r\n /** Gets or sets default key button bottom padding */\r\n public defaultButtonPaddingBottom = \"2px\";\r\n\r\n /** Gets or sets default key button foreground color */\r\n public defaultButtonColor = \"#DDD\";\r\n /** Gets or sets default key button background color */\r\n public defaultButtonBackground = \"#070707\";\r\n\r\n /** Gets or sets shift button foreground color */\r\n public shiftButtonColor = \"#7799FF\";\r\n /** Gets or sets shift button thickness*/\r\n public selectedShiftThickness = 1;\r\n\r\n /** Gets shift key state */\r\n public shiftState = 0;\r\n\r\n protected _getTypeName(): string {\r\n return \"VirtualKeyboard\";\r\n }\r\n\r\n private _createKey(key: string, propertySet: Nullable<KeyPropertySet>) {\r\n const button = Button.CreateSimpleButton(key, key);\r\n\r\n button.width = propertySet && propertySet.width ? propertySet.width : this.defaultButtonWidth;\r\n button.height = propertySet && propertySet.height ? propertySet.height : this.defaultButtonHeight;\r\n button.color = propertySet && propertySet.color ? propertySet.color : this.defaultButtonColor;\r\n button.background = propertySet && propertySet.background ? propertySet.background : this.defaultButtonBackground;\r\n button.paddingLeft = propertySet && propertySet.paddingLeft ? propertySet.paddingLeft : this.defaultButtonPaddingLeft;\r\n button.paddingRight = propertySet && propertySet.paddingRight ? propertySet.paddingRight : this.defaultButtonPaddingRight;\r\n button.paddingTop = propertySet && propertySet.paddingTop ? propertySet.paddingTop : this.defaultButtonPaddingTop;\r\n button.paddingBottom = propertySet && propertySet.paddingBottom ? propertySet.paddingBottom : this.defaultButtonPaddingBottom;\r\n\r\n button.thickness = 0;\r\n button.isFocusInvisible = true;\r\n\r\n button.shadowColor = this.shadowColor;\r\n button.shadowBlur = this.shadowBlur;\r\n button.shadowOffsetX = this.shadowOffsetX;\r\n button.shadowOffsetY = this.shadowOffsetY;\r\n\r\n button.onPointerUpObservable.add(() => {\r\n this.onKeyPressObservable.notifyObservers(key);\r\n });\r\n\r\n return button;\r\n }\r\n\r\n /**\r\n * Adds a new row of keys\r\n * @param keys defines the list of keys to add\r\n * @param propertySets defines the associated property sets\r\n */\r\n public addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void {\r\n const panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.isFocusInvisible = true;\r\n\r\n let maxKey: Nullable<Button> = null;\r\n for (let i = 0; i < keys.length; i++) {\r\n let properties = null;\r\n\r\n if (propertySets && propertySets.length === keys.length) {\r\n properties = propertySets[i];\r\n }\r\n\r\n const key = this._createKey(keys[i], properties);\r\n if (!maxKey || key.heightInPixels > maxKey.heightInPixels) {\r\n maxKey = key;\r\n }\r\n\r\n panel.addControl(key);\r\n }\r\n\r\n panel.height = maxKey ? maxKey.height : this.defaultButtonHeight;\r\n\r\n this.addControl(panel);\r\n }\r\n\r\n /**\r\n * Set the shift key to a specific state\r\n * @param shiftState defines the new shift state\r\n */\r\n public applyShiftState(shiftState: number): void {\r\n if (!this.children) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < this.children.length; i++) {\r\n const row = this.children[i];\r\n if (!row || !(<Container>row).children) {\r\n continue;\r\n }\r\n\r\n const rowContainer = <Container>row;\r\n for (let j = 0; j < rowContainer.children.length; j++) {\r\n const button = rowContainer.children[j] as Button;\r\n\r\n if (!button || !button.children[0]) {\r\n continue;\r\n }\r\n\r\n const button_tblock = button.children[0] as TextBlock;\r\n\r\n if (button_tblock.text === \"\\u21E7\") {\r\n button.color = shiftState ? this.shiftButtonColor : this.defaultButtonColor;\r\n button.thickness = shiftState > 1 ? this.selectedShiftThickness : 0;\r\n }\r\n\r\n button_tblock.text = shiftState > 0 ? button_tblock.text.toUpperCase() : button_tblock.text.toLowerCase();\r\n }\r\n }\r\n }\r\n\r\n private _currentlyConnectedInputText: Nullable<InputText | InputTextArea> = null;\r\n private _connectedInputTexts: ConnectedInputText[] = [];\r\n private _onKeyPressObserver: Nullable<Observer<string>> = null;\r\n\r\n /** Gets the input text control currently attached to the keyboard */\r\n public get connectedInputText(): Nullable<InputText | InputTextArea> {\r\n return this._currentlyConnectedInputText;\r\n }\r\n\r\n /**\r\n * Connects the keyboard with an input text control\r\n *\r\n * @param input defines the target control\r\n */\r\n public connect(input: InputText): void {\r\n const inputTextAlreadyConnected = this._connectedInputTexts.some((a) => a.input === input);\r\n if (inputTextAlreadyConnected) {\r\n return;\r\n }\r\n\r\n if (this._onKeyPressObserver === null) {\r\n this._onKeyPressObserver = this.onKeyPressObservable.add((key) => {\r\n if (!this._currentlyConnectedInputText) {\r\n return;\r\n }\r\n\r\n this._currentlyConnectedInputText._host.focusedControl = this._currentlyConnectedInputText;\r\n\r\n switch (key) {\r\n case \"\\u21E7\":\r\n this.shiftState++;\r\n if (this.shiftState > 2) {\r\n this.shiftState = 0;\r\n }\r\n this.applyShiftState(this.shiftState);\r\n return;\r\n case \"\\u2190\":\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"Backspace\");\r\n } else {\r\n this._currentlyConnectedInputText.processKey(8);\r\n }\r\n return;\r\n case \"\\u21B5\":\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"Enter\");\r\n } else {\r\n this._currentlyConnectedInputText.processKey(13);\r\n }\r\n return;\r\n }\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"\", this.shiftState ? key.toUpperCase() : key);\r\n } else {\r\n this._currentlyConnectedInputText.processKey(-1, this.shiftState ? key.toUpperCase() : key);\r\n }\r\n\r\n if (this.shiftState === 1) {\r\n this.shiftState = 0;\r\n this.applyShiftState(this.shiftState);\r\n }\r\n });\r\n }\r\n\r\n this.isVisible = false;\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n\r\n // Events hooking\r\n const onFocusObserver: Nullable<Observer<InputText>> = input.onFocusObservable.add(() => {\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n this.isVisible = true;\r\n });\r\n\r\n const onBlurObserver: Nullable<Observer<InputText>> = input.onBlurObservable.add(() => {\r\n input._connectedVirtualKeyboard = null;\r\n this._currentlyConnectedInputText = null;\r\n this.isVisible = false;\r\n });\r\n\r\n this._connectedInputTexts.push({\r\n input,\r\n onBlurObserver,\r\n onFocusObserver,\r\n });\r\n }\r\n\r\n /**\r\n * Disconnects the keyboard from connected InputText controls\r\n *\r\n * @param input optionally defines a target control, otherwise all are disconnected\r\n */\r\n public disconnect(input?: InputText): void {\r\n if (input) {\r\n // .find not available on IE\r\n const filtered = this._connectedInputTexts.filter((a) => a.input === input);\r\n if (filtered.length === 1) {\r\n this._removeConnectedInputObservables(filtered[0]);\r\n\r\n this._connectedInputTexts = this._connectedInputTexts.filter((a) => a.input !== input);\r\n if (this._currentlyConnectedInputText === input) {\r\n this._currentlyConnectedInputText = null;\r\n }\r\n }\r\n } else {\r\n this._connectedInputTexts.forEach((connectedInputText: ConnectedInputText) => {\r\n this._removeConnectedInputObservables(connectedInputText);\r\n });\r\n this._connectedInputTexts.length = 0;\r\n }\r\n\r\n if (this._connectedInputTexts.length === 0) {\r\n this._currentlyConnectedInputText = null;\r\n this.onKeyPressObservable.remove(this._onKeyPressObserver);\r\n this._onKeyPressObserver = null;\r\n }\r\n }\r\n\r\n private _removeConnectedInputObservables(connectedInputText: ConnectedInputText): void {\r\n connectedInputText.input._connectedVirtualKeyboard = null;\r\n connectedInputText.input.onFocusObservable.remove(connectedInputText.onFocusObserver);\r\n connectedInputText.input.onBlurObservable.remove(connectedInputText.onBlurObserver);\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this.disconnect();\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Creates a new keyboard using a default layout\r\n *\r\n * @param name defines control name\r\n * @returns a new VirtualKeyboard\r\n */\r\n public static CreateDefaultLayout(name?: string): VirtualKeyboard {\r\n const returnValue = new VirtualKeyboard(name);\r\n\r\n returnValue.addKeysRow([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\", \"\\u2190\"]);\r\n returnValue.addKeysRow([\"q\", \"w\", \"e\", \"r\", \"t\", \"y\", \"u\", \"i\", \"o\", \"p\"]);\r\n returnValue.addKeysRow([\"a\", \"s\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \";\", \"'\", \"\\u21B5\"]);\r\n returnValue.addKeysRow([\"\\u21E7\", \"z\", \"x\", \"c\", \"v\", \"b\", \"n\", \"m\", \",\", \".\", \"/\"]);\r\n returnValue.addKeysRow([\" \"], [{ width: \"200px\" }]);\r\n\r\n return returnValue;\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 for (const row of this.children) {\r\n if (row.getClassName() === \"StackPanel\") {\r\n const stackPanel = row as StackPanel;\r\n for (const key of stackPanel.children) {\r\n if (key.getClassName() === \"Button\" && key.name) {\r\n key.onPointerUpObservable.add(() => {\r\n this.onKeyPressObservable.notifyObservers(key.name as string);\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.VirtualKeyboard\", VirtualKeyboard);\r\n"]}
1
+ {"version":3,"file":"virtualKeyboard.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/virtualKeyboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,cAAc;CAiB1B;AAQD;;GAE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,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAChD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC7B,IAAI,GAAG,CAAC,YAAY,EAAE,KAAK,YAAY,EAAE;gBACrC,MAAM,UAAU,GAAG,GAAiB,CAAC;gBACrC,KAAK,MAAM,GAAG,IAAI,UAAU,CAAC,QAAQ,EAAE;oBACnC,IAAI,GAAG,CAAC,YAAY,EAAE,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE;wBAC7C,GAAG,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,EAAE;4BAC/B,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,GAAG,CAAC,IAAc,CAAC,CAAC;wBAClE,CAAC,CAAC,CAAC;qBACN;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { Button } from \"./button\";\r\nimport type { Container } from \"./container\";\r\nimport type { TextBlock } from \"./textBlock\";\r\nimport type { InputText } from \"./inputText\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport { InputTextArea } from \"./inputTextArea\";\r\n\r\n/**\r\n * Class used to store key control properties\r\n */\r\nexport class KeyPropertySet {\r\n /** Width */\r\n width?: string;\r\n /** Height */\r\n height?: string;\r\n /** Left padding */\r\n paddingLeft?: string;\r\n /** Right padding */\r\n paddingRight?: string;\r\n /** Top padding */\r\n paddingTop?: string;\r\n /** Bottom padding */\r\n paddingBottom?: string;\r\n /** Foreground color */\r\n color?: string;\r\n /** Background color */\r\n background?: string;\r\n}\r\n\r\ntype ConnectedInputText = {\r\n input: InputText;\r\n onFocusObserver: Nullable<Observer<InputText>>;\r\n onBlurObserver: Nullable<Observer<InputText>>;\r\n};\r\n\r\n/**\r\n * Class used to create virtual keyboard\r\n */\r\nexport class VirtualKeyboard extends StackPanel {\r\n /** Observable raised when a key is pressed */\r\n public onKeyPressObservable = new Observable<string>();\r\n\r\n /** Gets or sets default key button width */\r\n public defaultButtonWidth = \"40px\";\r\n /** Gets or sets default key button height */\r\n public defaultButtonHeight = \"40px\";\r\n\r\n /** Gets or sets default key button left padding */\r\n public defaultButtonPaddingLeft = \"2px\";\r\n /** Gets or sets default key button right padding */\r\n public defaultButtonPaddingRight = \"2px\";\r\n /** Gets or sets default key button top padding */\r\n public defaultButtonPaddingTop = \"2px\";\r\n /** Gets or sets default key button bottom padding */\r\n public defaultButtonPaddingBottom = \"2px\";\r\n\r\n /** Gets or sets default key button foreground color */\r\n public defaultButtonColor = \"#DDD\";\r\n /** Gets or sets default key button background color */\r\n public defaultButtonBackground = \"#070707\";\r\n\r\n /** Gets or sets shift button foreground color */\r\n public shiftButtonColor = \"#7799FF\";\r\n /** Gets or sets shift button thickness*/\r\n public selectedShiftThickness = 1;\r\n\r\n /** Gets shift key state */\r\n public shiftState = 0;\r\n\r\n protected override _getTypeName(): string {\r\n return \"VirtualKeyboard\";\r\n }\r\n\r\n private _createKey(key: string, propertySet: Nullable<KeyPropertySet>) {\r\n const button = Button.CreateSimpleButton(key, key);\r\n\r\n button.width = propertySet && propertySet.width ? propertySet.width : this.defaultButtonWidth;\r\n button.height = propertySet && propertySet.height ? propertySet.height : this.defaultButtonHeight;\r\n button.color = propertySet && propertySet.color ? propertySet.color : this.defaultButtonColor;\r\n button.background = propertySet && propertySet.background ? propertySet.background : this.defaultButtonBackground;\r\n button.paddingLeft = propertySet && propertySet.paddingLeft ? propertySet.paddingLeft : this.defaultButtonPaddingLeft;\r\n button.paddingRight = propertySet && propertySet.paddingRight ? propertySet.paddingRight : this.defaultButtonPaddingRight;\r\n button.paddingTop = propertySet && propertySet.paddingTop ? propertySet.paddingTop : this.defaultButtonPaddingTop;\r\n button.paddingBottom = propertySet && propertySet.paddingBottom ? propertySet.paddingBottom : this.defaultButtonPaddingBottom;\r\n\r\n button.thickness = 0;\r\n button.isFocusInvisible = true;\r\n\r\n button.shadowColor = this.shadowColor;\r\n button.shadowBlur = this.shadowBlur;\r\n button.shadowOffsetX = this.shadowOffsetX;\r\n button.shadowOffsetY = this.shadowOffsetY;\r\n\r\n button.onPointerUpObservable.add(() => {\r\n this.onKeyPressObservable.notifyObservers(key);\r\n });\r\n\r\n return button;\r\n }\r\n\r\n /**\r\n * Adds a new row of keys\r\n * @param keys defines the list of keys to add\r\n * @param propertySets defines the associated property sets\r\n */\r\n public addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void {\r\n const panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.isFocusInvisible = true;\r\n\r\n let maxKey: Nullable<Button> = null;\r\n for (let i = 0; i < keys.length; i++) {\r\n let properties = null;\r\n\r\n if (propertySets && propertySets.length === keys.length) {\r\n properties = propertySets[i];\r\n }\r\n\r\n const key = this._createKey(keys[i], properties);\r\n if (!maxKey || key.heightInPixels > maxKey.heightInPixels) {\r\n maxKey = key;\r\n }\r\n\r\n panel.addControl(key);\r\n }\r\n\r\n panel.height = maxKey ? maxKey.height : this.defaultButtonHeight;\r\n\r\n this.addControl(panel);\r\n }\r\n\r\n /**\r\n * Set the shift key to a specific state\r\n * @param shiftState defines the new shift state\r\n */\r\n public applyShiftState(shiftState: number): void {\r\n if (!this.children) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < this.children.length; i++) {\r\n const row = this.children[i];\r\n if (!row || !(<Container>row).children) {\r\n continue;\r\n }\r\n\r\n const rowContainer = <Container>row;\r\n for (let j = 0; j < rowContainer.children.length; j++) {\r\n const button = rowContainer.children[j] as Button;\r\n\r\n if (!button || !button.children[0]) {\r\n continue;\r\n }\r\n\r\n const button_tblock = button.children[0] as TextBlock;\r\n\r\n if (button_tblock.text === \"\\u21E7\") {\r\n button.color = shiftState ? this.shiftButtonColor : this.defaultButtonColor;\r\n button.thickness = shiftState > 1 ? this.selectedShiftThickness : 0;\r\n }\r\n\r\n button_tblock.text = shiftState > 0 ? button_tblock.text.toUpperCase() : button_tblock.text.toLowerCase();\r\n }\r\n }\r\n }\r\n\r\n private _currentlyConnectedInputText: Nullable<InputText | InputTextArea> = null;\r\n private _connectedInputTexts: ConnectedInputText[] = [];\r\n private _onKeyPressObserver: Nullable<Observer<string>> = null;\r\n\r\n /** Gets the input text control currently attached to the keyboard */\r\n public get connectedInputText(): Nullable<InputText | InputTextArea> {\r\n return this._currentlyConnectedInputText;\r\n }\r\n\r\n /**\r\n * Connects the keyboard with an input text control\r\n *\r\n * @param input defines the target control\r\n */\r\n public connect(input: InputText): void {\r\n const inputTextAlreadyConnected = this._connectedInputTexts.some((a) => a.input === input);\r\n if (inputTextAlreadyConnected) {\r\n return;\r\n }\r\n\r\n if (this._onKeyPressObserver === null) {\r\n this._onKeyPressObserver = this.onKeyPressObservable.add((key) => {\r\n if (!this._currentlyConnectedInputText) {\r\n return;\r\n }\r\n\r\n this._currentlyConnectedInputText._host.focusedControl = this._currentlyConnectedInputText;\r\n\r\n switch (key) {\r\n case \"\\u21E7\":\r\n this.shiftState++;\r\n if (this.shiftState > 2) {\r\n this.shiftState = 0;\r\n }\r\n this.applyShiftState(this.shiftState);\r\n return;\r\n case \"\\u2190\":\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"Backspace\");\r\n } else {\r\n this._currentlyConnectedInputText.processKey(8);\r\n }\r\n return;\r\n case \"\\u21B5\":\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"Enter\");\r\n } else {\r\n this._currentlyConnectedInputText.processKey(13);\r\n }\r\n return;\r\n }\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"\", this.shiftState ? key.toUpperCase() : key);\r\n } else {\r\n this._currentlyConnectedInputText.processKey(-1, this.shiftState ? key.toUpperCase() : key);\r\n }\r\n\r\n if (this.shiftState === 1) {\r\n this.shiftState = 0;\r\n this.applyShiftState(this.shiftState);\r\n }\r\n });\r\n }\r\n\r\n this.isVisible = false;\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n\r\n // Events hooking\r\n const onFocusObserver: Nullable<Observer<InputText>> = input.onFocusObservable.add(() => {\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n this.isVisible = true;\r\n });\r\n\r\n const onBlurObserver: Nullable<Observer<InputText>> = input.onBlurObservable.add(() => {\r\n input._connectedVirtualKeyboard = null;\r\n this._currentlyConnectedInputText = null;\r\n this.isVisible = false;\r\n });\r\n\r\n this._connectedInputTexts.push({\r\n input,\r\n onBlurObserver,\r\n onFocusObserver,\r\n });\r\n }\r\n\r\n /**\r\n * Disconnects the keyboard from connected InputText controls\r\n *\r\n * @param input optionally defines a target control, otherwise all are disconnected\r\n */\r\n public disconnect(input?: InputText): void {\r\n if (input) {\r\n // .find not available on IE\r\n const filtered = this._connectedInputTexts.filter((a) => a.input === input);\r\n if (filtered.length === 1) {\r\n this._removeConnectedInputObservables(filtered[0]);\r\n\r\n this._connectedInputTexts = this._connectedInputTexts.filter((a) => a.input !== input);\r\n if (this._currentlyConnectedInputText === input) {\r\n this._currentlyConnectedInputText = null;\r\n }\r\n }\r\n } else {\r\n this._connectedInputTexts.forEach((connectedInputText: ConnectedInputText) => {\r\n this._removeConnectedInputObservables(connectedInputText);\r\n });\r\n this._connectedInputTexts.length = 0;\r\n }\r\n\r\n if (this._connectedInputTexts.length === 0) {\r\n this._currentlyConnectedInputText = null;\r\n this.onKeyPressObservable.remove(this._onKeyPressObserver);\r\n this._onKeyPressObserver = null;\r\n }\r\n }\r\n\r\n private _removeConnectedInputObservables(connectedInputText: ConnectedInputText): void {\r\n connectedInputText.input._connectedVirtualKeyboard = null;\r\n connectedInputText.input.onFocusObservable.remove(connectedInputText.onFocusObserver);\r\n connectedInputText.input.onBlurObservable.remove(connectedInputText.onBlurObserver);\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public override dispose(): void {\r\n super.dispose();\r\n\r\n this.disconnect();\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Creates a new keyboard using a default layout\r\n *\r\n * @param name defines control name\r\n * @returns a new VirtualKeyboard\r\n */\r\n public static CreateDefaultLayout(name?: string): VirtualKeyboard {\r\n const returnValue = new VirtualKeyboard(name);\r\n\r\n returnValue.addKeysRow([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\", \"\\u2190\"]);\r\n returnValue.addKeysRow([\"q\", \"w\", \"e\", \"r\", \"t\", \"y\", \"u\", \"i\", \"o\", \"p\"]);\r\n returnValue.addKeysRow([\"a\", \"s\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \";\", \"'\", \"\\u21B5\"]);\r\n returnValue.addKeysRow([\"\\u21E7\", \"z\", \"x\", \"c\", \"v\", \"b\", \"n\", \"m\", \",\", \".\", \"/\"]);\r\n returnValue.addKeysRow([\" \"], [{ width: \"200px\" }]);\r\n\r\n return returnValue;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n for (const row of this.children) {\r\n if (row.getClassName() === \"StackPanel\") {\r\n const stackPanel = row as StackPanel;\r\n for (const key of stackPanel.children) {\r\n if (key.getClassName() === \"Button\" && key.name) {\r\n key.onPointerUpObservable.add(() => {\r\n this.onKeyPressObservable.notifyObservers(key.name as string);\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.VirtualKeyboard\", VirtualKeyboard);\r\n"]}