@babylonjs/gui 7.34.3 → 7.35.0
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/FrameGraph/guiTask.js.map +1 -1
- package/2D/FrameGraph/renderGraphGUIBlock.js.map +1 -1
- package/2D/adtInstrumentation.js.map +1 -1
- package/2D/advancedDynamicTexture.d.ts +1 -1
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/gradient/BaseGradient.js.map +1 -1
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/selector.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/statics.js.map +1 -1
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textWrapper.js.map +1 -1
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/math2D.js.map +1 -1
- package/2D/measure.js.map +1 -1
- package/2D/multiLinePoint.js.map +1 -1
- package/2D/style.js.map +1 -1
- package/2D/valueAndUnit.js.map +1 -1
- package/2D/xmlLoader.js.map +1 -1
- package/3D/behaviors/defaultBehavior.js.map +1 -1
- package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/contentDisplay3D.js.map +1 -1
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/cylinderPanel.js.map +1 -1
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/meshButton3D.js.map +1 -1
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/planePanel.js.map +1 -1
- package/3D/controls/scatterPanel.js.map +1 -1
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/spherePanel.js.map +1 -1
- package/3D/controls/stackPanel3D.js.map +1 -1
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/controls/touchMeshButton3D.js.map +1 -1
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.js.map +1 -1
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/gui3DManager.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/legacy/legacy.js.map +1 -1
- 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,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,CAAC;IAC7B,CAAC;IAED,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;YAC7B,OAAO;SACV;QAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED,oCAAoC;IAEpC,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QAC/B,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,uCAAuC;IACvC,IAA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AA4B;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;AA7QG;IADC,SAAS,EAAE;6CAGX;AAaD;IADC,SAAS,EAAE;yCAGX;AAaD;IADC,SAAS,EAAE;wCAGX;AA2BD;IADC,SAAS,EAAE;wCAGX;AAaD;IADC,SAAS,EAAE;2CAGX;AAkML,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 radius = Math.max(0, radius);\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
|
+
{"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,EA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AAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,mBAAmB,CAAC,kBAAkB,GAAG,EAAE,CAAC;YAC5C,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;QAC9E,CAAC;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,CAAC;YACtC,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;QACxE,CAAC;IACL,CAAC;CACJ;AA7QG;IADC,SAAS,EAAE;6CAGX;AAaD;IADC,SAAS,EAAE;yCAGX;AAaD;IADC,SAAS,EAAE;wCAGX;AA2BD;IADC,SAAS,EAAE;wCAGX;AAaD;IADC,SAAS,EAAE;2CAGX;AAkML,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 radius = Math.max(0, radius);\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);\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,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
|
+
{"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,CAAC;YAC7B,OAAO;QACX,CAAC;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,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED;;;OAGG;IAEH,IAAoB,KAAK,CAAC,KAAsB;QAC5C,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QA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AAC;gBACjB,CAAC;YACL,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACtE,CAAC;IAED;;;;OAIG;IACa,SAAS,CAAC,mBAAwB,EAAE,KAAc;QAC9D,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,EAAE,CAAC;YACjC,OAAO;QACX,CAAC;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":"statics.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/statics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,MAAM,IAAI,GAAG,SAAS,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB;;;;;;;;;GASG;AACH,OAAO,CAAC,SAAS,GAAG,UAAU,OAAgB,EAAE,IAAY,EAAE,IAAqB,EAAE,OAAyD;IAC1I,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CA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AAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IACnE,IAAI,YAAY,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IACxB,CAAC;SAAM,CAAC;QACJ,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IACzB,CAAC;IAED,IAAI,YAAY,EAAE,CAAC;QACf,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1B,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzB,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;IAC/B,CAAC;SAAM,CAAC;QACJ,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzB,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1B,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,MAAM,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC7C,MAAM,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAE7C,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\n\r\n/**\r\n * Forcing an export so that this code will execute\r\n * @internal\r\n */\r\nconst name = \"Statics\";\r\n\r\nexport { name };\r\n\r\n/**\r\n * Creates a stack panel that can be used to render headers\r\n * @param control defines the control to associate with the header\r\n * @param text defines the text of the header\r\n * @param size defines the size of the header\r\n * @param options defines options used to configure the header\r\n * @param options.isHorizontal\r\n * @param options.controlFirst\r\n * @returns a new StackPanel\r\n */\r\nControl.AddHeader = function (control: Control, text: string, size: string | number, options: { isHorizontal: boolean; controlFirst: boolean }): StackPanel {\r\n const panel = new StackPanel(\"panel\");\r\n const isHorizontal = options ? options.isHorizontal : true;\r\n const controlFirst = options ? options.controlFirst : true;\r\n\r\n panel.isVertical = !isHorizontal;\r\n\r\n const header = new TextBlock(\"header\");\r\n header.text = text;\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n if (isHorizontal) {\r\n header.width = size;\r\n } else {\r\n header.height = size;\r\n }\r\n\r\n if (controlFirst) {\r\n panel.addControl(control);\r\n panel.addControl(header);\r\n header.paddingLeft = \"5px\";\r\n } else {\r\n panel.addControl(header);\r\n panel.addControl(control);\r\n header.paddingRight = \"5px\";\r\n }\r\n\r\n header.shadowBlur = control.shadowBlur;\r\n header.shadowColor = control.shadowColor;\r\n header.shadowOffsetX = control.shadowOffsetX;\r\n header.shadowOffsetY = control.shadowOffsetY;\r\n\r\n return panel;\r\n};\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,IAAkB,YAyBjB;AAzBD,WAAkB,YAAY;IAC1B;;OAEG;IACH,+CAAQ,CAAA;IAER;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uEAAoB,CAAA;IAEpB;;OAEG;IACH,+CAAQ,CAAA;AACZ,CAAC,EAzBiB,YAAY,KAAZ,YAAY,QAyB7B;AAED;;G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,OAAO;QACZ,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC7B,CAAC;CACJ;AA/oBG;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;AAkaL,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 const 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 = 3,\r\n\r\n /**\r\n * Use HTML to wrap the text. This is the only mode that supports east-asian languages.\r\n */\r\n HTML = 4,\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 * This function will be called when a new HTML element is generated to be used for word wrapping.\r\n * This is only used when wrapping mode HTML is selected.\r\n * Using this function you can adjust word-break, overflow-wrap, hyphens, or any other CSS properties of the HTML element, language-dependent.\r\n */\r\n public adjustWordWrappingHTMLElement: Nullable<(element: HTMLElement) => void>;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the HTML element generated for word wrapping should be reused or removed after each wrapping.\r\n */\r\n public reuseHTMLForWordWrapping: boolean = false;\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, this._host.getScene()?.getEngine());\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._textWrapping === TextWrapping.HTML ? this._parseHTMLText(refWidth, refHeight, context) : this.text.split(\"\\n\");\r\n\r\n switch (this._textWrapping) {\r\n case TextWrapping.WordWrap:\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrap(_line, refWidth, context));\r\n }\r\n break;\r\n case TextWrapping.Ellipsis:\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLineEllipsis(_line, refWidth, context));\r\n }\r\n break;\r\n case TextWrapping.WordWrapEllipsis:\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrapEllipsis(_line, refWidth, refHeight, context));\r\n }\r\n break;\r\n case TextWrapping.HTML:\r\n default:\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLine(_line, context));\r\n }\r\n break;\r\n }\r\n\r\n return this._linesTemp;\r\n }\r\n\r\n private _htmlElement: Nullable<HTMLElement> = null;\r\n\r\n protected _parseHTMLText(refWidth: number, refHeight: number, context: ICanvasRenderingContext): string[] {\r\n const lines = [] as string[];\r\n if (!this._htmlElement) {\r\n this._htmlElement = document.createElement(\"div\");\r\n document.body.appendChild(this._htmlElement);\r\n }\r\n const htmlElement = this._htmlElement;\r\n htmlElement.textContent = this.text;\r\n htmlElement.style.font = context.font;\r\n htmlElement.style.position = \"absolute\";\r\n htmlElement.style.visibility = \"hidden\";\r\n htmlElement.style.top = \"-1000px\";\r\n htmlElement.style.left = \"-1000px\";\r\n this.adjustWordWrappingHTMLElement?.(htmlElement);\r\n htmlElement.style.width = refWidth + \"px\";\r\n htmlElement.style.height = refHeight + \"px\";\r\n const textContent = htmlElement.textContent;\r\n if (!textContent) {\r\n return lines;\r\n }\r\n // get the text node\r\n const textNode = htmlElement.childNodes[0];\r\n const range = document.createRange();\r\n let idx = 0;\r\n for (const c of textContent) {\r\n range.setStart(textNode, 0);\r\n range.setEnd(textNode, idx + 1);\r\n // \"select\" text from beginning to this position to determine the line\r\n const lineIndex = range.getClientRects().length - 1;\r\n lines[lineIndex] = (lines[lineIndex] || \"\") + c;\r\n idx++;\r\n }\r\n\r\n if (!this.reuseHTMLForWordWrapping) {\r\n htmlElement.remove();\r\n this._htmlElement = null;\r\n }\r\n\r\n return lines;\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, this._host.getScene()?.getEngine());\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 this._htmlElement?.remove();\r\n this._htmlElement = null;\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,IAAkB,YAyBjB;AAzBD,WAAkB,YAAY;IAC1B;;OAEG;IACH,+CAAQ,CAAA;IAER;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uEAAoB,CAAA;IAEpB;;OAEG;IACH,+CAAQ,CAAA;AACZ,CAAC,EAzBiB,YAAY,KAAZ,YAAY,QAyB7B;AAED;;GAE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AE;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;AAkaL,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 const 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 = 3,\r\n\r\n /**\r\n * Use HTML to wrap the text. This is the only mode that supports east-asian languages.\r\n */\r\n HTML = 4,\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 * This function will be called when a new HTML element is generated to be used for word wrapping.\r\n * This is only used when wrapping mode HTML is selected.\r\n * Using this function you can adjust word-break, overflow-wrap, hyphens, or any other CSS properties of the HTML element, language-dependent.\r\n */\r\n public adjustWordWrappingHTMLElement: Nullable<(element: HTMLElement) => void>;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the HTML element generated for word wrapping should be reused or removed after each wrapping.\r\n */\r\n public reuseHTMLForWordWrapping: boolean = false;\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, this._host.getScene()?.getEngine());\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._textWrapping === TextWrapping.HTML ? this._parseHTMLText(refWidth, refHeight, context) : this.text.split(\"\\n\");\r\n\r\n switch (this._textWrapping) {\r\n case TextWrapping.WordWrap:\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrap(_line, refWidth, context));\r\n }\r\n break;\r\n case TextWrapping.Ellipsis:\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLineEllipsis(_line, refWidth, context));\r\n }\r\n break;\r\n case TextWrapping.WordWrapEllipsis:\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrapEllipsis(_line, refWidth, refHeight, context));\r\n }\r\n break;\r\n case TextWrapping.HTML:\r\n default:\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLine(_line, context));\r\n }\r\n break;\r\n }\r\n\r\n return this._linesTemp;\r\n }\r\n\r\n private _htmlElement: Nullable<HTMLElement> = null;\r\n\r\n protected _parseHTMLText(refWidth: number, refHeight: number, context: ICanvasRenderingContext): string[] {\r\n const lines = [] as string[];\r\n if (!this._htmlElement) {\r\n this._htmlElement = document.createElement(\"div\");\r\n document.body.appendChild(this._htmlElement);\r\n }\r\n const htmlElement = this._htmlElement;\r\n htmlElement.textContent = this.text;\r\n htmlElement.style.font = context.font;\r\n htmlElement.style.position = \"absolute\";\r\n htmlElement.style.visibility = \"hidden\";\r\n htmlElement.style.top = \"-1000px\";\r\n htmlElement.style.left = \"-1000px\";\r\n this.adjustWordWrappingHTMLElement?.(htmlElement);\r\n htmlElement.style.width = refWidth + \"px\";\r\n htmlElement.style.height = refHeight + \"px\";\r\n const textContent = htmlElement.textContent;\r\n if (!textContent) {\r\n return lines;\r\n }\r\n // get the text node\r\n const textNode = htmlElement.childNodes[0];\r\n const range = document.createRange();\r\n let idx = 0;\r\n for (const c of textContent) {\r\n range.setStart(textNode, 0);\r\n range.setEnd(textNode, idx + 1);\r\n // \"select\" text from beginning to this position to determine the line\r\n const lineIndex = range.getClientRects().length - 1;\r\n lines[lineIndex] = (lines[lineIndex] || \"\") + c;\r\n idx++;\r\n }\r\n\r\n if (!this.reuseHTMLForWordWrapping) {\r\n htmlElement.remove();\r\n this._htmlElement = null;\r\n }\r\n\r\n return lines;\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, this._host.getScene()?.getEngine());\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 this._htmlElement?.remove();\r\n this._htmlElement = null;\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.TextBlock\", TextBlock);\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"textWrapper.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/textWrapper.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,MAAM,OAAO,WAAW;IAIpB,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACrE,CAAC;IAED,IAAW,IAAI,CAAC,GAAW;QACvB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC1E,CAAC;IAEM,UAAU,CAAC,QAAgB,EAAE,MAAc,EAAE,SAAkB;QAClE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACrG,IAAI,IAAI,CAAC,WAAW,EAAE;
|
1
|
+
{"version":3,"file":"textWrapper.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/textWrapper.ts"],"names":[],"mappings":"AAAA,gBAAgB;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AAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7G,CAAC;CACJ","sourcesContent":["/** @internal */\r\nexport class TextWrapper {\r\n private _text: string;\r\n private _characters: string[] | undefined;\r\n\r\n public get text(): string {\r\n return this._characters ? this._characters.join(\"\") : this._text;\r\n }\r\n\r\n public set text(txt: string) {\r\n this._text = txt;\r\n this._characters = Array.from && Array.from(txt);\r\n }\r\n\r\n public get length(): number {\r\n return this._characters ? this._characters.length : this._text.length;\r\n }\r\n\r\n public removePart(idxStart: number, idxEnd: number, insertTxt?: string): void {\r\n this._text = this._text.slice(0, idxStart) + (insertTxt ? insertTxt : \"\") + this._text.slice(idxEnd);\r\n if (this._characters) {\r\n const newCharacters = insertTxt ? Array.from(insertTxt) : [];\r\n this._characters.splice(idxStart, idxEnd - idxStart, ...newCharacters);\r\n }\r\n }\r\n\r\n public charAt(idx: number): string {\r\n return this._characters ? this._characters[idx] : this._text.charAt(idx);\r\n }\r\n\r\n public substr(from: number, length?: number): string {\r\n if (this._characters) {\r\n if (isNaN(from)) {\r\n from = 0;\r\n } else if (from >= 0) {\r\n from = Math.min(from, this._characters.length);\r\n } else {\r\n from = this._characters.length + Math.max(from, -this._characters.length);\r\n }\r\n if (length === undefined) {\r\n length = this._characters.length - from;\r\n } else if (isNaN(length)) {\r\n length = 0;\r\n } else if (length < 0) {\r\n length = 0;\r\n }\r\n const temp = [];\r\n while (--length >= 0) {\r\n temp[length] = this._characters[from + length];\r\n }\r\n return temp.join(\"\");\r\n }\r\n\r\n return this._text.substring(from, length ? length + from : undefined);\r\n }\r\n\r\n public substring(from: number, to?: number): string {\r\n if (this._characters) {\r\n if (isNaN(from)) {\r\n from = 0;\r\n } else if (from > this._characters.length) {\r\n from = this._characters.length;\r\n } else if (from < 0) {\r\n from = 0;\r\n }\r\n if (to === undefined) {\r\n to = this._characters.length;\r\n } else if (isNaN(to)) {\r\n to = 0;\r\n } else if (to > this._characters.length) {\r\n to = this._characters.length;\r\n } else if (to < 0) {\r\n to = 0;\r\n }\r\n const temp = [];\r\n let idx = 0;\r\n while (from < to) {\r\n temp[idx++] = this._characters[from++];\r\n }\r\n return temp.join(\"\");\r\n }\r\n\r\n return this._text.substring(from, to);\r\n }\r\n\r\n public isWord(index: number): boolean {\r\n const rWord = /\\w/g;\r\n return this._characters ? this._characters[index].search(rWord) !== -1 : this._text.search(rWord) !== -1;\r\n }\r\n}\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,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;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ED,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,IAAI,IAAI,CAAC,0BAA0B,EAAE;gBACjC,IAAI,CAAC,0BAA0B,EAAE,CAAC;aACrC;SACJ;aAAM;YACH,IAAI,IAAI,CAAC,4BAA4B,EAAE;gBACnC,IAAI,CAAC,4BAA4B,EAAE,CAAC;aACvC;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACa,YAAY,CAAC,MAAe,EAAE,WAAoB,EAAE,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
|
+
{"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;IAC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,CAAC,UAAU,EAAE,CAAC;YACnB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;oBAChC,IAAI,CAAC,wBAAwB,EAAE,CAAC;gBACpC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACJ,IAAI,IAAI,CAAC,0BAA0B,EAAE,CAAC;oBAClC,IAAI,CAAC,0BAA0B,EAAE,CAAC;gBACtC,CAAC;YACL,CAAC;QACL,CAAC;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"]}
|