@babylonjs/gui 7.12.0 → 7.13.1
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/advancedDynamicTexture.d.ts +9 -4
- package/2D/advancedDynamicTexture.js +44 -0
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/control.d.ts +53 -1
- package/2D/controls/control.js +88 -0
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/focusableButton.d.ts +0 -37
- package/2D/controls/focusableButton.js +0 -65
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/focusableControl.d.ts +9 -0
- package/2D/controls/focusableControl.js.map +1 -1
- package/2D/controls/inputText.d.ts +1 -19
- package/2D/controls/inputText.js +2 -27
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/textBlock.d.ts +1 -1
- package/2D/controls/textBlock.js +5 -5
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/3D/controls/cylinderPanel.js +2 -2
- package/3D/controls/cylinderPanel.js.map +1 -1
- package/3D/controls/holographicSlate.js +2 -2
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/spherePanel.js +2 -2
- package/3D/controls/spherePanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.d.ts +1 -1
- package/3D/gizmos/gizmoHandle.js +7 -7
- package/3D/gizmos/gizmoHandle.js.map +1 -1
- package/package.json +2 -2
@@ -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,MA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IADC,SAAS,EAAE;0CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAiBD;IADC,SAAS,EAAE;wDAGX;AAcD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAmBD;IADC,SAAS,EAAE;iDAGX;AA+WL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Measure } from \"../measure\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext, ITextMetrics } from \"core/Engines/ICanvas\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\n\r\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nexport enum TextWrapping {\r\n /**\r\n * Clip the text when it's larger than Control.width; this is the default mode.\r\n */\r\n Clip = 0,\r\n\r\n /**\r\n * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.\r\n */\r\n WordWrap = 1,\r\n\r\n /**\r\n * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.\r\n */\r\n Ellipsis = 2,\r\n\r\n /**\r\n * Wrap the text word-wise and clip the text when the text's height is larger than the Control.height, and shrink the last line with trailing … .\r\n */\r\n WordWrapEllipsis,\r\n}\r\n\r\n/**\r\n * Class used to create text block control\r\n */\r\nexport class TextBlock extends Control {\r\n private _text = \"\";\r\n private _textWrapping = TextWrapping.Clip;\r\n private _textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n private _textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n\r\n private _lines: any[];\r\n private _resizeToFit: boolean = false;\r\n private _lineSpacing: ValueAndUnit = new ValueAndUnit(0);\r\n private _outlineWidth: number = 0;\r\n private _outlineColor: string = \"white\";\r\n private _underline: boolean = false;\r\n private _lineThrough: boolean = false;\r\n private _wordDivider: string = \" \";\r\n private _forceResizeWidth: boolean = false;\r\n private _applyOutlineToUnderline: boolean = false;\r\n\r\n /**\r\n * An event triggered after the text is changed\r\n */\r\n public onTextChangedObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * An event triggered after the text was broken up into lines\r\n */\r\n public onLinesReadyObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * Function used to split a string into words. By default, a string is split at each space character found\r\n */\r\n public wordSplittingFunction: Nullable<(line: string) => string[]>;\r\n\r\n /**\r\n * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)\r\n */\r\n public get lines(): any[] {\r\n return this._lines;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n @serialize()\r\n public get resizeToFit(): boolean {\r\n return this._resizeToFit;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n public set resizeToFit(value: boolean) {\r\n if (this._resizeToFit === value) {\r\n return;\r\n }\r\n this._resizeToFit = value;\r\n\r\n if (this._resizeToFit) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n @serialize()\r\n public get textWrapping(): TextWrapping | boolean {\r\n return this._textWrapping;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n public set textWrapping(value: TextWrapping | boolean) {\r\n if (this._textWrapping === value) {\r\n return;\r\n }\r\n this._textWrapping = +value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n @serialize()\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n this._text = value + \"\"; // Making sure it is a text\r\n this._markAsDirty();\r\n\r\n this.onTextChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textHorizontalAlignment(): number {\r\n return this._textHorizontalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textHorizontalAlignment(value: number) {\r\n if (this._textHorizontalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textHorizontalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textVerticalAlignment(): number {\r\n return this._textVerticalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textVerticalAlignment(value: number) {\r\n if (this._textVerticalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textVerticalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n @serialize()\r\n public set lineSpacing(value: string | number) {\r\n if (this._lineSpacing.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n public get lineSpacing(): string | number {\r\n return this._lineSpacing.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n @serialize()\r\n public get outlineWidth(): number {\r\n return this._outlineWidth;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n public set outlineWidth(value: number) {\r\n if (this._outlineWidth === value) {\r\n return;\r\n }\r\n this._outlineWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n @serialize()\r\n public get underline(): boolean {\r\n return this._underline;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n public set underline(value: boolean) {\r\n if (this._underline === value) {\r\n return;\r\n }\r\n this._underline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n @serialize()\r\n public get lineThrough(): boolean {\r\n return this._lineThrough;\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n public set lineThrough(value: boolean) {\r\n if (this._lineThrough === value) {\r\n return;\r\n }\r\n this._lineThrough = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * If the outline should be applied to the underline/strike-through too. Has different behavior in Edge/Chrome vs Firefox.\r\n */\r\n @serialize()\r\n public get applyOutlineToUnderline(): boolean {\r\n return this._applyOutlineToUnderline;\r\n }\r\n\r\n public set applyOutlineToUnderline(value: boolean) {\r\n if (this._applyOutlineToUnderline === value) {\r\n return;\r\n }\r\n this._applyOutlineToUnderline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n @serialize()\r\n public get outlineColor(): string {\r\n return this._outlineColor;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n public set outlineColor(value: string) {\r\n if (this._outlineColor === value) {\r\n return;\r\n }\r\n this._outlineColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n @serialize()\r\n public get wordDivider(): string {\r\n return this._wordDivider;\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n public set wordDivider(value: string) {\r\n if (this._wordDivider === value) {\r\n return;\r\n }\r\n this._wordDivider = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * By default, if a text block has text wrapping other than Clip, its width\r\n * is not resized even if resizeToFit = true. This parameter forces the width\r\n * to be resized.\r\n */\r\n @serialize()\r\n public get forceResizeWidth(): boolean {\r\n return this._forceResizeWidth;\r\n }\r\n\r\n public set forceResizeWidth(value: boolean) {\r\n if (this._forceResizeWidth === value) {\r\n return;\r\n }\r\n this._forceResizeWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new TextBlock object\r\n * @param name defines the name of the control\r\n * @param text defines the text to display (empty string by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the control\r\n */\r\n public override name?: string,\r\n text: string = \"\"\r\n ) {\r\n super(name);\r\n\r\n this.text = text;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TextBlock\";\r\n }\r\n\r\n protected override _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || this.isDirty) {\r\n this._fontOffset = Control._GetFontOffset(context.font, 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.text.split(\"\\n\");\r\n\r\n if (this._textWrapping === TextWrapping.Ellipsis) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLineEllipsis(_line, refWidth, context));\r\n }\r\n } else if (this._textWrapping === TextWrapping.WordWrap) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrap(_line, refWidth, context));\r\n }\r\n } else if (this._textWrapping === TextWrapping.WordWrapEllipsis) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrapEllipsis(_line, refWidth, refHeight!, context));\r\n }\r\n } else {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLine(_line, context));\r\n }\r\n }\r\n\r\n return this._linesTemp;\r\n }\r\n\r\n protected _parseLine(line: string = \"\", context: ICanvasRenderingContext): object {\r\n return { text: line, width: this._getTextMetricsWidth(context.measureText(line)) };\r\n }\r\n\r\n //Calculate how many characters approximately we need to remove\r\n private _getCharsToRemove(lineWidth: number, width: number, lineLength: number) {\r\n const diff = lineWidth > width ? lineWidth - width : 0;\r\n // This isn't exact unless the font is monospaced\r\n const charWidth = lineWidth / lineLength;\r\n const removeChars = Math.max(Math.floor(diff / charWidth), 1);\r\n return removeChars;\r\n }\r\n\r\n protected _parseLineEllipsis(line: string = \"\", width: number, context: ICanvasRenderingContext): object {\r\n let lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n let removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n\r\n // unicode support. split('') does not work with unicode!\r\n // make sure Array.from is available\r\n const characters = Array.from && Array.from(line);\r\n if (!characters) {\r\n // no array.from, use the old method\r\n while (line.length > 2 && lineWidth > width) {\r\n line = line.slice(0, -removeChars);\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line + \"…\"));\r\n\r\n removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n }\r\n // Add on the end\r\n line += \"…\";\r\n } else {\r\n while (characters.length && lineWidth > width) {\r\n characters.splice(characters.length - removeChars, removeChars);\r\n line = `${characters.join(\"\")}…`;\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n }\r\n }\r\n\r\n return { text: line, width: lineWidth };\r\n }\r\n\r\n private _getTextMetricsWidth(textMetrics: ITextMetrics) {\r\n if (textMetrics.actualBoundingBoxLeft !== undefined) {\r\n return Math.abs(textMetrics.actualBoundingBoxLeft) + Math.abs(textMetrics.actualBoundingBoxRight);\r\n }\r\n return textMetrics.width;\r\n }\r\n\r\n protected _parseLineWordWrap(line: string = \"\", width: number, context: ICanvasRenderingContext): object[] {\r\n const lines = [];\r\n const words = this.wordSplittingFunction ? this.wordSplittingFunction(line) : line.split(this._wordDivider);\r\n let lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n for (let n = 0; n < words.length; n++) {\r\n const testLine = n > 0 ? line + this._wordDivider + words[n] : words[0];\r\n const testWidth = this._getTextMetricsWidth(context.measureText(testLine));\r\n if (testWidth > width && n > 0) {\r\n lines.push({ text: line, width: lineWidth });\r\n line = words[n];\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n } else {\r\n lineWidth = testWidth;\r\n line = testLine;\r\n }\r\n }\r\n lines.push({ text: line, width: lineWidth });\r\n\r\n return lines;\r\n }\r\n\r\n protected _parseLineWordWrapEllipsis(line: string = \"\", width: number, height: number, context: ICanvasRenderingContext): object[] {\r\n const lines = this._parseLineWordWrap(line, width, context);\r\n for (let n = 1; n <= lines.length; n++) {\r\n const currentHeight = this._computeHeightForLinesOf(n);\r\n if (currentHeight > height && n > 1) {\r\n const lastLine = lines[n - 2] as { text: string; width: number };\r\n const currentLine = lines[n - 1] as { text: string; width: number };\r\n lines[n - 2] = this._parseLineEllipsis(lastLine.text + this._wordDivider + currentLine.text, width, context);\r\n const linesToRemove = lines.length - n + 1;\r\n for (let i = 0; i < linesToRemove; i++) {\r\n lines.pop();\r\n }\r\n return lines;\r\n }\r\n }\r\n\r\n return lines;\r\n }\r\n\r\n protected _renderLines(context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || !this._lines) {\r\n return;\r\n }\r\n const height = this._currentMeasure.height;\r\n let rootY = 0;\r\n switch (this._textVerticalAlignment) {\r\n case Control.VERTICAL_ALIGNMENT_TOP:\r\n rootY = this._fontOffset.ascent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_BOTTOM:\r\n rootY = height - this._fontOffset.height * (this._lines.length - 1) - this._fontOffset.descent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_CENTER:\r\n rootY = this._fontOffset.ascent + (height - this._fontOffset.height * this._lines.length) / 2;\r\n break;\r\n }\r\n\r\n rootY += this._currentMeasure.top;\r\n\r\n for (let i = 0; i < this._lines.length; i++) {\r\n const line = this._lines[i];\r\n\r\n if (i !== 0 && this._lineSpacing.internalValue !== 0) {\r\n if (this._lineSpacing.isPixel) {\r\n rootY += this._lineSpacing.getValue(this._host);\r\n } else {\r\n rootY = rootY + this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n }\r\n\r\n this._drawText(line.text, line.width, rootY, context);\r\n rootY += this._fontOffset.height;\r\n }\r\n }\r\n\r\n private _computeHeightForLinesOf(lineCount: number): number {\r\n let newHeight = this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * lineCount;\r\n\r\n if (lineCount > 0 && this._lineSpacing.internalValue !== 0) {\r\n let lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n } else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n\r\n newHeight += (lineCount - 1) * lineSpacing;\r\n }\r\n\r\n return newHeight;\r\n }\r\n\r\n public override isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (this.resizeToFit) {\r\n return true;\r\n }\r\n return super.isDimensionFullyDefined(dim);\r\n }\r\n\r\n /**\r\n * Given a width constraint applied on the text block, find the expected height\r\n * @returns expected height\r\n */\r\n public computeExpectedHeight(): number {\r\n if (this.text && this.widthInPixels) {\r\n // Should abstract platform instead of using LastCreatedEngine\r\n const context = EngineStore.LastCreatedEngine?.createCanvas(0, 0).getContext(\"2d\");\r\n if (context) {\r\n this._applyStates(context);\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context.font, 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 }\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,YAoBjB;AApBD,WAAkB,YAAY;IAC1B;;OAEG;IACH,+CAAQ,CAAA;IAER;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,uEAAgB,CAAA;AACpB,CAAC,EApBiB,YAAY,KAAZ,YAAY,QAoB7B;AAED;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,OAAO;IAgClC;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IAEH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,IAAW,WAAW,CAAC,KAAc;QACjC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;YAC7B,OAAO;SACV;QACD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,qBAAqB,GAAG,IAAI,CAAC;YACzC,IAAI,CAAC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;SAC7C;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IA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CAAC;IAEQ,OAAO;QACZ,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;CACJ;AA5lBG;IADC,SAAS,EAAE;4CAGX;AAwBD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;qCAGX;AAmBD;IADC,SAAS,EAAE;wDAGX;AAkBD;IADC,SAAS,EAAE;sDAGX;AAkBD;IADC,SAAS,EAAE;4CAKX;AAaD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;0CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAiBD;IADC,SAAS,EAAE;wDAGX;AAcD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAmBD;IADC,SAAS,EAAE;iDAGX;AA+WL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Measure } from \"../measure\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext, ITextMetrics } from \"core/Engines/ICanvas\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\n\r\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nexport 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,\r\n}\r\n\r\n/**\r\n * Class used to create text block control\r\n */\r\nexport class TextBlock extends Control {\r\n private _text = \"\";\r\n private _textWrapping = TextWrapping.Clip;\r\n private _textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n private _textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n\r\n private _lines: any[];\r\n private _resizeToFit: boolean = false;\r\n private _lineSpacing: ValueAndUnit = new ValueAndUnit(0);\r\n private _outlineWidth: number = 0;\r\n private _outlineColor: string = \"white\";\r\n private _underline: boolean = false;\r\n private _lineThrough: boolean = false;\r\n private _wordDivider: string = \" \";\r\n private _forceResizeWidth: boolean = false;\r\n private _applyOutlineToUnderline: boolean = false;\r\n\r\n /**\r\n * An event triggered after the text is changed\r\n */\r\n public onTextChangedObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * An event triggered after the text was broken up into lines\r\n */\r\n public onLinesReadyObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * Function used to split a string into words. By default, a string is split at each space character found\r\n */\r\n public wordSplittingFunction: Nullable<(line: string) => string[]>;\r\n\r\n /**\r\n * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)\r\n */\r\n public get lines(): any[] {\r\n return this._lines;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n @serialize()\r\n public get resizeToFit(): boolean {\r\n return this._resizeToFit;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n public set resizeToFit(value: boolean) {\r\n if (this._resizeToFit === value) {\r\n return;\r\n }\r\n this._resizeToFit = value;\r\n\r\n if (this._resizeToFit) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n @serialize()\r\n public get textWrapping(): TextWrapping | boolean {\r\n return this._textWrapping;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n public set textWrapping(value: TextWrapping | boolean) {\r\n if (this._textWrapping === value) {\r\n return;\r\n }\r\n this._textWrapping = +value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n @serialize()\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n this._text = value + \"\"; // Making sure it is a text\r\n this._markAsDirty();\r\n\r\n this.onTextChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textHorizontalAlignment(): number {\r\n return this._textHorizontalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textHorizontalAlignment(value: number) {\r\n if (this._textHorizontalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textHorizontalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textVerticalAlignment(): number {\r\n return this._textVerticalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textVerticalAlignment(value: number) {\r\n if (this._textVerticalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textVerticalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n @serialize()\r\n public set lineSpacing(value: string | number) {\r\n if (this._lineSpacing.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n public get lineSpacing(): string | number {\r\n return this._lineSpacing.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n @serialize()\r\n public get outlineWidth(): number {\r\n return this._outlineWidth;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n public set outlineWidth(value: number) {\r\n if (this._outlineWidth === value) {\r\n return;\r\n }\r\n this._outlineWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n @serialize()\r\n public get underline(): boolean {\r\n return this._underline;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n public set underline(value: boolean) {\r\n if (this._underline === value) {\r\n return;\r\n }\r\n this._underline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n @serialize()\r\n public get lineThrough(): boolean {\r\n return this._lineThrough;\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n public set lineThrough(value: boolean) {\r\n if (this._lineThrough === value) {\r\n return;\r\n }\r\n this._lineThrough = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * If the outline should be applied to the underline/strike-through too. Has different behavior in Edge/Chrome vs Firefox.\r\n */\r\n @serialize()\r\n public get applyOutlineToUnderline(): boolean {\r\n return this._applyOutlineToUnderline;\r\n }\r\n\r\n public set applyOutlineToUnderline(value: boolean) {\r\n if (this._applyOutlineToUnderline === value) {\r\n return;\r\n }\r\n this._applyOutlineToUnderline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n @serialize()\r\n public get outlineColor(): string {\r\n return this._outlineColor;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n public set outlineColor(value: string) {\r\n if (this._outlineColor === value) {\r\n return;\r\n }\r\n this._outlineColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n @serialize()\r\n public get wordDivider(): string {\r\n return this._wordDivider;\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n public set wordDivider(value: string) {\r\n if (this._wordDivider === value) {\r\n return;\r\n }\r\n this._wordDivider = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * By default, if a text block has text wrapping other than Clip, its width\r\n * is not resized even if resizeToFit = true. This parameter forces the width\r\n * to be resized.\r\n */\r\n @serialize()\r\n public get forceResizeWidth(): boolean {\r\n return this._forceResizeWidth;\r\n }\r\n\r\n public set forceResizeWidth(value: boolean) {\r\n if (this._forceResizeWidth === value) {\r\n return;\r\n }\r\n this._forceResizeWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new TextBlock object\r\n * @param name defines the name of the control\r\n * @param text defines the text to display (empty string by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the control\r\n */\r\n public override name?: string,\r\n text: string = \"\"\r\n ) {\r\n super(name);\r\n\r\n this.text = text;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TextBlock\";\r\n }\r\n\r\n protected override _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || this.isDirty) {\r\n this._fontOffset = Control._GetFontOffset(context.font, 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.text.split(\"\\n\");\r\n\r\n if (this._textWrapping === TextWrapping.Ellipsis) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLineEllipsis(_line, refWidth, context));\r\n }\r\n } else if (this._textWrapping === TextWrapping.WordWrap) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrap(_line, refWidth, context));\r\n }\r\n } else if (this._textWrapping === TextWrapping.WordWrapEllipsis) {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(...this._parseLineWordWrapEllipsis(_line, refWidth, refHeight!, context));\r\n }\r\n } else {\r\n for (const _line of _lines) {\r\n this._linesTemp.push(this._parseLine(_line, context));\r\n }\r\n }\r\n\r\n return this._linesTemp;\r\n }\r\n\r\n protected _parseLine(line: string = \"\", context: ICanvasRenderingContext): object {\r\n return { text: line, width: this._getTextMetricsWidth(context.measureText(line)) };\r\n }\r\n\r\n //Calculate how many characters approximately we need to remove\r\n private _getCharsToRemove(lineWidth: number, width: number, lineLength: number) {\r\n const diff = lineWidth > width ? lineWidth - width : 0;\r\n // This isn't exact unless the font is monospaced\r\n const charWidth = lineWidth / lineLength;\r\n const removeChars = Math.max(Math.floor(diff / charWidth), 1);\r\n return removeChars;\r\n }\r\n\r\n protected _parseLineEllipsis(line: string = \"\", width: number, context: ICanvasRenderingContext): object {\r\n let lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n let removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n\r\n // unicode support. split('') does not work with unicode!\r\n // make sure Array.from is available\r\n const characters = Array.from && Array.from(line);\r\n if (!characters) {\r\n // no array.from, use the old method\r\n while (line.length > 2 && lineWidth > width) {\r\n line = line.slice(0, -removeChars);\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line + \"…\"));\r\n\r\n removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n }\r\n // Add on the end\r\n line += \"…\";\r\n } else {\r\n while (characters.length && lineWidth > width) {\r\n characters.splice(characters.length - removeChars, removeChars);\r\n line = `${characters.join(\"\")}…`;\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n removeChars = this._getCharsToRemove(lineWidth, width, line.length);\r\n }\r\n }\r\n\r\n return { text: line, width: lineWidth };\r\n }\r\n\r\n private _getTextMetricsWidth(textMetrics: ITextMetrics) {\r\n if (textMetrics.actualBoundingBoxLeft !== undefined) {\r\n return Math.abs(textMetrics.actualBoundingBoxLeft) + Math.abs(textMetrics.actualBoundingBoxRight);\r\n }\r\n return textMetrics.width;\r\n }\r\n\r\n protected _parseLineWordWrap(line: string = \"\", width: number, context: ICanvasRenderingContext): object[] {\r\n const lines = [];\r\n const words = this.wordSplittingFunction ? this.wordSplittingFunction(line) : line.split(this._wordDivider);\r\n let lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n\r\n for (let n = 0; n < words.length; n++) {\r\n const testLine = n > 0 ? line + this._wordDivider + words[n] : words[0];\r\n const testWidth = this._getTextMetricsWidth(context.measureText(testLine));\r\n if (testWidth > width && n > 0) {\r\n lines.push({ text: line, width: lineWidth });\r\n line = words[n];\r\n lineWidth = this._getTextMetricsWidth(context.measureText(line));\r\n } else {\r\n lineWidth = testWidth;\r\n line = testLine;\r\n }\r\n }\r\n lines.push({ text: line, width: lineWidth });\r\n\r\n return lines;\r\n }\r\n\r\n protected _parseLineWordWrapEllipsis(line: string = \"\", width: number, height: number, context: ICanvasRenderingContext): object[] {\r\n const lines = this._parseLineWordWrap(line, width, context);\r\n for (let n = 1; n <= lines.length; n++) {\r\n const currentHeight = this._computeHeightForLinesOf(n);\r\n if (currentHeight > height && n > 1) {\r\n const lastLine = lines[n - 2] as { text: string; width: number };\r\n const currentLine = lines[n - 1] as { text: string; width: number };\r\n lines[n - 2] = this._parseLineEllipsis(lastLine.text + this._wordDivider + currentLine.text, width, context);\r\n const linesToRemove = lines.length - n + 1;\r\n for (let i = 0; i < linesToRemove; i++) {\r\n lines.pop();\r\n }\r\n return lines;\r\n }\r\n }\r\n\r\n return lines;\r\n }\r\n\r\n protected _renderLines(context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || !this._lines) {\r\n return;\r\n }\r\n const height = this._currentMeasure.height;\r\n let rootY = 0;\r\n switch (this._textVerticalAlignment) {\r\n case Control.VERTICAL_ALIGNMENT_TOP:\r\n rootY = this._fontOffset.ascent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_BOTTOM:\r\n rootY = height - this._fontOffset.height * (this._lines.length - 1) - this._fontOffset.descent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_CENTER:\r\n rootY = this._fontOffset.ascent + (height - this._fontOffset.height * this._lines.length) / 2;\r\n break;\r\n }\r\n\r\n rootY += this._currentMeasure.top;\r\n\r\n for (let i = 0; i < this._lines.length; i++) {\r\n const line = this._lines[i];\r\n\r\n if (i !== 0 && this._lineSpacing.internalValue !== 0) {\r\n if (this._lineSpacing.isPixel) {\r\n rootY += this._lineSpacing.getValue(this._host);\r\n } else {\r\n rootY = rootY + this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n }\r\n\r\n this._drawText(line.text, line.width, rootY, context);\r\n rootY += this._fontOffset.height;\r\n }\r\n }\r\n\r\n private _computeHeightForLinesOf(lineCount: number): number {\r\n let newHeight = this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * lineCount;\r\n\r\n if (lineCount > 0 && this._lineSpacing.internalValue !== 0) {\r\n let lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n } else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n\r\n newHeight += (lineCount - 1) * lineSpacing;\r\n }\r\n\r\n return newHeight;\r\n }\r\n\r\n public override isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (this.resizeToFit) {\r\n return true;\r\n }\r\n return super.isDimensionFullyDefined(dim);\r\n }\r\n\r\n /**\r\n * Given a width constraint applied on the text block, find the expected height\r\n * @returns expected height\r\n */\r\n public computeExpectedHeight(): number {\r\n if (this.text && this.widthInPixels) {\r\n // Should abstract platform instead of using LastCreatedEngine\r\n const context = EngineStore.LastCreatedEngine?.createCanvas(0, 0).getContext(\"2d\");\r\n if (context) {\r\n this._applyStates(context);\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context.font, 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 }\r\n}\r\nRegisterClass(\"BABYLON.GUI.TextBlock\", TextBlock);\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"virtualKeyboard.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/virtualKeyboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,cAAc;CAiB1B;AAQD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAA/C;;QACI,8CAA8C;QACvC,yBAAoB,GAAG,IAAI,UAAU,EAAU,CAAC;QAEvD,4CAA4C;QACrC,uBAAkB,GAAG,MAAM,CAAC;QACnC,6CAA6C;QACtC,wBAAmB,GAAG,MAAM,CAAC;QAEpC,mDAAmD;QAC5C,6BAAwB,GAAG,KAAK,CAAC;QACxC,oDAAoD;QAC7C,8BAAyB,GAAG,KAAK,CAAC;QACzC,kDAAkD;QAC3C,4BAAuB,GAAG,KAAK,CAAC;QACvC,qDAAqD;QAC9C,+BAA0B,GAAG,KAAK,CAAC;QAE1C,uDAAuD;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oB,CAAC,eAAe,CAAC,GAAG,CAAC,IAAc,CAAC,CAAC;wBAClE,CAAC,CAAC,CAAC;qBACN;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { Button } from \"./button\";\r\nimport type { Container } from \"./container\";\r\nimport type { TextBlock } from \"./textBlock\";\r\nimport type { InputText } from \"./inputText\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport { InputTextArea } from \"./inputTextArea\";\r\n\r\n/**\r\n * Class used to store key control properties\r\n */\r\nexport class KeyPropertySet {\r\n /** Width */\r\n width?: string;\r\n /** Height */\r\n height?: string;\r\n /** Left padding */\r\n paddingLeft?: string;\r\n /** Right padding */\r\n paddingRight?: string;\r\n /** Top padding */\r\n paddingTop?: string;\r\n /** Bottom padding */\r\n paddingBottom?: string;\r\n /** Foreground color */\r\n color?: string;\r\n /** Background color */\r\n background?: string;\r\n}\r\n\r\ntype ConnectedInputText = {\r\n input: InputText;\r\n onFocusObserver: Nullable<Observer<InputText>>;\r\n onBlurObserver: Nullable<Observer<InputText>>;\r\n};\r\n\r\n/**\r\n * Class used to create virtual keyboard\r\n */\r\nexport class VirtualKeyboard extends StackPanel {\r\n /** Observable raised when a key is pressed */\r\n public onKeyPressObservable = new Observable<string>();\r\n\r\n /** Gets or sets default key button width */\r\n public defaultButtonWidth = \"40px\";\r\n /** Gets or sets default key button height */\r\n public defaultButtonHeight = \"40px\";\r\n\r\n /** Gets or sets default key button left padding */\r\n public defaultButtonPaddingLeft = \"2px\";\r\n /** Gets or sets default key button right padding */\r\n public defaultButtonPaddingRight = \"2px\";\r\n /** Gets or sets default key button top padding */\r\n public defaultButtonPaddingTop = \"2px\";\r\n /** Gets or sets default key button bottom padding */\r\n public defaultButtonPaddingBottom = \"2px\";\r\n\r\n /** Gets or sets default key button foreground color */\r\n public defaultButtonColor = \"#DDD\";\r\n /** Gets or sets default key button background color */\r\n public defaultButtonBackground = \"#070707\";\r\n\r\n /** Gets or sets shift button foreground color */\r\n public shiftButtonColor = \"#7799FF\";\r\n /** Gets or sets shift button thickness*/\r\n public selectedShiftThickness = 1;\r\n\r\n /** Gets shift key state */\r\n public shiftState = 0;\r\n\r\n protected override _getTypeName(): string {\r\n return \"VirtualKeyboard\";\r\n }\r\n\r\n private _createKey(key: string, propertySet: Nullable<KeyPropertySet>) {\r\n const button = Button.CreateSimpleButton(key, key);\r\n\r\n button.width = propertySet && propertySet.width ? propertySet.width : this.defaultButtonWidth;\r\n button.height = propertySet && propertySet.height ? propertySet.height : this.defaultButtonHeight;\r\n button.color = propertySet && propertySet.color ? propertySet.color : this.defaultButtonColor;\r\n button.background = propertySet && propertySet.background ? propertySet.background : this.defaultButtonBackground;\r\n button.paddingLeft = propertySet && propertySet.paddingLeft ? propertySet.paddingLeft : this.defaultButtonPaddingLeft;\r\n button.paddingRight = propertySet && propertySet.paddingRight ? propertySet.paddingRight : this.defaultButtonPaddingRight;\r\n button.paddingTop = propertySet && propertySet.paddingTop ? propertySet.paddingTop : this.defaultButtonPaddingTop;\r\n button.paddingBottom = propertySet && propertySet.paddingBottom ? propertySet.paddingBottom : this.defaultButtonPaddingBottom;\r\n\r\n button.thickness = 0;\r\n button.isFocusInvisible = true;\r\n\r\n button.shadowColor = this.shadowColor;\r\n button.shadowBlur = this.shadowBlur;\r\n button.shadowOffsetX = this.shadowOffsetX;\r\n button.shadowOffsetY = this.shadowOffsetY;\r\n\r\n button.onPointerUpObservable.add(() => {\r\n this.onKeyPressObservable.notifyObservers(key);\r\n });\r\n\r\n return button;\r\n }\r\n\r\n /**\r\n * Adds a new row of keys\r\n * @param keys defines the list of keys to add\r\n * @param propertySets defines the associated property sets\r\n */\r\n public addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void {\r\n const panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.isFocusInvisible = true;\r\n\r\n let maxKey: Nullable<Button> = null;\r\n for (let i = 0; i < keys.length; i++) {\r\n let properties = null;\r\n\r\n if (propertySets && propertySets.length === keys.length) {\r\n properties = propertySets[i];\r\n }\r\n\r\n const key = this._createKey(keys[i], properties);\r\n if (!maxKey || key.heightInPixels > maxKey.heightInPixels) {\r\n maxKey = key;\r\n }\r\n\r\n panel.addControl(key);\r\n }\r\n\r\n panel.height = maxKey ? maxKey.height : this.defaultButtonHeight;\r\n\r\n this.addControl(panel);\r\n }\r\n\r\n /**\r\n * Set the shift key to a specific state\r\n * @param shiftState defines the new shift state\r\n */\r\n public applyShiftState(shiftState: number): void {\r\n if (!this.children) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < this.children.length; i++) {\r\n const row = this.children[i];\r\n if (!row || !(<Container>row).children) {\r\n continue;\r\n }\r\n\r\n const rowContainer = <Container>row;\r\n for (let j = 0; j < rowContainer.children.length; j++) {\r\n const button = rowContainer.children[j] as Button;\r\n\r\n if (!button || !button.children[0]) {\r\n continue;\r\n }\r\n\r\n const button_tblock = button.children[0] as TextBlock;\r\n\r\n if (button_tblock.text === \"\\u21E7\") {\r\n button.color = shiftState ? this.shiftButtonColor : this.defaultButtonColor;\r\n button.thickness = shiftState > 1 ? this.selectedShiftThickness : 0;\r\n }\r\n\r\n button_tblock.text = shiftState > 0 ? button_tblock.text.toUpperCase() : button_tblock.text.toLowerCase();\r\n }\r\n }\r\n }\r\n\r\n private _currentlyConnectedInputText: Nullable<InputText | InputTextArea> = null;\r\n private _connectedInputTexts: ConnectedInputText[] = [];\r\n private _onKeyPressObserver: Nullable<Observer<string>> = null;\r\n\r\n /** Gets the input text control currently attached to the keyboard */\r\n public get connectedInputText(): Nullable<InputText | InputTextArea> {\r\n return this._currentlyConnectedInputText;\r\n }\r\n\r\n /**\r\n * Connects the keyboard with an input text control\r\n *\r\n * @param input defines the target control\r\n */\r\n public connect(input: InputText): void {\r\n const inputTextAlreadyConnected = this._connectedInputTexts.some((a) => a.input === input);\r\n if (inputTextAlreadyConnected) {\r\n return;\r\n }\r\n\r\n if (this._onKeyPressObserver === null) {\r\n this._onKeyPressObserver = this.onKeyPressObservable.add((key) => {\r\n if (!this._currentlyConnectedInputText) {\r\n return;\r\n }\r\n\r\n this._currentlyConnectedInputText._host.focusedControl = this._currentlyConnectedInputText;\r\n\r\n switch (key) {\r\n case \"\\u21E7\":\r\n this.shiftState++;\r\n if (this.shiftState > 2) {\r\n this.shiftState = 0;\r\n }\r\n this.applyShiftState(this.shiftState);\r\n return;\r\n case \"\\u2190\":\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"Backspace\");\r\n } else {\r\n this._currentlyConnectedInputText.processKey(8);\r\n }\r\n return;\r\n case \"\\u21B5\":\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"Enter\");\r\n } else {\r\n this._currentlyConnectedInputText.processKey(13);\r\n }\r\n return;\r\n }\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"\", this.shiftState ? key.toUpperCase() : key);\r\n } else {\r\n this._currentlyConnectedInputText.processKey(-1, this.shiftState ? key.toUpperCase() : key);\r\n }\r\n\r\n if (this.shiftState === 1) {\r\n this.shiftState = 0;\r\n this.applyShiftState(this.shiftState);\r\n }\r\n });\r\n }\r\n\r\n this.isVisible = false;\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n\r\n // Events hooking\r\n const onFocusObserver: Nullable<Observer<InputText>> = input.onFocusObservable.add(() => {\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n this.isVisible = true;\r\n });\r\n\r\n const onBlurObserver: Nullable<Observer<InputText>> = input.onBlurObservable.add(() => {\r\n input._connectedVirtualKeyboard = null;\r\n this._currentlyConnectedInputText = null;\r\n this.isVisible = false;\r\n });\r\n\r\n this._connectedInputTexts.push({\r\n input,\r\n onBlurObserver,\r\n onFocusObserver,\r\n });\r\n }\r\n\r\n /**\r\n * Disconnects the keyboard from connected InputText controls\r\n *\r\n * @param input optionally defines a target control, otherwise all are disconnected\r\n */\r\n public disconnect(input?: InputText): void {\r\n if (input) {\r\n // .find not available on IE\r\n const filtered = this._connectedInputTexts.filter((a) => a.input === input);\r\n if (filtered.length === 1) {\r\n this._removeConnectedInputObservables(filtered[0]);\r\n\r\n this._connectedInputTexts = this._connectedInputTexts.filter((a) => a.input !== input);\r\n if (this._currentlyConnectedInputText === input) {\r\n this._currentlyConnectedInputText = null;\r\n }\r\n }\r\n } else {\r\n this._connectedInputTexts.forEach((connectedInputText: ConnectedInputText) => {\r\n this._removeConnectedInputObservables(connectedInputText);\r\n });\r\n this._connectedInputTexts.length = 0;\r\n }\r\n\r\n if (this._connectedInputTexts.length === 0) {\r\n this._currentlyConnectedInputText = null;\r\n this.onKeyPressObservable.remove(this._onKeyPressObserver);\r\n this._onKeyPressObserver = null;\r\n }\r\n }\r\n\r\n private _removeConnectedInputObservables(connectedInputText: ConnectedInputText): void {\r\n connectedInputText.input._connectedVirtualKeyboard = null;\r\n connectedInputText.input.onFocusObservable.remove(connectedInputText.onFocusObserver);\r\n connectedInputText.input.onBlurObservable.remove(connectedInputText.onBlurObserver);\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public override dispose(): void {\r\n super.dispose();\r\n\r\n this.disconnect();\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Creates a new keyboard using a default layout\r\n *\r\n * @param name defines control name\r\n * @returns a new VirtualKeyboard\r\n */\r\n public static CreateDefaultLayout(name?: string): VirtualKeyboard {\r\n const returnValue = new VirtualKeyboard(name);\r\n\r\n returnValue.addKeysRow([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\", \"\\u2190\"]);\r\n returnValue.addKeysRow([\"q\", \"w\", \"e\", \"r\", \"t\", \"y\", \"u\", \"i\", \"o\", \"p\"]);\r\n returnValue.addKeysRow([\"a\", \"s\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \";\", \"'\", \"\\u21B5\"]);\r\n returnValue.addKeysRow([\"\\u21E7\", \"z\", \"x\", \"c\", \"v\", \"b\", \"n\", \"m\", \",\", \".\", \"/\"]);\r\n returnValue.addKeysRow([\" \"], [{ width: \"200px\" }]);\r\n\r\n return returnValue;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n for (const row of this.children) {\r\n if (row.getClassName() === \"StackPanel\") {\r\n const stackPanel = row as StackPanel;\r\n for (const key of stackPanel.children) {\r\n if (key.getClassName() === \"Button\" && key.name) {\r\n key.onPointerUpObservable.add(() => {\r\n this.onKeyPressObservable.notifyObservers(key.name as string);\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.VirtualKeyboard\", VirtualKeyboard);\r\n"]}
|
1
|
+
{"version":3,"file":"virtualKeyboard.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/virtualKeyboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;GAEG;AACH,MAAM,OAAO,cAAc;CAiB1B;AAQD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAA/C;;QACI,8CAA8C;QACvC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AI,IAAI,CAAC,QAAQ,EAAE;YAC7B,IAAI,GAAG,CAAC,YAAY,EAAE,KAAK,YAAY,EAAE;gBACrC,MAAM,UAAU,GAAG,GAAiB,CAAC;gBACrC,KAAK,MAAM,GAAG,IAAI,UAAU,CAAC,QAAQ,EAAE;oBACnC,IAAI,GAAG,CAAC,YAAY,EAAE,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE;wBAC7C,GAAG,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,EAAE;4BAC/B,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,GAAG,CAAC,IAAc,CAAC,CAAC;wBAClE,CAAC,CAAC,CAAC;qBACN;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { Button } from \"./button\";\r\nimport type { Container } from \"./container\";\r\nimport type { TextBlock } from \"./textBlock\";\r\nimport type { InputText } from \"./inputText\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport { InputTextArea } from \"./inputTextArea\";\r\nimport type { Control } from \"./control\";\r\n\r\n/**\r\n * Class used to store key control properties\r\n */\r\nexport class KeyPropertySet {\r\n /** Width */\r\n width?: string;\r\n /** Height */\r\n height?: string;\r\n /** Left padding */\r\n paddingLeft?: string;\r\n /** Right padding */\r\n paddingRight?: string;\r\n /** Top padding */\r\n paddingTop?: string;\r\n /** Bottom padding */\r\n paddingBottom?: string;\r\n /** Foreground color */\r\n color?: string;\r\n /** Background color */\r\n background?: string;\r\n}\r\n\r\ntype ConnectedInputText = {\r\n input: InputText;\r\n onFocusObserver: Nullable<Observer<Control>>;\r\n onBlurObserver: Nullable<Observer<Control>>;\r\n};\r\n\r\n/**\r\n * Class used to create virtual keyboard\r\n */\r\nexport class VirtualKeyboard extends StackPanel {\r\n /** Observable raised when a key is pressed */\r\n public onKeyPressObservable = new Observable<string>();\r\n\r\n /** Gets or sets default key button width */\r\n public defaultButtonWidth = \"40px\";\r\n /** Gets or sets default key button height */\r\n public defaultButtonHeight = \"40px\";\r\n\r\n /** Gets or sets default key button left padding */\r\n public defaultButtonPaddingLeft = \"2px\";\r\n /** Gets or sets default key button right padding */\r\n public defaultButtonPaddingRight = \"2px\";\r\n /** Gets or sets default key button top padding */\r\n public defaultButtonPaddingTop = \"2px\";\r\n /** Gets or sets default key button bottom padding */\r\n public defaultButtonPaddingBottom = \"2px\";\r\n\r\n /** Gets or sets default key button foreground color */\r\n public defaultButtonColor = \"#DDD\";\r\n /** Gets or sets default key button background color */\r\n public defaultButtonBackground = \"#070707\";\r\n\r\n /** Gets or sets shift button foreground color */\r\n public shiftButtonColor = \"#7799FF\";\r\n /** Gets or sets shift button thickness*/\r\n public selectedShiftThickness = 1;\r\n\r\n /** Gets shift key state */\r\n public shiftState = 0;\r\n\r\n protected override _getTypeName(): string {\r\n return \"VirtualKeyboard\";\r\n }\r\n\r\n private _createKey(key: string, propertySet: Nullable<KeyPropertySet>) {\r\n const button = Button.CreateSimpleButton(key, key);\r\n\r\n button.width = propertySet && propertySet.width ? propertySet.width : this.defaultButtonWidth;\r\n button.height = propertySet && propertySet.height ? propertySet.height : this.defaultButtonHeight;\r\n button.color = propertySet && propertySet.color ? propertySet.color : this.defaultButtonColor;\r\n button.background = propertySet && propertySet.background ? propertySet.background : this.defaultButtonBackground;\r\n button.paddingLeft = propertySet && propertySet.paddingLeft ? propertySet.paddingLeft : this.defaultButtonPaddingLeft;\r\n button.paddingRight = propertySet && propertySet.paddingRight ? propertySet.paddingRight : this.defaultButtonPaddingRight;\r\n button.paddingTop = propertySet && propertySet.paddingTop ? propertySet.paddingTop : this.defaultButtonPaddingTop;\r\n button.paddingBottom = propertySet && propertySet.paddingBottom ? propertySet.paddingBottom : this.defaultButtonPaddingBottom;\r\n\r\n button.thickness = 0;\r\n button.isFocusInvisible = true;\r\n\r\n button.shadowColor = this.shadowColor;\r\n button.shadowBlur = this.shadowBlur;\r\n button.shadowOffsetX = this.shadowOffsetX;\r\n button.shadowOffsetY = this.shadowOffsetY;\r\n\r\n button.onPointerUpObservable.add(() => {\r\n this.onKeyPressObservable.notifyObservers(key);\r\n });\r\n\r\n return button;\r\n }\r\n\r\n /**\r\n * Adds a new row of keys\r\n * @param keys defines the list of keys to add\r\n * @param propertySets defines the associated property sets\r\n */\r\n public addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void {\r\n const panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.isFocusInvisible = true;\r\n\r\n let maxKey: Nullable<Button> = null;\r\n for (let i = 0; i < keys.length; i++) {\r\n let properties = null;\r\n\r\n if (propertySets && propertySets.length === keys.length) {\r\n properties = propertySets[i];\r\n }\r\n\r\n const key = this._createKey(keys[i], properties);\r\n if (!maxKey || key.heightInPixels > maxKey.heightInPixels) {\r\n maxKey = key;\r\n }\r\n\r\n panel.addControl(key);\r\n }\r\n\r\n panel.height = maxKey ? maxKey.height : this.defaultButtonHeight;\r\n\r\n this.addControl(panel);\r\n }\r\n\r\n /**\r\n * Set the shift key to a specific state\r\n * @param shiftState defines the new shift state\r\n */\r\n public applyShiftState(shiftState: number): void {\r\n if (!this.children) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < this.children.length; i++) {\r\n const row = this.children[i];\r\n if (!row || !(<Container>row).children) {\r\n continue;\r\n }\r\n\r\n const rowContainer = <Container>row;\r\n for (let j = 0; j < rowContainer.children.length; j++) {\r\n const button = rowContainer.children[j] as Button;\r\n\r\n if (!button || !button.children[0]) {\r\n continue;\r\n }\r\n\r\n const button_tblock = button.children[0] as TextBlock;\r\n\r\n if (button_tblock.text === \"\\u21E7\") {\r\n button.color = shiftState ? this.shiftButtonColor : this.defaultButtonColor;\r\n button.thickness = shiftState > 1 ? this.selectedShiftThickness : 0;\r\n }\r\n\r\n button_tblock.text = shiftState > 0 ? button_tblock.text.toUpperCase() : button_tblock.text.toLowerCase();\r\n }\r\n }\r\n }\r\n\r\n private _currentlyConnectedInputText: Nullable<InputText | InputTextArea> = null;\r\n private _connectedInputTexts: ConnectedInputText[] = [];\r\n private _onKeyPressObserver: Nullable<Observer<string>> = null;\r\n\r\n /** Gets the input text control currently attached to the keyboard */\r\n public get connectedInputText(): Nullable<InputText | InputTextArea> {\r\n return this._currentlyConnectedInputText;\r\n }\r\n\r\n /**\r\n * Connects the keyboard with an input text control\r\n *\r\n * @param input defines the target control\r\n */\r\n public connect(input: InputText): void {\r\n const inputTextAlreadyConnected = this._connectedInputTexts.some((a) => a.input === input);\r\n if (inputTextAlreadyConnected) {\r\n return;\r\n }\r\n\r\n if (this._onKeyPressObserver === null) {\r\n this._onKeyPressObserver = this.onKeyPressObservable.add((key) => {\r\n if (!this._currentlyConnectedInputText) {\r\n return;\r\n }\r\n\r\n this._currentlyConnectedInputText._host.focusedControl = this._currentlyConnectedInputText;\r\n\r\n switch (key) {\r\n case \"\\u21E7\":\r\n this.shiftState++;\r\n if (this.shiftState > 2) {\r\n this.shiftState = 0;\r\n }\r\n this.applyShiftState(this.shiftState);\r\n return;\r\n case \"\\u2190\":\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"Backspace\");\r\n } else {\r\n this._currentlyConnectedInputText.processKey(8);\r\n }\r\n return;\r\n case \"\\u21B5\":\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"Enter\");\r\n } else {\r\n this._currentlyConnectedInputText.processKey(13);\r\n }\r\n return;\r\n }\r\n if (this._currentlyConnectedInputText instanceof InputTextArea) {\r\n this._currentlyConnectedInputText.alternativeProcessKey(\"\", this.shiftState ? key.toUpperCase() : key);\r\n } else {\r\n this._currentlyConnectedInputText.processKey(-1, this.shiftState ? key.toUpperCase() : key);\r\n }\r\n\r\n if (this.shiftState === 1) {\r\n this.shiftState = 0;\r\n this.applyShiftState(this.shiftState);\r\n }\r\n });\r\n }\r\n\r\n this.isVisible = false;\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n\r\n // Events hooking\r\n const onFocusObserver: Nullable<Observer<Control>> = input.onFocusObservable.add(() => {\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n this.isVisible = true;\r\n });\r\n\r\n const onBlurObserver: Nullable<Observer<Control>> = input.onBlurObservable.add(() => {\r\n input._connectedVirtualKeyboard = null;\r\n this._currentlyConnectedInputText = null;\r\n this.isVisible = false;\r\n });\r\n\r\n this._connectedInputTexts.push({\r\n input,\r\n onBlurObserver,\r\n onFocusObserver,\r\n });\r\n }\r\n\r\n /**\r\n * Disconnects the keyboard from connected InputText controls\r\n *\r\n * @param input optionally defines a target control, otherwise all are disconnected\r\n */\r\n public disconnect(input?: InputText): void {\r\n if (input) {\r\n // .find not available on IE\r\n const filtered = this._connectedInputTexts.filter((a) => a.input === input);\r\n if (filtered.length === 1) {\r\n this._removeConnectedInputObservables(filtered[0]);\r\n\r\n this._connectedInputTexts = this._connectedInputTexts.filter((a) => a.input !== input);\r\n if (this._currentlyConnectedInputText === input) {\r\n this._currentlyConnectedInputText = null;\r\n }\r\n }\r\n } else {\r\n this._connectedInputTexts.forEach((connectedInputText: ConnectedInputText) => {\r\n this._removeConnectedInputObservables(connectedInputText);\r\n });\r\n this._connectedInputTexts.length = 0;\r\n }\r\n\r\n if (this._connectedInputTexts.length === 0) {\r\n this._currentlyConnectedInputText = null;\r\n this.onKeyPressObservable.remove(this._onKeyPressObserver);\r\n this._onKeyPressObserver = null;\r\n }\r\n }\r\n\r\n private _removeConnectedInputObservables(connectedInputText: ConnectedInputText): void {\r\n connectedInputText.input._connectedVirtualKeyboard = null;\r\n connectedInputText.input.onFocusObservable.remove(connectedInputText.onFocusObserver);\r\n connectedInputText.input.onBlurObservable.remove(connectedInputText.onBlurObserver);\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public override dispose(): void {\r\n super.dispose();\r\n\r\n this.disconnect();\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Creates a new keyboard using a default layout\r\n *\r\n * @param name defines control name\r\n * @returns a new VirtualKeyboard\r\n */\r\n public static CreateDefaultLayout(name?: string): VirtualKeyboard {\r\n const returnValue = new VirtualKeyboard(name);\r\n\r\n returnValue.addKeysRow([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\", \"\\u2190\"]);\r\n returnValue.addKeysRow([\"q\", \"w\", \"e\", \"r\", \"t\", \"y\", \"u\", \"i\", \"o\", \"p\"]);\r\n returnValue.addKeysRow([\"a\", \"s\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \";\", \"'\", \"\\u21B5\"]);\r\n returnValue.addKeysRow([\"\\u21E7\", \"z\", \"x\", \"c\", \"v\", \"b\", \"n\", \"m\", \",\", \".\", \"/\"]);\r\n returnValue.addKeysRow([\" \"], [{ width: \"200px\" }]);\r\n\r\n return returnValue;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n for (const row of this.children) {\r\n if (row.getClassName() === \"StackPanel\") {\r\n const stackPanel = row as StackPanel;\r\n for (const key of stackPanel.children) {\r\n if (key.getClassName() === \"Button\" && key.name) {\r\n key.onPointerUpObservable.add(() => {\r\n this.onKeyPressObservable.notifyObservers(key.name as string);\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.VirtualKeyboard\", VirtualKeyboard);\r\n"]}
|
@@ -2,7 +2,7 @@ import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
2
2
|
import { Matrix, TmpVectors, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
3
3
|
import { VolumeBasedPanel } from "./volumeBasedPanel.js";
|
4
4
|
import { Container3D } from "./container3D.js";
|
5
|
-
import { Axis
|
5
|
+
import { Axis } from "@babylonjs/core/Maths/math.axis.js";
|
6
6
|
/**
|
7
7
|
* Class used to create a container panel deployed on the surface of a cylinder
|
8
8
|
*/
|
@@ -43,7 +43,7 @@ export class CylinderPanel extends VolumeBasedPanel {
|
|
43
43
|
case Container3D.FACEFORWARD_ORIENTATION:
|
44
44
|
break;
|
45
45
|
case Container3D.FACEFORWARDREVERSED_ORIENTATION:
|
46
|
-
mesh.rotate(Axis.Y, Math.PI, Space.LOCAL);
|
46
|
+
mesh.rotate(Axis.Y, Math.PI, 0 /* Space.LOCAL */);
|
47
47
|
break;
|
48
48
|
}
|
49
49
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cylinderPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/cylinderPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAGrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,IAAI,
|
1
|
+
{"version":3,"file":"cylinderPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/cylinderPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAGrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAS,2CAA6B;AAEnD;;GAEG;AACH,MAAM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,EAAE,sBAAc,CAAC;gBAC1C,MAAM;SACb;IACL,CAAC;IAEO,mBAAmB,CAAC,MAAe;QACvC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAEtD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QAEvC,MAAM,CAAC,yBAAyB,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAErE,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;CACJ","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { float } from \"core/types\";\r\n\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Container3D } from \"./container3D\";\r\nimport { Axis, Space } from \"core/Maths/math.axis\";\r\n\r\n/**\r\n * Class used to create a container panel deployed on the surface of a cylinder\r\n */\r\nexport class CylinderPanel extends VolumeBasedPanel {\r\n private _radius = 5.0;\r\n\r\n /**\r\n * Gets or sets the radius of the cylinder where to project controls (5 by default)\r\n */\r\n public get radius(): float {\r\n return this._radius;\r\n }\r\n\r\n public set radius(value: float) {\r\n if (this._radius === value) {\r\n return;\r\n }\r\n\r\n this._radius = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n const newPos = this._cylindricalMapping(nodePosition);\r\n control.position = newPos;\r\n\r\n switch (this.orientation) {\r\n case Container3D.FACEORIGIN_ORIENTATION:\r\n mesh.lookAt(new Vector3(2 * newPos.x, newPos.y, 2 * newPos.z));\r\n break;\r\n case Container3D.FACEORIGINREVERSED_ORIENTATION:\r\n mesh.lookAt(new Vector3(-newPos.x, newPos.y, -newPos.z));\r\n break;\r\n case Container3D.FACEFORWARD_ORIENTATION:\r\n break;\r\n case Container3D.FACEFORWARDREVERSED_ORIENTATION:\r\n mesh.rotate(Axis.Y, Math.PI, Space.LOCAL);\r\n break;\r\n }\r\n }\r\n\r\n private _cylindricalMapping(source: Vector3) {\r\n const newPos = new Vector3(0, source.y, this._radius);\r\n\r\n const yAngle = source.x / this._radius;\r\n\r\n Matrix.RotationYawPitchRollToRef(yAngle, 0, 0, TmpVectors.Matrix[0]);\r\n\r\n return Vector3.TransformNormal(newPos, TmpVectors.Matrix[0]);\r\n }\r\n}\r\n"]}
|
@@ -2,7 +2,7 @@ import { ContentDisplay3D } from "./contentDisplay3D.js";
|
|
2
2
|
import { TouchHolographicButton } from "./touchHolographicButton.js";
|
3
3
|
import { AdvancedDynamicTexture } from "../../2D/advancedDynamicTexture.js";
|
4
4
|
import { Control } from "../../2D/controls/control.js";
|
5
|
-
import { TextBlock
|
5
|
+
import { TextBlock } from "../../2D/controls/textBlock.js";
|
6
6
|
import { DefaultBehavior } from "../behaviors/defaultBehavior.js";
|
7
7
|
import { SlateGizmo } from "../gizmos/slateGizmo.js";
|
8
8
|
import { FluentMaterial } from "../materials/fluent/fluentMaterial.js";
|
@@ -222,7 +222,7 @@ export class HolographicSlate extends ContentDisplay3D {
|
|
222
222
|
this._titleBarTitle.isPickable = false;
|
223
223
|
const adt = AdvancedDynamicTexture.CreateForMesh(this._titleBarTitle);
|
224
224
|
this._titleTextComponent = new TextBlock("titleText_" + this.name, this._titleText);
|
225
|
-
this._titleTextComponent.textWrapping = TextWrapping.Ellipsis
|
225
|
+
this._titleTextComponent.textWrapping = 2 /* TextWrapping.Ellipsis */;
|
226
226
|
this._titleTextComponent.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
|
227
227
|
this._titleTextComponent.color = "white";
|
228
228
|
this._titleTextComponent.fontSize = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 2;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"holographicSlate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicSlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,gDAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACtE,OAAO,EAAE,QAAQ,EAAE,+CAAiC;AAEpD,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAEhE,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,UAAU,EAAE,kDAAoC;AAKzD;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IA0ClD;;OAEG;IACH,IAAW,eAAe;QACtB,OAAO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EG;AACW,qCAAoB,GAAW,kBAAkB,AAA7B,CAA8B;AAEjD,2CAA0B,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import { ContentDisplay3D } from \"./contentDisplay3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { TouchHolographicButton } from \"./touchHolographicButton\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Control } from \"../../2D/controls/control\";\r\nimport { TextBlock, TextWrapping } from \"../../2D/controls/textBlock\";\r\nimport { DefaultBehavior } from \"../behaviors/defaultBehavior\";\r\nimport { SlateGizmo } from \"../gizmos/slateGizmo\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentBackplateMaterial } from \"../materials/fluentBackplate/fluentBackplateMaterial\";\r\nimport { PointerDragBehavior } from \"core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Vector4 } from \"core/Maths/math\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Quaternion, Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Viewport } from \"core/Maths/math.viewport\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Class used to create a holographic slate\r\n * @since 5.0.0\r\n */\r\nexport class HolographicSlate extends ContentDisplay3D {\r\n /**\r\n * Base Url for the assets.\r\n */\r\n public static ASSETS_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static CLOSE_ICON_FILENAME: string = \"IconClose.png\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static FOLLOW_ICON_FILENAME: string = \"IconFollowMe.png\";\r\n\r\n private static _DEFAULT_TEXT_RESOLUTION_Y = 102.4;\r\n\r\n /**\r\n * Margin between title bar and contentplate\r\n */\r\n public titleBarMargin = 0.005;\r\n\r\n /**\r\n * Origin in local coordinates (top left corner)\r\n */\r\n public origin = new Vector3(0, 0, 0);\r\n\r\n private _dimensions = new Vector2(21.875, 12.5);\r\n private _titleBarHeight = 0.625;\r\n\r\n private _titleBarMaterial: FluentBackplateMaterial;\r\n private _backMaterial: FluentBackplateMaterial;\r\n private _contentMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _positionChangedObserver: Nullable<Observer<{ position: Vector3 }>>;\r\n\r\n private _titleText = \"\";\r\n private _titleTextComponent: TextBlock;\r\n\r\n private _contentViewport: Viewport;\r\n private _contentDragBehavior: PointerDragBehavior;\r\n\r\n private _defaultBehavior: DefaultBehavior;\r\n /**\r\n * Regroups all mesh behaviors for the slate\r\n */\r\n public get defaultBehavior(): DefaultBehavior {\r\n return this._defaultBehavior;\r\n }\r\n\r\n /** @internal */\r\n public _gizmo: SlateGizmo;\r\n\r\n protected _titleBar: Mesh;\r\n protected _titleBarTitle: Mesh;\r\n protected _contentPlate: Mesh;\r\n protected _backPlate: Mesh;\r\n /** @internal */\r\n public _followButton: TouchHolographicButton;\r\n protected _closeButton: TouchHolographicButton;\r\n protected override _contentScaleRatio = 1;\r\n\r\n /**\r\n * 2D dimensions of the slate\r\n */\r\n public get dimensions() {\r\n return this._dimensions;\r\n }\r\n public set dimensions(value) {\r\n //clamp, respecting ratios\r\n let scale = 1.0;\r\n if (value.x < this.minDimensions.x || value.y < this.minDimensions.y) {\r\n const newRatio = value.x / value.y;\r\n const minRatio = this.minDimensions.x / this.minDimensions.y;\r\n if (minRatio > newRatio) {\r\n // We just need to make sure the x-val is greater than the min\r\n scale = this.minDimensions.x / value.x;\r\n } else {\r\n // We just need to make sure the y-val is greater than the min\r\n scale = this.minDimensions.y / value.y;\r\n }\r\n }\r\n\r\n this._dimensions.copyFrom(value).scaleInPlace(scale);\r\n this._updatePivot();\r\n this._positionElements();\r\n }\r\n\r\n /**\r\n * Minimum dimensions of the slate\r\n */\r\n public minDimensions = new Vector2(15.625, 6.25);\r\n\r\n /**\r\n * Default dimensions of the slate\r\n */\r\n public readonly defaultDimensions = this._dimensions.clone();\r\n\r\n /**\r\n * Height of the title bar component\r\n */\r\n public get titleBarHeight() {\r\n return this._titleBarHeight;\r\n }\r\n public set titleBarHeight(value) {\r\n this._titleBarHeight = value;\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the meshes\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._titleBar.renderingGroupId = id;\r\n this._titleBarTitle.renderingGroupId = id;\r\n this._contentPlate.renderingGroupId = id;\r\n this._backPlate.renderingGroupId = id;\r\n }\r\n public get renderingGroupId(): number {\r\n return this._titleBar.renderingGroupId;\r\n }\r\n\r\n /**\r\n * The title text displayed at the top of the slate\r\n */\r\n public set title(title: string) {\r\n this._titleText = title;\r\n if (this._titleTextComponent) {\r\n this._titleTextComponent.text = title;\r\n }\r\n }\r\n public get title() {\r\n return this._titleText;\r\n }\r\n\r\n /**\r\n * Creates a new slate\r\n * @param name defines the control name\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n\r\n this._followButton = new TouchHolographicButton(\"followButton\" + this.name);\r\n this._followButton.isToggleButton = true;\r\n this._closeButton = new TouchHolographicButton(\"closeButton\" + this.name);\r\n\r\n this._contentViewport = new Viewport(0, 0, 1, 1);\r\n this._contentDragBehavior = new PointerDragBehavior({\r\n dragPlaneNormal: new Vector3(0, 0, -1),\r\n });\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * This function can be overloaded by child classes\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected override _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._contentMaterial.albedoTexture = facadeTexture;\r\n this._resetContentPositionAndZoom();\r\n this._applyContentViewport();\r\n\r\n facadeTexture.attachToMesh(this._contentPlate, true);\r\n }\r\n\r\n private _addControl(control: Control3D): void {\r\n control._host = this._host;\r\n if (this._host.utilityLayer) {\r\n control._prepareNode(this._host.utilityLayer.utilityLayerScene);\r\n }\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"HolographicSlate\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _positionElements() {\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n const titleBar = this._titleBar;\r\n const titleBarTitle = this._titleBarTitle;\r\n const contentPlate = this._contentPlate;\r\n const backPlate = this._backPlate;\r\n\r\n if (followButton && closeButton && titleBar) {\r\n closeButton.scaling.setAll(this.titleBarHeight);\r\n followButton.scaling.setAll(this.titleBarHeight);\r\n closeButton.position.copyFromFloats(this.dimensions.x - this.titleBarHeight / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n followButton.position.copyFromFloats(this.dimensions.x - (3 * this.titleBarHeight) / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n\r\n const contentPlateHeight = this.dimensions.y - this.titleBarHeight - this.titleBarMargin;\r\n const rightHandScene = contentPlate.getScene().useRightHandedSystem;\r\n\r\n titleBar.scaling.set(this.dimensions.x, this.titleBarHeight, Epsilon);\r\n titleBarTitle.scaling.set(this.dimensions.x - 2 * this.titleBarHeight, this.titleBarHeight, Epsilon);\r\n contentPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n backPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n\r\n titleBar.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight / 2), 0).addInPlace(this.origin);\r\n titleBarTitle.position\r\n .copyFromFloats(this.dimensions.x / 2 - this.titleBarHeight, -(this.titleBarHeight / 2), rightHandScene ? Epsilon : -Epsilon)\r\n .addInPlace(this.origin);\r\n contentPlate.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), 0).addInPlace(this.origin);\r\n backPlate.position\r\n .copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), rightHandScene ? -Epsilon : Epsilon)\r\n .addInPlace(this.origin);\r\n\r\n // Update the title's AdvancedDynamicTexture scale to avoid visual stretching\r\n this._titleTextComponent.host.scaleTo(\r\n (HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y * titleBarTitle.scaling.x) / titleBarTitle.scaling.y,\r\n HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y\r\n );\r\n\r\n const aspectRatio = this.dimensions.x / contentPlateHeight;\r\n this._contentViewport.width = this._contentScaleRatio;\r\n this._contentViewport.height = this._contentScaleRatio / aspectRatio;\r\n\r\n this._applyContentViewport();\r\n if (this._gizmo) {\r\n this._gizmo.updateBoundingBox();\r\n }\r\n }\r\n }\r\n\r\n private _applyContentViewport() {\r\n if (this._contentPlate?.material && (this._contentPlate.material as FluentMaterial).albedoTexture) {\r\n const tex = (this._contentPlate.material as FluentMaterial).albedoTexture as Texture;\r\n tex.uScale = this._contentScaleRatio;\r\n tex.vScale = (this._contentScaleRatio / this._contentViewport.width) * this._contentViewport.height;\r\n tex.uOffset = this._contentViewport.x;\r\n tex.vOffset = this._contentViewport.y;\r\n }\r\n }\r\n\r\n private _resetContentPositionAndZoom() {\r\n this._contentViewport.x = 0;\r\n this._contentViewport.y = 1 - this._contentViewport.height / this._contentViewport.width;\r\n this._contentScaleRatio = 1;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updatePivot() {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n // Update pivot point so it is at the center of geometry\r\n // As origin is topleft corner in 2D, dimensions are calculated towards bottom right corner, thus y axis is downwards\r\n const center = new Vector3(this.dimensions.x * 0.5, -this.dimensions.y * 0.5, Epsilon);\r\n center.addInPlace(this.origin);\r\n center.z = 0;\r\n\r\n const origin = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin, this.mesh.computeWorldMatrix(true), origin);\r\n this.mesh.setPivotPoint(center);\r\n const origin2 = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin2, this.mesh.computeWorldMatrix(true), origin2);\r\n this.mesh.position.addInPlace(origin).subtractInPlace(origin2);\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n const node = new Mesh(\"slate_\" + this.name, scene);\r\n\r\n this._titleBar = CreateBox(\"titleBar_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle = CreatePlane(\"titleText_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle.parent = node;\r\n this._titleBarTitle.isPickable = false;\r\n\r\n const adt = AdvancedDynamicTexture.CreateForMesh(this._titleBarTitle);\r\n this._titleTextComponent = new TextBlock(\"titleText_\" + this.name, this._titleText);\r\n this._titleTextComponent.textWrapping = TextWrapping.Ellipsis;\r\n this._titleTextComponent.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._titleTextComponent.color = \"white\";\r\n this._titleTextComponent.fontSize = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 2;\r\n this._titleTextComponent.paddingLeft = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 4;\r\n adt.addControl(this._titleTextComponent);\r\n\r\n if (scene.useRightHandedSystem) {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE }, scene);\r\n } else {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE }, scene);\r\n }\r\n\r\n this._titleBar.parent = node;\r\n this._titleBar.isNearGrabbable = true;\r\n this._contentPlate.parent = node;\r\n this._backPlate.parent = node;\r\n this._attachContentPlateBehavior();\r\n\r\n this._addControl(this._followButton);\r\n this._addControl(this._closeButton);\r\n\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n\r\n followButton.node!.parent = node;\r\n closeButton.node!.parent = node;\r\n\r\n this._positionElements();\r\n\r\n this._followButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.FOLLOW_ICON_FILENAME;\r\n this._closeButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.CLOSE_ICON_FILENAME;\r\n\r\n this._followButton.isBackplateVisible = false;\r\n this._closeButton.isBackplateVisible = false;\r\n\r\n this._followButton.onToggleObservable.add((isToggled) => {\r\n this._defaultBehavior.followBehaviorEnabled = isToggled;\r\n if (this._defaultBehavior.followBehaviorEnabled) {\r\n this._defaultBehavior.followBehavior.recenter();\r\n }\r\n });\r\n\r\n this._closeButton.onPointerClickObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n node.rotationQuaternion = Quaternion.Identity();\r\n node.isVisible = false;\r\n\r\n return node;\r\n }\r\n\r\n private _attachContentPlateBehavior() {\r\n this._contentDragBehavior.attach(this._contentPlate);\r\n this._contentDragBehavior.moveAttached = false;\r\n this._contentDragBehavior.useObjectOrientationForDragging = true;\r\n this._contentDragBehavior.updateDragPlane = false;\r\n\r\n const origin = new Vector3();\r\n const worldDimensions = new Vector3();\r\n const upWorld = new Vector3();\r\n const rightWorld = new Vector3();\r\n const projectedOffset = new Vector2();\r\n let startViewport: Viewport;\r\n let worldMatrix: Matrix;\r\n\r\n this._contentDragBehavior.onDragStartObservable.add((event) => {\r\n if (!this.node) {\r\n return;\r\n }\r\n startViewport = this._contentViewport.clone();\r\n worldMatrix = this.node.computeWorldMatrix(true);\r\n\r\n origin.copyFrom(event.dragPlanePoint);\r\n worldDimensions.set(this.dimensions.x, this.dimensions.y, Epsilon);\r\n worldDimensions.y -= this.titleBarHeight + this.titleBarMargin;\r\n Vector3.TransformNormalToRef(worldDimensions, worldMatrix, worldDimensions);\r\n upWorld.copyFromFloats(0, 1, 0);\r\n Vector3.TransformNormalToRef(upWorld, worldMatrix, upWorld);\r\n rightWorld.copyFromFloats(1, 0, 0);\r\n Vector3.TransformNormalToRef(rightWorld, worldMatrix, rightWorld);\r\n upWorld.normalize();\r\n upWorld.scaleInPlace(1 / Vector3.Dot(upWorld, worldDimensions));\r\n rightWorld.normalize();\r\n rightWorld.scaleInPlace(1 / Vector3.Dot(rightWorld, worldDimensions));\r\n });\r\n\r\n const offset = new Vector3();\r\n this._contentDragBehavior.onDragObservable.add((event) => {\r\n offset.copyFrom(event.dragPlanePoint);\r\n offset.subtractInPlace(origin);\r\n projectedOffset.copyFromFloats(Vector3.Dot(offset, rightWorld), Vector3.Dot(offset, upWorld));\r\n\r\n // By default, content takes full width available and height is cropped to keep aspect ratio\r\n this._contentViewport.x = Scalar.Clamp(startViewport.x - offset.x, 0, 1 - this._contentViewport.width * this._contentScaleRatio);\r\n this._contentViewport.y = Scalar.Clamp(startViewport.y - offset.y, 0, 1 - this._contentViewport.height * this._contentScaleRatio);\r\n this._applyContentViewport();\r\n });\r\n }\r\n\r\n protected override _affectMaterial(mesh: AbstractMesh) {\r\n // TODO share materials\r\n this._titleBarMaterial = new FluentBackplateMaterial(`${this.name} plateMaterial`, mesh.getScene());\r\n\r\n this._contentMaterial = new FluentMaterial(`${this.name} contentMaterial`, mesh.getScene());\r\n this._contentMaterial.renderBorders = true;\r\n\r\n this._backMaterial = new FluentBackplateMaterial(`${this.name} backPlate`, mesh.getScene());\r\n this._backMaterial.lineWidth = Epsilon;\r\n this._backMaterial.radius = 0.005;\r\n this._backMaterial.backFaceCulling = true;\r\n\r\n this._titleBar.material = this._titleBarMaterial;\r\n this._contentPlate.material = this._contentMaterial;\r\n this._backPlate.material = this._backMaterial;\r\n\r\n this._resetContent();\r\n this._applyContentViewport();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _prepareNode(scene: Scene): void {\r\n super._prepareNode(scene);\r\n this._gizmo = new SlateGizmo(this._host.utilityLayer!);\r\n this._gizmo.attachedSlate = this;\r\n this._defaultBehavior = new DefaultBehavior();\r\n this._defaultBehavior.attach(this.node as Mesh, [this._titleBar]);\r\n this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add(() => {\r\n this._followButton.isToggled = false;\r\n });\r\n\r\n this._positionChangedObserver = this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add(() => {\r\n this._gizmo.updateBoundingBox();\r\n });\r\n\r\n this._updatePivot();\r\n this.resetDefaultAspectAndPose(false);\r\n }\r\n\r\n /**\r\n * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.\r\n * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well\r\n */\r\n public resetDefaultAspectAndPose(resetAspect: boolean = true) {\r\n if (!this._host || !this._host.utilityLayer || !this.node) {\r\n return;\r\n }\r\n const scene = this._host.utilityLayer.utilityLayerScene;\r\n const camera = scene.activeCamera;\r\n if (camera) {\r\n const worldMatrix = camera.getWorldMatrix();\r\n const backward = Vector3.TransformNormal(Vector3.Backward(scene.useRightHandedSystem), worldMatrix);\r\n this.origin.setAll(0);\r\n this._gizmo.updateBoundingBox();\r\n const pivot = this.node.getAbsolutePivotPoint();\r\n this.node.position.copyFrom(camera.position).subtractInPlace(backward).subtractInPlace(pivot);\r\n this.node.rotationQuaternion = Quaternion.FromLookDirectionLH(backward, new Vector3(0, 1, 0));\r\n\r\n if (resetAspect) {\r\n this.dimensions = this.defaultDimensions;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n this._titleBarMaterial.dispose();\r\n this._contentMaterial.dispose();\r\n\r\n this._titleBar.dispose();\r\n this._titleBarTitle.dispose();\r\n this._contentPlate.dispose();\r\n this._backPlate.dispose();\r\n\r\n this._followButton.dispose();\r\n this._closeButton.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver);\r\n\r\n this._defaultBehavior.detach();\r\n this._gizmo.dispose();\r\n this._contentDragBehavior.detach();\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"holographicSlate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicSlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAgB,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,gDAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACtE,OAAO,EAAE,QA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AgB,CAAC,MAAM,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;;AAldD;;GAEG;AACW,gCAAe,GAAW,2CAA2C,AAAtD,CAAuD;AACpF;;GAEG;AACW,oCAAmB,GAAW,eAAe,AAA1B,CAA2B;AAC5D;;GAEG;AACW,qCAAoB,GAAW,kBAAkB,AAA7B,CAA8B;AAEjD,2CAA0B,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import { ContentDisplay3D } from \"./contentDisplay3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { TouchHolographicButton } from \"./touchHolographicButton\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Control } from \"../../2D/controls/control\";\r\nimport { TextBlock, TextWrapping } from \"../../2D/controls/textBlock\";\r\nimport { DefaultBehavior } from \"../behaviors/defaultBehavior\";\r\nimport { SlateGizmo } from \"../gizmos/slateGizmo\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentBackplateMaterial } from \"../materials/fluentBackplate/fluentBackplateMaterial\";\r\nimport { PointerDragBehavior } from \"core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Vector4 } from \"core/Maths/math\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Quaternion, Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Viewport } from \"core/Maths/math.viewport\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Class used to create a holographic slate\r\n * @since 5.0.0\r\n */\r\nexport class HolographicSlate extends ContentDisplay3D {\r\n /**\r\n * Base Url for the assets.\r\n */\r\n public static ASSETS_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static CLOSE_ICON_FILENAME: string = \"IconClose.png\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static FOLLOW_ICON_FILENAME: string = \"IconFollowMe.png\";\r\n\r\n private static _DEFAULT_TEXT_RESOLUTION_Y = 102.4;\r\n\r\n /**\r\n * Margin between title bar and contentplate\r\n */\r\n public titleBarMargin = 0.005;\r\n\r\n /**\r\n * Origin in local coordinates (top left corner)\r\n */\r\n public origin = new Vector3(0, 0, 0);\r\n\r\n private _dimensions = new Vector2(21.875, 12.5);\r\n private _titleBarHeight = 0.625;\r\n\r\n private _titleBarMaterial: FluentBackplateMaterial;\r\n private _backMaterial: FluentBackplateMaterial;\r\n private _contentMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _positionChangedObserver: Nullable<Observer<{ position: Vector3 }>>;\r\n\r\n private _titleText = \"\";\r\n private _titleTextComponent: TextBlock;\r\n\r\n private _contentViewport: Viewport;\r\n private _contentDragBehavior: PointerDragBehavior;\r\n\r\n private _defaultBehavior: DefaultBehavior;\r\n /**\r\n * Regroups all mesh behaviors for the slate\r\n */\r\n public get defaultBehavior(): DefaultBehavior {\r\n return this._defaultBehavior;\r\n }\r\n\r\n /** @internal */\r\n public _gizmo: SlateGizmo;\r\n\r\n protected _titleBar: Mesh;\r\n protected _titleBarTitle: Mesh;\r\n protected _contentPlate: Mesh;\r\n protected _backPlate: Mesh;\r\n /** @internal */\r\n public _followButton: TouchHolographicButton;\r\n protected _closeButton: TouchHolographicButton;\r\n protected override _contentScaleRatio = 1;\r\n\r\n /**\r\n * 2D dimensions of the slate\r\n */\r\n public get dimensions() {\r\n return this._dimensions;\r\n }\r\n public set dimensions(value) {\r\n //clamp, respecting ratios\r\n let scale = 1.0;\r\n if (value.x < this.minDimensions.x || value.y < this.minDimensions.y) {\r\n const newRatio = value.x / value.y;\r\n const minRatio = this.minDimensions.x / this.minDimensions.y;\r\n if (minRatio > newRatio) {\r\n // We just need to make sure the x-val is greater than the min\r\n scale = this.minDimensions.x / value.x;\r\n } else {\r\n // We just need to make sure the y-val is greater than the min\r\n scale = this.minDimensions.y / value.y;\r\n }\r\n }\r\n\r\n this._dimensions.copyFrom(value).scaleInPlace(scale);\r\n this._updatePivot();\r\n this._positionElements();\r\n }\r\n\r\n /**\r\n * Minimum dimensions of the slate\r\n */\r\n public minDimensions = new Vector2(15.625, 6.25);\r\n\r\n /**\r\n * Default dimensions of the slate\r\n */\r\n public readonly defaultDimensions = this._dimensions.clone();\r\n\r\n /**\r\n * Height of the title bar component\r\n */\r\n public get titleBarHeight() {\r\n return this._titleBarHeight;\r\n }\r\n public set titleBarHeight(value) {\r\n this._titleBarHeight = value;\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the meshes\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._titleBar.renderingGroupId = id;\r\n this._titleBarTitle.renderingGroupId = id;\r\n this._contentPlate.renderingGroupId = id;\r\n this._backPlate.renderingGroupId = id;\r\n }\r\n public get renderingGroupId(): number {\r\n return this._titleBar.renderingGroupId;\r\n }\r\n\r\n /**\r\n * The title text displayed at the top of the slate\r\n */\r\n public set title(title: string) {\r\n this._titleText = title;\r\n if (this._titleTextComponent) {\r\n this._titleTextComponent.text = title;\r\n }\r\n }\r\n public get title() {\r\n return this._titleText;\r\n }\r\n\r\n /**\r\n * Creates a new slate\r\n * @param name defines the control name\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n\r\n this._followButton = new TouchHolographicButton(\"followButton\" + this.name);\r\n this._followButton.isToggleButton = true;\r\n this._closeButton = new TouchHolographicButton(\"closeButton\" + this.name);\r\n\r\n this._contentViewport = new Viewport(0, 0, 1, 1);\r\n this._contentDragBehavior = new PointerDragBehavior({\r\n dragPlaneNormal: new Vector3(0, 0, -1),\r\n });\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * This function can be overloaded by child classes\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected override _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._contentMaterial.albedoTexture = facadeTexture;\r\n this._resetContentPositionAndZoom();\r\n this._applyContentViewport();\r\n\r\n facadeTexture.attachToMesh(this._contentPlate, true);\r\n }\r\n\r\n private _addControl(control: Control3D): void {\r\n control._host = this._host;\r\n if (this._host.utilityLayer) {\r\n control._prepareNode(this._host.utilityLayer.utilityLayerScene);\r\n }\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"HolographicSlate\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _positionElements() {\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n const titleBar = this._titleBar;\r\n const titleBarTitle = this._titleBarTitle;\r\n const contentPlate = this._contentPlate;\r\n const backPlate = this._backPlate;\r\n\r\n if (followButton && closeButton && titleBar) {\r\n closeButton.scaling.setAll(this.titleBarHeight);\r\n followButton.scaling.setAll(this.titleBarHeight);\r\n closeButton.position.copyFromFloats(this.dimensions.x - this.titleBarHeight / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n followButton.position.copyFromFloats(this.dimensions.x - (3 * this.titleBarHeight) / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n\r\n const contentPlateHeight = this.dimensions.y - this.titleBarHeight - this.titleBarMargin;\r\n const rightHandScene = contentPlate.getScene().useRightHandedSystem;\r\n\r\n titleBar.scaling.set(this.dimensions.x, this.titleBarHeight, Epsilon);\r\n titleBarTitle.scaling.set(this.dimensions.x - 2 * this.titleBarHeight, this.titleBarHeight, Epsilon);\r\n contentPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n backPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n\r\n titleBar.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight / 2), 0).addInPlace(this.origin);\r\n titleBarTitle.position\r\n .copyFromFloats(this.dimensions.x / 2 - this.titleBarHeight, -(this.titleBarHeight / 2), rightHandScene ? Epsilon : -Epsilon)\r\n .addInPlace(this.origin);\r\n contentPlate.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), 0).addInPlace(this.origin);\r\n backPlate.position\r\n .copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), rightHandScene ? -Epsilon : Epsilon)\r\n .addInPlace(this.origin);\r\n\r\n // Update the title's AdvancedDynamicTexture scale to avoid visual stretching\r\n this._titleTextComponent.host.scaleTo(\r\n (HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y * titleBarTitle.scaling.x) / titleBarTitle.scaling.y,\r\n HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y\r\n );\r\n\r\n const aspectRatio = this.dimensions.x / contentPlateHeight;\r\n this._contentViewport.width = this._contentScaleRatio;\r\n this._contentViewport.height = this._contentScaleRatio / aspectRatio;\r\n\r\n this._applyContentViewport();\r\n if (this._gizmo) {\r\n this._gizmo.updateBoundingBox();\r\n }\r\n }\r\n }\r\n\r\n private _applyContentViewport() {\r\n if (this._contentPlate?.material && (this._contentPlate.material as FluentMaterial).albedoTexture) {\r\n const tex = (this._contentPlate.material as FluentMaterial).albedoTexture as Texture;\r\n tex.uScale = this._contentScaleRatio;\r\n tex.vScale = (this._contentScaleRatio / this._contentViewport.width) * this._contentViewport.height;\r\n tex.uOffset = this._contentViewport.x;\r\n tex.vOffset = this._contentViewport.y;\r\n }\r\n }\r\n\r\n private _resetContentPositionAndZoom() {\r\n this._contentViewport.x = 0;\r\n this._contentViewport.y = 1 - this._contentViewport.height / this._contentViewport.width;\r\n this._contentScaleRatio = 1;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updatePivot() {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n // Update pivot point so it is at the center of geometry\r\n // As origin is topleft corner in 2D, dimensions are calculated towards bottom right corner, thus y axis is downwards\r\n const center = new Vector3(this.dimensions.x * 0.5, -this.dimensions.y * 0.5, Epsilon);\r\n center.addInPlace(this.origin);\r\n center.z = 0;\r\n\r\n const origin = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin, this.mesh.computeWorldMatrix(true), origin);\r\n this.mesh.setPivotPoint(center);\r\n const origin2 = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin2, this.mesh.computeWorldMatrix(true), origin2);\r\n this.mesh.position.addInPlace(origin).subtractInPlace(origin2);\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n const node = new Mesh(\"slate_\" + this.name, scene);\r\n\r\n this._titleBar = CreateBox(\"titleBar_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle = CreatePlane(\"titleText_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle.parent = node;\r\n this._titleBarTitle.isPickable = false;\r\n\r\n const adt = AdvancedDynamicTexture.CreateForMesh(this._titleBarTitle);\r\n this._titleTextComponent = new TextBlock(\"titleText_\" + this.name, this._titleText);\r\n this._titleTextComponent.textWrapping = TextWrapping.Ellipsis;\r\n this._titleTextComponent.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._titleTextComponent.color = \"white\";\r\n this._titleTextComponent.fontSize = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 2;\r\n this._titleTextComponent.paddingLeft = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 4;\r\n adt.addControl(this._titleTextComponent);\r\n\r\n if (scene.useRightHandedSystem) {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE }, scene);\r\n } else {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE }, scene);\r\n }\r\n\r\n this._titleBar.parent = node;\r\n this._titleBar.isNearGrabbable = true;\r\n this._contentPlate.parent = node;\r\n this._backPlate.parent = node;\r\n this._attachContentPlateBehavior();\r\n\r\n this._addControl(this._followButton);\r\n this._addControl(this._closeButton);\r\n\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n\r\n followButton.node!.parent = node;\r\n closeButton.node!.parent = node;\r\n\r\n this._positionElements();\r\n\r\n this._followButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.FOLLOW_ICON_FILENAME;\r\n this._closeButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.CLOSE_ICON_FILENAME;\r\n\r\n this._followButton.isBackplateVisible = false;\r\n this._closeButton.isBackplateVisible = false;\r\n\r\n this._followButton.onToggleObservable.add((isToggled) => {\r\n this._defaultBehavior.followBehaviorEnabled = isToggled;\r\n if (this._defaultBehavior.followBehaviorEnabled) {\r\n this._defaultBehavior.followBehavior.recenter();\r\n }\r\n });\r\n\r\n this._closeButton.onPointerClickObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n node.rotationQuaternion = Quaternion.Identity();\r\n node.isVisible = false;\r\n\r\n return node;\r\n }\r\n\r\n private _attachContentPlateBehavior() {\r\n this._contentDragBehavior.attach(this._contentPlate);\r\n this._contentDragBehavior.moveAttached = false;\r\n this._contentDragBehavior.useObjectOrientationForDragging = true;\r\n this._contentDragBehavior.updateDragPlane = false;\r\n\r\n const origin = new Vector3();\r\n const worldDimensions = new Vector3();\r\n const upWorld = new Vector3();\r\n const rightWorld = new Vector3();\r\n const projectedOffset = new Vector2();\r\n let startViewport: Viewport;\r\n let worldMatrix: Matrix;\r\n\r\n this._contentDragBehavior.onDragStartObservable.add((event) => {\r\n if (!this.node) {\r\n return;\r\n }\r\n startViewport = this._contentViewport.clone();\r\n worldMatrix = this.node.computeWorldMatrix(true);\r\n\r\n origin.copyFrom(event.dragPlanePoint);\r\n worldDimensions.set(this.dimensions.x, this.dimensions.y, Epsilon);\r\n worldDimensions.y -= this.titleBarHeight + this.titleBarMargin;\r\n Vector3.TransformNormalToRef(worldDimensions, worldMatrix, worldDimensions);\r\n upWorld.copyFromFloats(0, 1, 0);\r\n Vector3.TransformNormalToRef(upWorld, worldMatrix, upWorld);\r\n rightWorld.copyFromFloats(1, 0, 0);\r\n Vector3.TransformNormalToRef(rightWorld, worldMatrix, rightWorld);\r\n upWorld.normalize();\r\n upWorld.scaleInPlace(1 / Vector3.Dot(upWorld, worldDimensions));\r\n rightWorld.normalize();\r\n rightWorld.scaleInPlace(1 / Vector3.Dot(rightWorld, worldDimensions));\r\n });\r\n\r\n const offset = new Vector3();\r\n this._contentDragBehavior.onDragObservable.add((event) => {\r\n offset.copyFrom(event.dragPlanePoint);\r\n offset.subtractInPlace(origin);\r\n projectedOffset.copyFromFloats(Vector3.Dot(offset, rightWorld), Vector3.Dot(offset, upWorld));\r\n\r\n // By default, content takes full width available and height is cropped to keep aspect ratio\r\n this._contentViewport.x = Scalar.Clamp(startViewport.x - offset.x, 0, 1 - this._contentViewport.width * this._contentScaleRatio);\r\n this._contentViewport.y = Scalar.Clamp(startViewport.y - offset.y, 0, 1 - this._contentViewport.height * this._contentScaleRatio);\r\n this._applyContentViewport();\r\n });\r\n }\r\n\r\n protected override _affectMaterial(mesh: AbstractMesh) {\r\n // TODO share materials\r\n this._titleBarMaterial = new FluentBackplateMaterial(`${this.name} plateMaterial`, mesh.getScene());\r\n\r\n this._contentMaterial = new FluentMaterial(`${this.name} contentMaterial`, mesh.getScene());\r\n this._contentMaterial.renderBorders = true;\r\n\r\n this._backMaterial = new FluentBackplateMaterial(`${this.name} backPlate`, mesh.getScene());\r\n this._backMaterial.lineWidth = Epsilon;\r\n this._backMaterial.radius = 0.005;\r\n this._backMaterial.backFaceCulling = true;\r\n\r\n this._titleBar.material = this._titleBarMaterial;\r\n this._contentPlate.material = this._contentMaterial;\r\n this._backPlate.material = this._backMaterial;\r\n\r\n this._resetContent();\r\n this._applyContentViewport();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _prepareNode(scene: Scene): void {\r\n super._prepareNode(scene);\r\n this._gizmo = new SlateGizmo(this._host.utilityLayer!);\r\n this._gizmo.attachedSlate = this;\r\n this._defaultBehavior = new DefaultBehavior();\r\n this._defaultBehavior.attach(this.node as Mesh, [this._titleBar]);\r\n this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add(() => {\r\n this._followButton.isToggled = false;\r\n });\r\n\r\n this._positionChangedObserver = this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add(() => {\r\n this._gizmo.updateBoundingBox();\r\n });\r\n\r\n this._updatePivot();\r\n this.resetDefaultAspectAndPose(false);\r\n }\r\n\r\n /**\r\n * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.\r\n * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well\r\n */\r\n public resetDefaultAspectAndPose(resetAspect: boolean = true) {\r\n if (!this._host || !this._host.utilityLayer || !this.node) {\r\n return;\r\n }\r\n const scene = this._host.utilityLayer.utilityLayerScene;\r\n const camera = scene.activeCamera;\r\n if (camera) {\r\n const worldMatrix = camera.getWorldMatrix();\r\n const backward = Vector3.TransformNormal(Vector3.Backward(scene.useRightHandedSystem), worldMatrix);\r\n this.origin.setAll(0);\r\n this._gizmo.updateBoundingBox();\r\n const pivot = this.node.getAbsolutePivotPoint();\r\n this.node.position.copyFrom(camera.position).subtractInPlace(backward).subtractInPlace(pivot);\r\n this.node.rotationQuaternion = Quaternion.FromLookDirectionLH(backward, new Vector3(0, 1, 0));\r\n\r\n if (resetAspect) {\r\n this.dimensions = this.defaultDimensions;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n this._titleBarMaterial.dispose();\r\n this._contentMaterial.dispose();\r\n\r\n this._titleBar.dispose();\r\n this._titleBarTitle.dispose();\r\n this._contentPlate.dispose();\r\n this._backPlate.dispose();\r\n\r\n this._followButton.dispose();\r\n this._closeButton.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver);\r\n\r\n this._defaultBehavior.detach();\r\n this._gizmo.dispose();\r\n this._contentDragBehavior.detach();\r\n }\r\n}\r\n"]}
|
@@ -2,7 +2,7 @@ import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
2
2
|
import { Matrix, TmpVectors, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
3
3
|
import { VolumeBasedPanel } from "./volumeBasedPanel.js";
|
4
4
|
import { Container3D } from "./container3D.js";
|
5
|
-
import { Axis
|
5
|
+
import { Axis } from "@babylonjs/core/Maths/math.axis.js";
|
6
6
|
/**
|
7
7
|
* Class used to create a container panel deployed on the surface of a sphere
|
8
8
|
*/
|
@@ -43,7 +43,7 @@ export class SpherePanel extends VolumeBasedPanel {
|
|
43
43
|
case Container3D.FACEFORWARD_ORIENTATION:
|
44
44
|
break;
|
45
45
|
case Container3D.FACEFORWARDREVERSED_ORIENTATION:
|
46
|
-
mesh.rotate(Axis.Y, Math.PI, Space.LOCAL);
|
46
|
+
mesh.rotate(Axis.Y, Math.PI, 0 /* Space.LOCAL */);
|
47
47
|
break;
|
48
48
|
}
|
49
49
|
}
|