@babylonjs/gui 7.12.0 → 7.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/controls/textBlock.d.ts +1 -1
- package/2D/controls/textBlock.js +5 -5
- package/2D/controls/textBlock.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
@@ -6,7 +6,7 @@ import type { ICanvasRenderingContext } from "@babylonjs/core/Engines/ICanvas.js
|
|
6
6
|
/**
|
7
7
|
* Enum that determines the text-wrapping mode to use.
|
8
8
|
*/
|
9
|
-
export declare enum TextWrapping {
|
9
|
+
export declare const enum TextWrapping {
|
10
10
|
/**
|
11
11
|
* Clip the text when it's larger than Control.width; this is the default mode.
|
12
12
|
*/
|
package/2D/controls/textBlock.js
CHANGED
@@ -259,7 +259,7 @@ export class TextBlock extends Control {
|
|
259
259
|
super(name);
|
260
260
|
this.name = name;
|
261
261
|
this._text = "";
|
262
|
-
this._textWrapping = TextWrapping.Clip
|
262
|
+
this._textWrapping = 0 /* TextWrapping.Clip */;
|
263
263
|
this._textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
|
264
264
|
this._textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
|
265
265
|
this._resizeToFit = false;
|
@@ -301,7 +301,7 @@ export class TextBlock extends Control {
|
|
301
301
|
}
|
302
302
|
}
|
303
303
|
if (this._resizeToFit) {
|
304
|
-
if (this._textWrapping === TextWrapping.Clip || this._forceResizeWidth) {
|
304
|
+
if (this._textWrapping === 0 /* TextWrapping.Clip */ || this._forceResizeWidth) {
|
305
305
|
const newWidth = Math.ceil(this._paddingLeftInPixels) + Math.ceil(this._paddingRightInPixels) + Math.ceil(maxLineWidth);
|
306
306
|
if (newWidth !== this._width.getValueInPixel(this._host, this._tempParentMeasure.width)) {
|
307
307
|
this._width.updateInPlace(newWidth, ValueAndUnit.UNITMODE_PIXEL);
|
@@ -395,17 +395,17 @@ export class TextBlock extends Control {
|
|
395
395
|
_breakLines(refWidth, refHeight, context) {
|
396
396
|
this._linesTemp.length = 0;
|
397
397
|
const _lines = this.text.split("\n");
|
398
|
-
if (this._textWrapping === TextWrapping.Ellipsis) {
|
398
|
+
if (this._textWrapping === 2 /* TextWrapping.Ellipsis */) {
|
399
399
|
for (const _line of _lines) {
|
400
400
|
this._linesTemp.push(this._parseLineEllipsis(_line, refWidth, context));
|
401
401
|
}
|
402
402
|
}
|
403
|
-
else if (this._textWrapping === TextWrapping.WordWrap) {
|
403
|
+
else if (this._textWrapping === 1 /* TextWrapping.WordWrap */) {
|
404
404
|
for (const _line of _lines) {
|
405
405
|
this._linesTemp.push(...this._parseLineWordWrap(_line, refWidth, context));
|
406
406
|
}
|
407
407
|
}
|
408
|
-
else if (this._textWrapping === TextWrapping.WordWrapEllipsis) {
|
408
|
+
else if (this._textWrapping === 3 /* TextWrapping.WordWrapEllipsis */) {
|
409
409
|
for (const _line of _lines) {
|
410
410
|
this._linesTemp.push(...this._parseLineWordWrapEllipsis(_line, refWidth, refHeight, context));
|
411
411
|
}
|
@@ -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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S,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;0CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAiBD;IADC,SAAS,EAAE;wDAGX;AAcD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAmBD;IADC,SAAS,EAAE;iDAGX;AA+WL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Measure } from \"../measure\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext, ITextMetrics } from \"core/Engines/ICanvas\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\n\r\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nexport enum TextWrapping {\r\n /**\r\n * Clip the text when it's larger than Control.width; this is the default mode.\r\n */\r\n Clip = 0,\r\n\r\n /**\r\n * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.\r\n */\r\n WordWrap = 1,\r\n\r\n /**\r\n * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.\r\n */\r\n Ellipsis = 2,\r\n\r\n /**\r\n * Wrap the text word-wise and clip the text when the text's height is larger than the Control.height, and shrink the last line with trailing … .\r\n */\r\n WordWrapEllipsis,\r\n}\r\n\r\n/**\r\n * Class used to create text block control\r\n */\r\nexport class TextBlock extends Control {\r\n private _text = \"\";\r\n private _textWrapping = TextWrapping.Clip;\r\n private _textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n private _textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n\r\n private _lines: any[];\r\n private _resizeToFit: boolean = false;\r\n private _lineSpacing: ValueAndUnit = new ValueAndUnit(0);\r\n private _outlineWidth: number = 0;\r\n private _outlineColor: string = \"white\";\r\n private _underline: boolean = false;\r\n private _lineThrough: boolean = false;\r\n private _wordDivider: string = \" \";\r\n private _forceResizeWidth: boolean = false;\r\n private _applyOutlineToUnderline: boolean = false;\r\n\r\n /**\r\n * An event triggered after the text is changed\r\n */\r\n public onTextChangedObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * An event triggered after the text was broken up into lines\r\n */\r\n public onLinesReadyObservable = new Observable<TextBlock>();\r\n\r\n /**\r\n * Function used to split a string into words. By default, a string is split at each space character found\r\n */\r\n public wordSplittingFunction: Nullable<(line: string) => string[]>;\r\n\r\n /**\r\n * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)\r\n */\r\n public get lines(): any[] {\r\n return this._lines;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n @serialize()\r\n public get resizeToFit(): boolean {\r\n return this._resizeToFit;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the TextBlock will be resized to fit its content\r\n\r\n */\r\n public set resizeToFit(value: boolean) {\r\n if (this._resizeToFit === value) {\r\n return;\r\n }\r\n this._resizeToFit = value;\r\n\r\n if (this._resizeToFit) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n @serialize()\r\n public get textWrapping(): TextWrapping | boolean {\r\n return this._textWrapping;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n public set textWrapping(value: TextWrapping | boolean) {\r\n if (this._textWrapping === value) {\r\n return;\r\n }\r\n this._textWrapping = +value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n @serialize()\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n /**\r\n * Gets or sets text to display\r\n */\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n this._text = value + \"\"; // Making sure it is a text\r\n this._markAsDirty();\r\n\r\n this.onTextChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textHorizontalAlignment(): number {\r\n return this._textHorizontalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textHorizontalAlignment(value: number) {\r\n if (this._textHorizontalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textHorizontalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n @serialize()\r\n public get textVerticalAlignment(): number {\r\n return this._textVerticalAlignment;\r\n }\r\n\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n public set textVerticalAlignment(value: number) {\r\n if (this._textVerticalAlignment === value) {\r\n return;\r\n }\r\n\r\n this._textVerticalAlignment = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n @serialize()\r\n public set lineSpacing(value: string | number) {\r\n if (this._lineSpacing.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n public get lineSpacing(): string | number {\r\n return this._lineSpacing.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n @serialize()\r\n public get outlineWidth(): number {\r\n return this._outlineWidth;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n public set outlineWidth(value: number) {\r\n if (this._outlineWidth === value) {\r\n return;\r\n }\r\n this._outlineWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n @serialize()\r\n public get underline(): boolean {\r\n return this._underline;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n public set underline(value: boolean) {\r\n if (this._underline === value) {\r\n return;\r\n }\r\n this._underline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n @serialize()\r\n public get lineThrough(): boolean {\r\n return this._lineThrough;\r\n }\r\n\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n public set lineThrough(value: boolean) {\r\n if (this._lineThrough === value) {\r\n return;\r\n }\r\n this._lineThrough = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * If the outline should be applied to the underline/strike-through too. Has different behavior in Edge/Chrome vs Firefox.\r\n */\r\n @serialize()\r\n public get applyOutlineToUnderline(): boolean {\r\n return this._applyOutlineToUnderline;\r\n }\r\n\r\n public set applyOutlineToUnderline(value: boolean) {\r\n if (this._applyOutlineToUnderline === value) {\r\n return;\r\n }\r\n this._applyOutlineToUnderline = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n @serialize()\r\n public get outlineColor(): string {\r\n return this._outlineColor;\r\n }\r\n\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n public set outlineColor(value: string) {\r\n if (this._outlineColor === value) {\r\n return;\r\n }\r\n this._outlineColor = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n @serialize()\r\n public get wordDivider(): string {\r\n return this._wordDivider;\r\n }\r\n\r\n /**\r\n * Gets or sets word divider\r\n */\r\n public set wordDivider(value: string) {\r\n if (this._wordDivider === value) {\r\n return;\r\n }\r\n this._wordDivider = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * By default, if a text block has text wrapping other than Clip, its width\r\n * is not resized even if resizeToFit = true. This parameter forces the width\r\n * to be resized.\r\n */\r\n @serialize()\r\n public get forceResizeWidth(): boolean {\r\n return this._forceResizeWidth;\r\n }\r\n\r\n public set forceResizeWidth(value: boolean) {\r\n if (this._forceResizeWidth === value) {\r\n return;\r\n }\r\n this._forceResizeWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new TextBlock object\r\n * @param name defines the name of the control\r\n * @param text defines the text to display (empty string by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the control\r\n */\r\n public override name?: string,\r\n text: string = \"\"\r\n ) {\r\n super(name);\r\n\r\n this.text = text;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TextBlock\";\r\n }\r\n\r\n protected override _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (!this._fontOffset || this.isDirty) {\r\n this._fontOffset = Control._GetFontOffset(context.font, 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;IACx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OAAO,CAAC,CAAC;IACb,CAAC;IAEQ,OAAO;QACZ,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;CACJ;AA5lBG;IADC,SAAS,EAAE;4CAGX;AAwBD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;qCAGX;AAmBD;IADC,SAAS,EAAE;wDAGX;AAkBD;IADC,SAAS,EAAE;sDAGX;AAkBD;IADC,SAAS,EAAE;4CAKX;AAaD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;0CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAiBD;IADC,SAAS,EAAE;wDAGX;AAcD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;4CAGX;AAmBD;IADC,SAAS,EAAE;iDAGX;AA+WL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Measure } from \"../measure\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext, ITextMetrics } from \"core/Engines/ICanvas\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\n\r\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nexport 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"]}
|
@@ -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,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AK,WAAW,CAAC,sBAAsB;gBACnC,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/D,MAAM;YACV,KAAK,WAAW,CAAC,8BAA8B;gBAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzD,MAAM;YACV,KAAK,WAAW,CAAC,uBAAuB;gBACpC,MAAM;YACV,KAAK,WAAW,CAAC,+BAA+B;gBAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,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,sDAA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;QAC7B,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAE5B,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC5E,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAE3G,IAAI,CAAC,gBAAgB,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"]}
|
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,OAA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AO,EAAE,CAAC;QAEhC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAE1B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAE5B,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC5E,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAE3G,IAAI,CAAC,gBAAgB,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
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"spherePanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/spherePanel.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":"spherePanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/spherePanel.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;AAC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AC,+BAA+B;gBAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,sBAAc,CAAC;gBAC1C,MAAM;SACb;IACL,CAAC;IAEO,iBAAiB,CAAC,MAAe;QACrC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACvC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAE1C,MAAM,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1E,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 sphere\r\n */\r\nexport class SpherePanel extends VolumeBasedPanel {\r\n private _radius = 5.0;\r\n\r\n /**\r\n * Gets or sets the radius of the sphere 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\r\n const newPos = this._sphericalMapping(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, 2 * 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 _sphericalMapping(source: Vector3) {\r\n const newPos = new Vector3(0, 0, this._radius);\r\n\r\n const xAngle = source.y / this._radius;\r\n const yAngle = -(source.x / this._radius);\r\n\r\n Matrix.RotationYawPitchRollToRef(yAngle, xAngle, 0, TmpVectors.Matrix[0]);\r\n\r\n return Vector3.TransformNormal(newPos, TmpVectors.Matrix[0]);\r\n }\r\n}\r\n"]}
|
package/3D/gizmos/gizmoHandle.js
CHANGED
@@ -42,10 +42,10 @@ export class GizmoHandle {
|
|
42
42
|
*/
|
43
43
|
set hover(value) {
|
44
44
|
if (value) {
|
45
|
-
this._state |= HandleState.HOVER
|
45
|
+
this._state |= 1 /* HandleState.HOVER */;
|
46
46
|
}
|
47
47
|
else {
|
48
|
-
this._state &= ~HandleState.HOVER
|
48
|
+
this._state &= ~1 /* HandleState.HOVER */;
|
49
49
|
}
|
50
50
|
this._updateMaterial();
|
51
51
|
}
|
@@ -54,10 +54,10 @@ export class GizmoHandle {
|
|
54
54
|
*/
|
55
55
|
set drag(value) {
|
56
56
|
if (value) {
|
57
|
-
this._state |= HandleState.DRAG
|
57
|
+
this._state |= 2 /* HandleState.DRAG */;
|
58
58
|
}
|
59
59
|
else {
|
60
|
-
this._state &= ~HandleState.DRAG
|
60
|
+
this._state &= ~2 /* HandleState.DRAG */;
|
61
61
|
}
|
62
62
|
this._updateMaterial();
|
63
63
|
}
|
@@ -67,7 +67,7 @@ export class GizmoHandle {
|
|
67
67
|
* @param scene scene
|
68
68
|
*/
|
69
69
|
constructor(gizmo, scene) {
|
70
|
-
this._state = HandleState.IDLE
|
70
|
+
this._state = 0 /* HandleState.IDLE */;
|
71
71
|
this._materials = [];
|
72
72
|
this._scene = scene;
|
73
73
|
this._gizmo = gizmo;
|
@@ -89,12 +89,12 @@ export class GizmoHandle {
|
|
89
89
|
mat.hover = false;
|
90
90
|
mat.drag = false;
|
91
91
|
}
|
92
|
-
if (state & HandleState.DRAG) {
|
92
|
+
if (state & 2 /* HandleState.DRAG */) {
|
93
93
|
for (const mat of this._materials) {
|
94
94
|
mat.drag = true;
|
95
95
|
}
|
96
96
|
}
|
97
|
-
else if (state & HandleState.HOVER) {
|
97
|
+
else if (state & 1 /* HandleState.HOVER */) {
|
98
98
|
for (const mat of this._materials) {
|
99
99
|
mat.hover = true;
|
100
100
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gizmoHandle.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/gizmos/gizmoHandle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,mEAAqD;AAItF;;GAEG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACnB;;OAEG;IACH,6CAAQ,CAAA;IACR;;OAEG;IACH,+CAAS,CAAA;IACT;;OAEG;IACH,6CAAQ,CAAA;AACZ,CAAC,EAbW,WAAW,KAAX,WAAW,QAatB;AAED;;GAEG;AACH,MAAM,OAAgB,WAAW;IAa7B;;OAEG;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,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAE7F,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1D,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC;QACjC,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC;QAE/B,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACpE,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAClE,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC;QACnC,aAAa,CAAC,eAAe,GAAG,IAAI,CAAC;QAErC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,QAA0B,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,QAA0B,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { HandleMaterial } from \"../materials/handle/handleMaterial\";\r\nimport type { SlateGizmo } from \"./slateGizmo\";\r\nimport { BaseSixDofDragBehavior } from \"core/Behaviors/Meshes/baseSixDofDragBehavior\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\n\r\n/**\r\n * State of the handle regarding user interaction\r\n */\r\nexport enum HandleState {\r\n /**\r\n * Handle is idle\r\n */\r\n IDLE = 0,\r\n /**\r\n * Handle is hovered\r\n */\r\n HOVER = 1,\r\n /**\r\n * Handle is dragged\r\n */\r\n DRAG = 2,\r\n}\r\n\r\n/**\r\n * Base class for SlateGizmo handles\r\n */\r\nexport abstract class GizmoHandle {\r\n protected _scene: Scene;\r\n protected _state: HandleState = HandleState.IDLE;\r\n protected _materials: HandleMaterial[] = [];\r\n\r\n private _dragStartObserver: Nullable<Observer<any>>;\r\n private _draggingObserver: Nullable<Observer<any>>;\r\n private _dragEndObserver: Nullable<Observer<any>>;\r\n /**\r\n * @internal\r\n */\r\n public _dragBehavior: BaseSixDofDragBehavior;\r\n\r\n /**\r\n * The current state of the handle\r\n */\r\n public get state(): HandleState {\r\n return this._state;\r\n }\r\n\r\n private _gizmo: SlateGizmo;\r\n\r\n /**\r\n * Returns the gizmo carrying this handle\r\n */\r\n public get gizmo() {\r\n return this._gizmo;\r\n }\r\n\r\n /**\r\n * Sets hover state\r\n */\r\n public set hover(value: boolean) {\r\n if (value) {\r\n this._state |= HandleState.HOVER;\r\n } else {\r\n this._state &= ~HandleState.HOVER;\r\n }\r\n\r\n this._updateMaterial();\r\n }\r\n /**\r\n * Sets drag state\r\n */\r\n public set drag(value: boolean) {\r\n if (value) {\r\n this._state |= HandleState.DRAG;\r\n } else {\r\n this._state &= ~HandleState.DRAG;\r\n }\r\n\r\n this._updateMaterial();\r\n }\r\n\r\n /**\r\n * Node of this handle\r\n */\r\n public node: TransformNode;\r\n\r\n /**\r\n * Creates a handle for a SlateGizmo\r\n * @param gizmo associated SlateGizmo\r\n * @param scene scene\r\n */\r\n constructor(gizmo: SlateGizmo, scene: Scene) {\r\n this._scene = scene;\r\n this._gizmo = gizmo;\r\n\r\n this.node = this.createNode();\r\n this.node.reservedDataStore = {\r\n handle: this,\r\n };\r\n }\r\n\r\n protected _createMaterial(positionOffset?: Vector3) {\r\n const mat = new HandleMaterial(\"handle\", this._scene);\r\n if (positionOffset) {\r\n mat._positionOffset = positionOffset;\r\n }\r\n return mat;\r\n }\r\n\r\n private _updateMaterial() {\r\n const state = this._state;\r\n for (const mat of this._materials) {\r\n mat.hover = false;\r\n mat.drag = false;\r\n }\r\n\r\n if (state & HandleState.DRAG) {\r\n for (const mat of this._materials) {\r\n mat.drag = true;\r\n }\r\n } else if (state & HandleState.HOVER) {\r\n for (const mat of this._materials) {\r\n mat.hover = true;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Binds callbacks from dragging interaction\r\n * @param dragStartFn Function to call on drag start\r\n * @param dragFn Function to call on drag\r\n * @param dragEndFn Function to call on drag end\r\n */\r\n public setDragBehavior(dragStartFn: (event: { position: Vector3 }) => void, dragFn: (event: { position: Vector3 }) => void, dragEndFn: () => void) {\r\n const dragBehavior = new BaseSixDofDragBehavior();\r\n\r\n this._dragBehavior = dragBehavior;\r\n\r\n this._dragStartObserver = dragBehavior.onDragStartObservable.add(dragStartFn);\r\n this._draggingObserver = dragBehavior.onDragObservable.add(dragFn);\r\n this._dragEndObserver = dragBehavior.onDragEndObservable.add(dragEndFn);\r\n\r\n this._dragBehavior.attach(this.node);\r\n }\r\n\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * Should be overridden by child classes\r\n * @returns created node\r\n */\r\n public abstract createNode(): TransformNode;\r\n\r\n /**\r\n * Disposes the handle\r\n */\r\n public dispose() {\r\n this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver);\r\n this._dragBehavior.onDragObservable.remove(this._draggingObserver);\r\n this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver);\r\n\r\n this._dragBehavior.detach();\r\n\r\n for (const material of this._materials) {\r\n material.dispose();\r\n }\r\n this.node.dispose();\r\n }\r\n}\r\n\r\n/**\r\n * Side handle class that rotates the slate\r\n */\r\nexport class SideHandle extends GizmoHandle {\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * @returns created node\r\n */\r\n public createNode() {\r\n // Create a simple vertical rectangle\r\n const verticalBox = CreateBox(\"sideVert\", { width: 1, height: 10, depth: 0.1 }, this._scene);\r\n const sideNode = new TransformNode(\"side\", this._scene);\r\n verticalBox.parent = sideNode;\r\n\r\n const mat = this._createMaterial();\r\n verticalBox.material = mat;\r\n verticalBox.isNearGrabbable = true;\r\n this._materials.push(mat);\r\n\r\n return sideNode;\r\n }\r\n}\r\n\r\n/**\r\n * Corner handle that resizes the slate\r\n */\r\nexport class CornerHandle extends GizmoHandle {\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * @returns created node\r\n */\r\n public createNode() {\r\n // Create 2 boxes making a bottom left corner\r\n const horizontalBox = CreateBox(\"angleHor\", { width: 3, height: 1, depth: 0.1 }, this._scene);\r\n const verticalBox = CreateBox(\"angleVert\", { width: 1, height: 3, depth: 0.1 }, this._scene);\r\n\r\n const angleNode = new TransformNode(\"angle\", this._scene);\r\n horizontalBox.parent = angleNode;\r\n verticalBox.parent = angleNode;\r\n\r\n horizontalBox.material = this._createMaterial(new Vector3(1, 0, 0));\r\n verticalBox.material = this._createMaterial(new Vector3(0, 1, 0));\r\n verticalBox.isNearGrabbable = true;\r\n horizontalBox.isNearGrabbable = true;\r\n\r\n this._materials.push(horizontalBox.material as HandleMaterial);\r\n this._materials.push(verticalBox.material as HandleMaterial);\r\n return angleNode;\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"gizmoHandle.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/gizmos/gizmoHandle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,mEAAqD;AAItF;;GAEG;AACH,MAAM,CAAN,IAAkB,WAajB;AAbD,WAAkB,WAAW;IACzB;;OAEG;IACH,6CAAQ,CAAA;IACR;;OAEG;IACH,+CAAS,CAAA;IACT;;OAEG;IACH,6CAAQ,CAAA;AACZ,C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E,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAE7F,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1D,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC;QACjC,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC;QAE/B,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACpE,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAClE,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC;QACnC,aAAa,CAAC,eAAe,GAAG,IAAI,CAAC;QAErC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,QAA0B,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,QAA0B,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { HandleMaterial } from \"../materials/handle/handleMaterial\";\r\nimport type { SlateGizmo } from \"./slateGizmo\";\r\nimport { BaseSixDofDragBehavior } from \"core/Behaviors/Meshes/baseSixDofDragBehavior\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\n\r\n/**\r\n * State of the handle regarding user interaction\r\n */\r\nexport const enum HandleState {\r\n /**\r\n * Handle is idle\r\n */\r\n IDLE = 0,\r\n /**\r\n * Handle is hovered\r\n */\r\n HOVER = 1,\r\n /**\r\n * Handle is dragged\r\n */\r\n DRAG = 2,\r\n}\r\n\r\n/**\r\n * Base class for SlateGizmo handles\r\n */\r\nexport abstract class GizmoHandle {\r\n protected _scene: Scene;\r\n protected _state: HandleState = HandleState.IDLE;\r\n protected _materials: HandleMaterial[] = [];\r\n\r\n private _dragStartObserver: Nullable<Observer<any>>;\r\n private _draggingObserver: Nullable<Observer<any>>;\r\n private _dragEndObserver: Nullable<Observer<any>>;\r\n /**\r\n * @internal\r\n */\r\n public _dragBehavior: BaseSixDofDragBehavior;\r\n\r\n /**\r\n * The current state of the handle\r\n */\r\n public get state(): HandleState {\r\n return this._state;\r\n }\r\n\r\n private _gizmo: SlateGizmo;\r\n\r\n /**\r\n * Returns the gizmo carrying this handle\r\n */\r\n public get gizmo() {\r\n return this._gizmo;\r\n }\r\n\r\n /**\r\n * Sets hover state\r\n */\r\n public set hover(value: boolean) {\r\n if (value) {\r\n this._state |= HandleState.HOVER;\r\n } else {\r\n this._state &= ~HandleState.HOVER;\r\n }\r\n\r\n this._updateMaterial();\r\n }\r\n /**\r\n * Sets drag state\r\n */\r\n public set drag(value: boolean) {\r\n if (value) {\r\n this._state |= HandleState.DRAG;\r\n } else {\r\n this._state &= ~HandleState.DRAG;\r\n }\r\n\r\n this._updateMaterial();\r\n }\r\n\r\n /**\r\n * Node of this handle\r\n */\r\n public node: TransformNode;\r\n\r\n /**\r\n * Creates a handle for a SlateGizmo\r\n * @param gizmo associated SlateGizmo\r\n * @param scene scene\r\n */\r\n constructor(gizmo: SlateGizmo, scene: Scene) {\r\n this._scene = scene;\r\n this._gizmo = gizmo;\r\n\r\n this.node = this.createNode();\r\n this.node.reservedDataStore = {\r\n handle: this,\r\n };\r\n }\r\n\r\n protected _createMaterial(positionOffset?: Vector3) {\r\n const mat = new HandleMaterial(\"handle\", this._scene);\r\n if (positionOffset) {\r\n mat._positionOffset = positionOffset;\r\n }\r\n return mat;\r\n }\r\n\r\n private _updateMaterial() {\r\n const state = this._state;\r\n for (const mat of this._materials) {\r\n mat.hover = false;\r\n mat.drag = false;\r\n }\r\n\r\n if (state & HandleState.DRAG) {\r\n for (const mat of this._materials) {\r\n mat.drag = true;\r\n }\r\n } else if (state & HandleState.HOVER) {\r\n for (const mat of this._materials) {\r\n mat.hover = true;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Binds callbacks from dragging interaction\r\n * @param dragStartFn Function to call on drag start\r\n * @param dragFn Function to call on drag\r\n * @param dragEndFn Function to call on drag end\r\n */\r\n public setDragBehavior(dragStartFn: (event: { position: Vector3 }) => void, dragFn: (event: { position: Vector3 }) => void, dragEndFn: () => void) {\r\n const dragBehavior = new BaseSixDofDragBehavior();\r\n\r\n this._dragBehavior = dragBehavior;\r\n\r\n this._dragStartObserver = dragBehavior.onDragStartObservable.add(dragStartFn);\r\n this._draggingObserver = dragBehavior.onDragObservable.add(dragFn);\r\n this._dragEndObserver = dragBehavior.onDragEndObservable.add(dragEndFn);\r\n\r\n this._dragBehavior.attach(this.node);\r\n }\r\n\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * Should be overridden by child classes\r\n * @returns created node\r\n */\r\n public abstract createNode(): TransformNode;\r\n\r\n /**\r\n * Disposes the handle\r\n */\r\n public dispose() {\r\n this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver);\r\n this._dragBehavior.onDragObservable.remove(this._draggingObserver);\r\n this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver);\r\n\r\n this._dragBehavior.detach();\r\n\r\n for (const material of this._materials) {\r\n material.dispose();\r\n }\r\n this.node.dispose();\r\n }\r\n}\r\n\r\n/**\r\n * Side handle class that rotates the slate\r\n */\r\nexport class SideHandle extends GizmoHandle {\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * @returns created node\r\n */\r\n public createNode() {\r\n // Create a simple vertical rectangle\r\n const verticalBox = CreateBox(\"sideVert\", { width: 1, height: 10, depth: 0.1 }, this._scene);\r\n const sideNode = new TransformNode(\"side\", this._scene);\r\n verticalBox.parent = sideNode;\r\n\r\n const mat = this._createMaterial();\r\n verticalBox.material = mat;\r\n verticalBox.isNearGrabbable = true;\r\n this._materials.push(mat);\r\n\r\n return sideNode;\r\n }\r\n}\r\n\r\n/**\r\n * Corner handle that resizes the slate\r\n */\r\nexport class CornerHandle extends GizmoHandle {\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * @returns created node\r\n */\r\n public createNode() {\r\n // Create 2 boxes making a bottom left corner\r\n const horizontalBox = CreateBox(\"angleHor\", { width: 3, height: 1, depth: 0.1 }, this._scene);\r\n const verticalBox = CreateBox(\"angleVert\", { width: 1, height: 3, depth: 0.1 }, this._scene);\r\n\r\n const angleNode = new TransformNode(\"angle\", this._scene);\r\n horizontalBox.parent = angleNode;\r\n verticalBox.parent = angleNode;\r\n\r\n horizontalBox.material = this._createMaterial(new Vector3(1, 0, 0));\r\n verticalBox.material = this._createMaterial(new Vector3(0, 1, 0));\r\n verticalBox.isNearGrabbable = true;\r\n horizontalBox.isNearGrabbable = true;\r\n\r\n this._materials.push(horizontalBox.material as HandleMaterial);\r\n this._materials.push(verticalBox.material as HandleMaterial);\r\n return angleNode;\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/gui",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.13.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"module": "index.js",
|
6
6
|
"types": "index.d.ts",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
|
-
"@babylonjs/core": "^7.
|
21
|
+
"@babylonjs/core": "^7.13.0",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/gui": "1.0.0"
|
24
24
|
},
|