@babylonjs/gui 6.38.1 → 6.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/2D/advancedDynamicTexture.d.ts +1 -1
  2. package/2D/advancedDynamicTexture.js +2 -1
  3. package/2D/advancedDynamicTexture.js.map +1 -1
  4. package/2D/controls/button.d.ts +2 -5
  5. package/2D/controls/button.js +6 -6
  6. package/2D/controls/button.js.map +1 -1
  7. package/2D/controls/container.d.ts +6 -1
  8. package/2D/controls/container.js +31 -5
  9. package/2D/controls/container.js.map +1 -1
  10. package/2D/controls/control.d.ts +9 -1
  11. package/2D/controls/control.js +16 -2
  12. package/2D/controls/control.js.map +1 -1
  13. package/2D/controls/focusableButton.d.ts +1 -1
  14. package/2D/controls/focusableButton.js +1 -1
  15. package/2D/controls/focusableButton.js.map +1 -1
  16. package/2D/controls/gradient/BaseGradient.d.ts +17 -5
  17. package/2D/controls/gradient/BaseGradient.js +17 -5
  18. package/2D/controls/gradient/BaseGradient.js.map +1 -1
  19. package/2D/controls/grid.d.ts +2 -1
  20. package/2D/controls/grid.js +6 -2
  21. package/2D/controls/grid.js.map +1 -1
  22. package/2D/controls/image.d.ts +2 -1
  23. package/2D/controls/image.js +2 -1
  24. package/2D/controls/image.js.map +1 -1
  25. package/2D/controls/inputText.js +2 -0
  26. package/2D/controls/inputText.js.map +1 -1
  27. package/2D/controls/stackPanel.d.ts +2 -1
  28. package/2D/controls/stackPanel.js +6 -2
  29. package/2D/controls/stackPanel.js.map +1 -1
  30. package/2D/xmlLoader.js +9 -0
  31. package/2D/xmlLoader.js.map +1 -1
  32. package/3D/controls/button3D.d.ts +1 -0
  33. package/3D/controls/button3D.js +1 -0
  34. package/3D/controls/button3D.js.map +1 -1
  35. package/3D/controls/control3D.d.ts +1 -1
  36. package/3D/controls/control3D.js +1 -1
  37. package/3D/controls/control3D.js.map +1 -1
  38. package/3D/controls/holographicSlate.d.ts +1 -1
  39. package/3D/controls/holographicSlate.js +1 -1
  40. package/3D/controls/holographicSlate.js.map +1 -1
  41. package/3D/controls/touchHolographicMenu.d.ts +2 -2
  42. package/3D/controls/touchHolographicMenu.js +2 -2
  43. package/3D/controls/touchHolographicMenu.js.map +1 -1
  44. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"xmlLoader.js","sourceRoot":"","sources":["../../../../dev/gui/src/2D/xmlLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,0CAA4B;AAG/C,MAAM,cAAc,GAAG,2DAA2D,CAAC;AAEnF;;GAEG;AACH,MAAM,OAAO,SAAS;IAuBlB;;;OAGG;IACH,YAAY,cAAmB,IAAI;QA1B3B,WAAM,GAAQ,EAAE,CAAC;QAEjB,eAAU,GAAQ;YACtB,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,CAAC;SACV,CAAC;QAEM,cAAS,GAAY,KAAK,CAAC;QAE3B,sBAAiB,GAAQ;YAC7B,uBAAuB,EAAE,CAAC;YAC1B,qBAAqB,EAAE,CAAC;YACxB,mBAAmB,EAAE,CAAC;YACtB,iBAAiB,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;SACb,CAAC;QAWE,IAAI,WAAW,EAAE;YACb,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;SACnC;IACL,CAAC;IAEO,gBAAgB,CAAC,cAAmB;QACxC,IAAI,OAAO,GAAQ,MAAM,CAAC;QAE1B,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;SAC/B;QACD,IAAI,KAAK,GAAG,cAAc,CAAC;QAC3B,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/B;QACD,OAAO,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,CAAC,MAAM,GAAG,GAAG,EAAE;YAChB,IAAI,KAAK,CAAC,UAAU,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE;gBAChD,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;oBACpB,IAAI,OAAO,EAAE;wBACT,OAAO,CAAC,cAAc,CAAC,CAAC;wBACxB,OAAO;qBACV;yBAAM;wBACH,MAAM,cAAc,CAAC;qBACxB;iBACJ;gBAED,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC;gBACjD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;gBAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBAEtB,IAAI,SAAS,EAAE;oBACX,SAAS,EAAE,CAAC;iBACf;aACJ;QACL,CAAC,CAAC;QAEF,KAAK,CAAC,OAAO,GAAG;YACZ,IAAI,OAAO,EAAE;gBACT,OAAO,CAAC,6CAA6C,CAAC,CAAC;aAC1D;QACL,CAAC,CAAC;QAEF,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;IACD;;;;;OAKG;IACI,KAAK,CAAC,eAAe,CAAC,OAAY,EAAE,QAAa;QACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAY,EAAE,MAAW,EAAE,EAAE;YAC7C,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import { GetClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst XmlLoaderError = \"XmlLoader Exception : XML file is malformed or corrupted.\";\r\n\r\n/**\r\n * Class used to load GUI via XML.\r\n */\r\nexport class XmlLoader {\r\n private _nodes: any = {};\r\n\r\n private _nodeTypes: any = {\r\n element: 1,\r\n attribute: 2,\r\n text: 3,\r\n };\r\n\r\n private _isLoaded: boolean = false;\r\n\r\n private _objectAttributes: any = {\r\n textHorizontalAlignment: 1,\r\n textVerticalAlignment: 2,\r\n horizontalAlignment: 3,\r\n verticalAlignment: 4,\r\n stretch: 5,\r\n };\r\n\r\n private _rootNode: any;\r\n\r\n private _parentClass: any;\r\n\r\n /**\r\n * Create a new xml loader\r\n * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context\r\n */\r\n constructor(parentClass: any = null) {\r\n if (parentClass) {\r\n this._parentClass = parentClass;\r\n }\r\n }\r\n\r\n private _getChainElement(attributeValue: any): any {\r\n let element: any = window;\r\n\r\n if (this._parentClass) {\r\n element = this._parentClass;\r\n }\r\n let value = attributeValue;\r\n value = value.split(\".\");\r\n\r\n for (let i = 0; i < value.length; i++) {\r\n element = element[value[i]];\r\n }\r\n return element;\r\n }\r\n\r\n private _getClassAttribute(attributeName: string): any {\r\n const attribute = attributeName.split(\".\");\r\n const className = GetClass(\"BABYLON.GUI.\" + attribute[0]);\r\n return className[attribute[1]];\r\n }\r\n\r\n private _createGuiElement(node: any, parent: any, linkParent: boolean = true): void {\r\n try {\r\n const className = GetClass(\"BABYLON.GUI.\" + node.nodeName);\r\n const guiNode = new className();\r\n\r\n if (parent && linkParent) {\r\n parent.addControl(guiNode);\r\n }\r\n\r\n for (let i = 0; i < node.attributes.length; i++) {\r\n if (node.attributes[i].name.toLowerCase().includes(\"datasource\")) {\r\n continue;\r\n }\r\n\r\n if (node.attributes[i].name.toLowerCase().includes(\"observable\")) {\r\n const element = this._getChainElement(node.attributes[i].value);\r\n guiNode[node.attributes[i].name].add(element);\r\n\r\n continue;\r\n } else if (node.attributes[i].name == \"linkWithMesh\") {\r\n if (this._parentClass) {\r\n guiNode.linkWithMesh(this._parentClass[node.attributes[i].value]);\r\n } else {\r\n guiNode.linkWithMesh(window[node.attributes[i].value]);\r\n }\r\n } else if (node.attributes[i].value.startsWith(\"{{\") && node.attributes[i].value.endsWith(\"}}\")) {\r\n const element = this._getChainElement(node.attributes[i].value.substring(2, node.attributes[i].value.length - 2));\r\n guiNode[node.attributes[i].name] = element;\r\n } else if (!this._objectAttributes[node.attributes[i].name]) {\r\n if (node.attributes[i].value == \"true\" || node.attributes[i].value == \"false\") {\r\n guiNode[node.attributes[i].name] = node.attributes[i].value == \"true\";\r\n } else {\r\n guiNode[node.attributes[i].name] = !isNaN(Number(node.attributes[i].value)) ? Number(node.attributes[i].value) : node.attributes[i].value;\r\n }\r\n } else {\r\n guiNode[node.attributes[i].name] = this._getClassAttribute(node.attributes[i].value);\r\n }\r\n }\r\n\r\n if (!node.attributes.getNamedItem(\"id\")) {\r\n this._nodes[node.nodeName + Object.keys(this._nodes).length + \"_gen\"] = guiNode;\r\n return guiNode;\r\n }\r\n\r\n let id = node.attributes.getNamedItem(\"id\").value;\r\n if (id.startsWith(\"{{\") && id.endsWith(\"}}\")) {\r\n id = this._getChainElement(id.substring(2, id.length - 2));\r\n }\r\n\r\n if (!this._nodes[id]) {\r\n this._nodes[id] = guiNode;\r\n } else {\r\n throw \"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute\";\r\n }\r\n return guiNode;\r\n } catch (exception) {\r\n throw \"XmlLoader Exception : Error parsing Control \" + node.nodeName + \",\" + exception + \".\";\r\n }\r\n }\r\n\r\n private _parseGrid(node: any, guiNode: any, parent: any): void {\r\n let width;\r\n let height;\r\n let columns;\r\n const rows = node.children;\r\n let cells;\r\n let isPixel = false;\r\n let cellNode;\r\n let rowNumber = -1;\r\n let columnNumber = -1;\r\n let totalColumnsNumber = 0;\r\n\r\n for (let i = 0; i < rows.length; i++) {\r\n if (rows[i].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n if (rows[i].nodeName != \"Row\") {\r\n throw \"XmlLoader Exception : Expecting Row node, received \" + rows[i].nodeName;\r\n }\r\n rowNumber += 1;\r\n columns = rows[i].children;\r\n\r\n if (!rows[i].attributes.getNamedItem(\"height\")) {\r\n throw \"XmlLoader Exception : Height must be defined for grid rows\";\r\n }\r\n height = Number(rows[i].attributes.getNamedItem(\"height\").nodeValue);\r\n isPixel = rows[i].attributes.getNamedItem(\"isPixel\") ? JSON.parse(rows[i].attributes.getNamedItem(\"isPixel\").nodeValue) : false;\r\n guiNode.addRowDefinition(height, isPixel);\r\n\r\n for (let j = 0; j < columns.length; j++) {\r\n if (columns[j].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n if (columns[j].nodeName != \"Column\") {\r\n throw \"XmlLoader Exception : Expecting Column node, received \" + columns[j].nodeName;\r\n }\r\n columnNumber += 1;\r\n if (rowNumber > 0 && columnNumber > totalColumnsNumber) {\r\n throw \"XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.\";\r\n }\r\n\r\n if (rowNumber == 0) {\r\n if (!columns[j].attributes.getNamedItem(\"width\")) {\r\n throw \"XmlLoader Exception : Width must be defined for all the grid columns in the first row\";\r\n }\r\n width = Number(columns[j].attributes.getNamedItem(\"width\").nodeValue);\r\n isPixel = columns[j].attributes.getNamedItem(\"isPixel\") ? JSON.parse(columns[j].attributes.getNamedItem(\"isPixel\").nodeValue) : false;\r\n guiNode.addColumnDefinition(width, isPixel);\r\n }\r\n\r\n cells = columns[j].children;\r\n\r\n for (let k = 0; k < cells.length; k++) {\r\n if (cells[k].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n cellNode = this._createGuiElement(cells[k], guiNode, false);\r\n guiNode.addControl(cellNode, rowNumber, columnNumber);\r\n if (cells[k].firstChild) {\r\n this._parseXml(cells[k].firstChild, cellNode);\r\n }\r\n }\r\n }\r\n if (rowNumber == 0) {\r\n totalColumnsNumber = columnNumber;\r\n }\r\n columnNumber = -1;\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n\r\n private _parseElement(node: any, guiNode: any, parent: any): void {\r\n if (node.firstChild) {\r\n this._parseXml(node.firstChild, guiNode);\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n\r\n private _prepareSourceElement(node: any, guiNode: any, variable: any, source: any, iterator: any): void {\r\n if (this._parentClass) {\r\n this._parentClass[variable] = source[iterator];\r\n } else {\r\n window[variable] = source[iterator];\r\n }\r\n\r\n if (node.firstChild) {\r\n this._parseXml(node.firstChild, guiNode, true);\r\n }\r\n }\r\n\r\n private _parseElementsFromSource(node: any, guiNode: any, parent: any): void {\r\n const dataSource = node.attributes.getNamedItem(\"dataSource\").value;\r\n\r\n if (!dataSource.includes(\" in \")) {\r\n throw \"XmlLoader Exception : Malformed XML, Data Source must include an in\";\r\n } else {\r\n let isArray = true;\r\n const splittedSource = dataSource.split(\" in \");\r\n if (splittedSource.length < 2) {\r\n throw \"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source\";\r\n }\r\n let source = splittedSource[1];\r\n if (source.startsWith(\"{\") && source.endsWith(\"}\")) {\r\n isArray = false;\r\n }\r\n\r\n if (!isArray || (source.startsWith(\"[\") && source.endsWith(\"]\"))) {\r\n source = source.substring(1, source.length - 1);\r\n }\r\n\r\n if (this._parentClass) {\r\n source = this._parentClass[source];\r\n } else {\r\n source = window[source];\r\n }\r\n\r\n if (isArray) {\r\n for (let i = 0; i < source.length; i++) {\r\n this._prepareSourceElement(node, guiNode, splittedSource[0], source, i);\r\n }\r\n } else {\r\n for (const i in source) {\r\n this._prepareSourceElement(node, guiNode, splittedSource[0], source, i);\r\n }\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n }\r\n\r\n private _parseXml(node: any, parent: any, generated: boolean = false): void {\r\n if (node.nodeType != this._nodeTypes.element) {\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent, generated);\r\n }\r\n return;\r\n }\r\n\r\n if (generated) {\r\n node.setAttribute(\"id\", parent.id + (parent._children.length + 1));\r\n }\r\n\r\n const guiNode = this._createGuiElement(node, parent);\r\n\r\n if (!this._rootNode) {\r\n this._rootNode = guiNode;\r\n }\r\n\r\n if (node.nodeName == \"Grid\") {\r\n this._parseGrid(node, guiNode, parent);\r\n } else if (!node.attributes.getNamedItem(\"dataSource\")) {\r\n this._parseElement(node, guiNode, parent);\r\n } else {\r\n this._parseElementsFromSource(node, guiNode, parent);\r\n }\r\n }\r\n\r\n /**\r\n * Gets if the loading has finished.\r\n * @returns whether the loading has finished or not\r\n */\r\n public isLoaded(): boolean {\r\n return this._isLoaded;\r\n }\r\n\r\n /**\r\n * Gets a loaded node / control by id.\r\n * @param id the Controls id set in the xml\r\n * @returns element of type Control\r\n */\r\n public getNodeById(id: string): any {\r\n return this._nodes[id];\r\n }\r\n\r\n /**\r\n * Gets all loaded nodes / controls\r\n * @returns Array of controls\r\n */\r\n public getNodes(): any {\r\n return this._nodes;\r\n }\r\n /**\r\n * Disposes the loaded layout\r\n */\r\n public dispose(): void {\r\n if (this._rootNode) {\r\n this._rootNode.dispose();\r\n this._rootNode = null;\r\n this._nodes = {};\r\n }\r\n }\r\n\r\n /**\r\n * Initiates the xml layout loading\r\n * @param xmlFile defines the xml layout to load\r\n * @param rootNode defines the node / control to use as a parent for the loaded layout controls.\r\n * @param onSuccess defines the callback called on layout load successfully.\r\n * @param onError defines the callback called on layout load failure.\r\n */\r\n public loadLayout(xmlFile: any, rootNode: any, onSuccess: Nullable<() => void> = null, onError: Nullable<(error: string) => void> = null): void {\r\n const xhttp = new XMLHttpRequest();\r\n xhttp.onload = () => {\r\n if (xhttp.readyState === 4 && xhttp.status === 200) {\r\n if (!xhttp.responseXML) {\r\n if (onError) {\r\n onError(XmlLoaderError);\r\n return;\r\n } else {\r\n throw XmlLoaderError;\r\n }\r\n }\r\n\r\n const xmlDoc = xhttp.responseXML.documentElement;\r\n this._parseXml(xmlDoc.firstChild, rootNode);\r\n this._isLoaded = true;\r\n\r\n if (onSuccess) {\r\n onSuccess();\r\n }\r\n }\r\n };\r\n\r\n xhttp.onerror = function () {\r\n if (onError) {\r\n onError(\"an error occurred during loading the layout\");\r\n }\r\n };\r\n\r\n xhttp.open(\"GET\", xmlFile, true);\r\n xhttp.send();\r\n }\r\n /**\r\n * Initiates the xml layout loading asynchronously\r\n * @param xmlFile defines the xml layout to load\r\n * @param rootNode defines the node / control to use as a parent for the loaded layout controls.\r\n * @returns Promise\r\n */\r\n public async loadLayoutAsync(xmlFile: any, rootNode: any): Promise<any> {\r\n return new Promise((resolve: any, reject: any) => {\r\n this.loadLayout(xmlFile, rootNode, resolve, reject);\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"xmlLoader.js","sourceRoot":"","sources":["../../../../dev/gui/src/2D/xmlLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,0CAA4B;AAG/C,MAAM,cAAc,GAAG,2DAA2D,CAAC;AAEnF;;GAEG;AACH,MAAM,OAAO,SAAS;IAuBlB;;;OAGG;IACH,YAAY,cAAmB,IAAI;QA1B3B,WAAM,GAAQ,EAAE,CAAC;QAEjB,eAAU,GAAQ;YACtB,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,CAAC;SACV,CAAC;QAEM,cAAS,GAAY,KAAK,CAAC;QAE3B,sBAAiB,GAAQ;YAC7B,uBAAuB,EAAE,CAAC;YAC1B,qBAAqB,EAAE,CAAC;YACxB,mBAAmB,EAAE,CAAC;YACtB,iBAAiB,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;SACb,CAAC;QAWE,IAAI,WAAW,EAAE;YACb,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;SACnC;IACL,CAAC;IAEO,gBAAgB,CAAC,cAAmB;QACxC,IAAI,OAAO,GAAQ,MAAM,CAAC;QAE1B,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;SAC/B;QACD,IAAI,KAAK,GAAG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AAY,EAAE,QAAa;QACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAY,EAAE,MAAW,EAAE,EAAE;YAC7C,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import { GetClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst XmlLoaderError = \"XmlLoader Exception : XML file is malformed or corrupted.\";\r\n\r\n/**\r\n * Class used to load GUI via XML.\r\n */\r\nexport class XmlLoader {\r\n private _nodes: any = {};\r\n\r\n private _nodeTypes: any = {\r\n element: 1,\r\n attribute: 2,\r\n text: 3,\r\n };\r\n\r\n private _isLoaded: boolean = false;\r\n\r\n private _objectAttributes: any = {\r\n textHorizontalAlignment: 1,\r\n textVerticalAlignment: 2,\r\n horizontalAlignment: 3,\r\n verticalAlignment: 4,\r\n stretch: 5,\r\n };\r\n\r\n private _rootNode: any;\r\n\r\n private _parentClass: any;\r\n\r\n /**\r\n * Create a new xml loader\r\n * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context\r\n */\r\n constructor(parentClass: any = null) {\r\n if (parentClass) {\r\n this._parentClass = parentClass;\r\n }\r\n }\r\n\r\n private _getChainElement(attributeValue: any): any {\r\n let element: any = window;\r\n\r\n if (this._parentClass) {\r\n element = this._parentClass;\r\n }\r\n let value = attributeValue;\r\n value = value.split(\".\");\r\n\r\n for (let i = 0; i < value.length; i++) {\r\n element = element[value[i]];\r\n }\r\n return element;\r\n }\r\n\r\n private _getClassAttribute(attributeName: string): any {\r\n const attribute = attributeName.split(\".\");\r\n const className = GetClass(\"BABYLON.GUI.\" + attribute[0]);\r\n return className[attribute[1]];\r\n }\r\n\r\n private _createGuiElement(node: any, parent: any, linkParent: boolean = true): void {\r\n try {\r\n const className = GetClass(\"BABYLON.GUI.\" + node.nodeName);\r\n const guiNode = new className();\r\n\r\n if (parent && linkParent) {\r\n parent.addControl(guiNode);\r\n }\r\n\r\n for (let i = 0; i < node.attributes.length; i++) {\r\n if (node.attributes[i].name.toLowerCase().includes(\"datasource\")) {\r\n continue;\r\n }\r\n\r\n if (node.attributes[i].name.toLowerCase().includes(\"observable\")) {\r\n const element = this._getChainElement(node.attributes[i].value);\r\n guiNode[node.attributes[i].name].add(element);\r\n\r\n continue;\r\n } else if (node.attributes[i].name == \"linkWithMesh\") {\r\n if (this._parentClass) {\r\n guiNode.linkWithMesh(this._parentClass[node.attributes[i].value]);\r\n } else {\r\n guiNode.linkWithMesh(window[node.attributes[i].value]);\r\n }\r\n } else if (node.attributes[i].value.startsWith(\"{{\") && node.attributes[i].value.endsWith(\"}}\")) {\r\n const element = this._getChainElement(node.attributes[i].value.substring(2, node.attributes[i].value.length - 2));\r\n guiNode[node.attributes[i].name] = element;\r\n } else if (!this._objectAttributes[node.attributes[i].name]) {\r\n if (node.attributes[i].value == \"true\" || node.attributes[i].value == \"false\") {\r\n guiNode[node.attributes[i].name] = node.attributes[i].value == \"true\";\r\n } else {\r\n guiNode[node.attributes[i].name] = !isNaN(Number(node.attributes[i].value)) ? Number(node.attributes[i].value) : node.attributes[i].value;\r\n }\r\n } else {\r\n guiNode[node.attributes[i].name] = this._getClassAttribute(node.attributes[i].value);\r\n }\r\n }\r\n\r\n if (!node.attributes.getNamedItem(\"id\")) {\r\n this._nodes[node.nodeName + Object.keys(this._nodes).length + \"_gen\"] = guiNode;\r\n return guiNode;\r\n }\r\n\r\n let id = node.attributes.getNamedItem(\"id\").value;\r\n if (id.startsWith(\"{{\") && id.endsWith(\"}}\")) {\r\n id = this._getChainElement(id.substring(2, id.length - 2));\r\n }\r\n\r\n if (!this._nodes[id]) {\r\n this._nodes[id] = guiNode;\r\n } else {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute\";\r\n }\r\n return guiNode;\r\n } catch (exception) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Error parsing Control \" + node.nodeName + \",\" + exception + \".\";\r\n }\r\n }\r\n\r\n private _parseGrid(node: any, guiNode: any, parent: any): void {\r\n let width;\r\n let height;\r\n let columns;\r\n const rows = node.children;\r\n let cells;\r\n let isPixel = false;\r\n let cellNode;\r\n let rowNumber = -1;\r\n let columnNumber = -1;\r\n let totalColumnsNumber = 0;\r\n\r\n for (let i = 0; i < rows.length; i++) {\r\n if (rows[i].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n if (rows[i].nodeName != \"Row\") {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Expecting Row node, received \" + rows[i].nodeName;\r\n }\r\n rowNumber += 1;\r\n columns = rows[i].children;\r\n\r\n if (!rows[i].attributes.getNamedItem(\"height\")) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Height must be defined for grid rows\";\r\n }\r\n height = Number(rows[i].attributes.getNamedItem(\"height\").nodeValue);\r\n isPixel = rows[i].attributes.getNamedItem(\"isPixel\") ? JSON.parse(rows[i].attributes.getNamedItem(\"isPixel\").nodeValue) : false;\r\n guiNode.addRowDefinition(height, isPixel);\r\n\r\n for (let j = 0; j < columns.length; j++) {\r\n if (columns[j].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n if (columns[j].nodeName != \"Column\") {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Expecting Column node, received \" + columns[j].nodeName;\r\n }\r\n columnNumber += 1;\r\n if (rowNumber > 0 && columnNumber > totalColumnsNumber) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.\";\r\n }\r\n\r\n if (rowNumber == 0) {\r\n if (!columns[j].attributes.getNamedItem(\"width\")) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Width must be defined for all the grid columns in the first row\";\r\n }\r\n width = Number(columns[j].attributes.getNamedItem(\"width\").nodeValue);\r\n isPixel = columns[j].attributes.getNamedItem(\"isPixel\") ? JSON.parse(columns[j].attributes.getNamedItem(\"isPixel\").nodeValue) : false;\r\n guiNode.addColumnDefinition(width, isPixel);\r\n }\r\n\r\n cells = columns[j].children;\r\n\r\n for (let k = 0; k < cells.length; k++) {\r\n if (cells[k].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n cellNode = this._createGuiElement(cells[k], guiNode, false);\r\n guiNode.addControl(cellNode, rowNumber, columnNumber);\r\n if (cells[k].firstChild) {\r\n this._parseXml(cells[k].firstChild, cellNode);\r\n }\r\n }\r\n }\r\n if (rowNumber == 0) {\r\n totalColumnsNumber = columnNumber;\r\n }\r\n columnNumber = -1;\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n\r\n private _parseElement(node: any, guiNode: any, parent: any): void {\r\n if (node.firstChild) {\r\n this._parseXml(node.firstChild, guiNode);\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n\r\n private _prepareSourceElement(node: any, guiNode: any, variable: any, source: any, iterator: any): void {\r\n if (this._parentClass) {\r\n this._parentClass[variable] = source[iterator];\r\n } else {\r\n window[variable] = source[iterator];\r\n }\r\n\r\n if (node.firstChild) {\r\n this._parseXml(node.firstChild, guiNode, true);\r\n }\r\n }\r\n\r\n private _parseElementsFromSource(node: any, guiNode: any, parent: any): void {\r\n const dataSource = node.attributes.getNamedItem(\"dataSource\").value;\r\n\r\n if (!dataSource.includes(\" in \")) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Malformed XML, Data Source must include an in\";\r\n } else {\r\n let isArray = true;\r\n const splittedSource = dataSource.split(\" in \");\r\n if (splittedSource.length < 2) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source\";\r\n }\r\n let source = splittedSource[1];\r\n if (source.startsWith(\"{\") && source.endsWith(\"}\")) {\r\n isArray = false;\r\n }\r\n\r\n if (!isArray || (source.startsWith(\"[\") && source.endsWith(\"]\"))) {\r\n source = source.substring(1, source.length - 1);\r\n }\r\n\r\n if (this._parentClass) {\r\n source = this._parentClass[source];\r\n } else {\r\n source = window[source];\r\n }\r\n\r\n if (isArray) {\r\n for (let i = 0; i < source.length; i++) {\r\n this._prepareSourceElement(node, guiNode, splittedSource[0], source, i);\r\n }\r\n } else {\r\n for (const i in source) {\r\n this._prepareSourceElement(node, guiNode, splittedSource[0], source, i);\r\n }\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n }\r\n\r\n private _parseXml(node: any, parent: any, generated: boolean = false): void {\r\n if (node.nodeType != this._nodeTypes.element) {\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent, generated);\r\n }\r\n return;\r\n }\r\n\r\n if (generated) {\r\n node.setAttribute(\"id\", parent.id + (parent._children.length + 1));\r\n }\r\n\r\n const guiNode = this._createGuiElement(node, parent);\r\n\r\n if (!this._rootNode) {\r\n this._rootNode = guiNode;\r\n }\r\n\r\n if (node.nodeName == \"Grid\") {\r\n this._parseGrid(node, guiNode, parent);\r\n } else if (!node.attributes.getNamedItem(\"dataSource\")) {\r\n this._parseElement(node, guiNode, parent);\r\n } else {\r\n this._parseElementsFromSource(node, guiNode, parent);\r\n }\r\n }\r\n\r\n /**\r\n * Gets if the loading has finished.\r\n * @returns whether the loading has finished or not\r\n */\r\n public isLoaded(): boolean {\r\n return this._isLoaded;\r\n }\r\n\r\n /**\r\n * Gets a loaded node / control by id.\r\n * @param id the Controls id set in the xml\r\n * @returns element of type Control\r\n */\r\n public getNodeById(id: string): any {\r\n return this._nodes[id];\r\n }\r\n\r\n /**\r\n * Gets all loaded nodes / controls\r\n * @returns Array of controls\r\n */\r\n public getNodes(): any {\r\n return this._nodes;\r\n }\r\n /**\r\n * Disposes the loaded layout\r\n */\r\n public dispose(): void {\r\n if (this._rootNode) {\r\n this._rootNode.dispose();\r\n this._rootNode = null;\r\n this._nodes = {};\r\n }\r\n }\r\n\r\n /**\r\n * Initiates the xml layout loading\r\n * @param xmlFile defines the xml layout to load\r\n * @param rootNode defines the node / control to use as a parent for the loaded layout controls.\r\n * @param onSuccess defines the callback called on layout load successfully.\r\n * @param onError defines the callback called on layout load failure.\r\n */\r\n public loadLayout(xmlFile: any, rootNode: any, onSuccess: Nullable<() => void> = null, onError: Nullable<(error: string) => void> = null): void {\r\n const xhttp = new XMLHttpRequest();\r\n xhttp.onload = () => {\r\n if (xhttp.readyState === 4 && xhttp.status === 200) {\r\n if (!xhttp.responseXML) {\r\n if (onError) {\r\n onError(XmlLoaderError);\r\n return;\r\n } else {\r\n throw XmlLoaderError;\r\n }\r\n }\r\n\r\n const xmlDoc = xhttp.responseXML.documentElement;\r\n this._parseXml(xmlDoc.firstChild, rootNode);\r\n this._isLoaded = true;\r\n\r\n if (onSuccess) {\r\n onSuccess();\r\n }\r\n }\r\n };\r\n\r\n xhttp.onerror = function () {\r\n if (onError) {\r\n onError(\"an error occurred during loading the layout\");\r\n }\r\n };\r\n\r\n xhttp.open(\"GET\", xmlFile, true);\r\n xhttp.send();\r\n }\r\n /**\r\n * Initiates the xml layout loading asynchronously\r\n * @param xmlFile defines the xml layout to load\r\n * @param rootNode defines the node / control to use as a parent for the loaded layout controls.\r\n * @returns Promise\r\n */\r\n public async loadLayoutAsync(xmlFile: any, rootNode: any): Promise<any> {\r\n return new Promise((resolve: any, reject: any) => {\r\n this.loadLayout(xmlFile, rootNode, resolve, reject);\r\n });\r\n }\r\n}\r\n"]}
@@ -33,6 +33,7 @@ export declare class Button3D extends AbstractButton3D {
33
33
  /**
34
34
  * Creates a new button
35
35
  * @param name defines the control name
36
+ * @param options defines the options used to create the button
36
37
  */
37
38
  constructor(name?: string, options?: IButton3DCreationOptions);
38
39
  /**
@@ -10,6 +10,7 @@ export class Button3D extends AbstractButton3D {
10
10
  /**
11
11
  * Creates a new button
12
12
  * @param name defines the control name
13
+ * @param options defines the options used to create the button
13
14
  */
14
15
  constructor(name, options) {
15
16
  super(name);
@@ -1 +1 @@
1
- {"version":3,"file":"button3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/button3D.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAGjD,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AAGnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAsB/C;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,gBAAgB;IAQ1C;;;OAGG;IACH,YAAY,IAAa,EAAE,OAAkC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,QAAQ,GAAG;YACZ,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,IAAI;YACX,GAAG,OAAO;SACb,CAAC;QAEF,qBAAqB;QAErB,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,OAAO;aACV;YACkB,IAAI,CAAC,gBAAiB,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;QAC3E,CAAC,CAAC;QAEF,IAAI,CAAC,mBAAmB,GAAG,GAAG,EAAE;YACT,IAAI,CAAC,gBAAiB,CAAC,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAC7E,CAAC,CAAC;QAEF,IAAI,CAAC,oBAAoB,GAAG,GAAG,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,OAAO;aACV;YAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACzC,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D,KAAK,CACR,CAAC;QAEF,IAAI,CAAC,mBAAmB,GAAG,CAAC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAO,CAAC;QACpG,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,eAAe,CAAC,IAAkB;QACxC,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,GAAG,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/E,QAAQ,CAAC,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QAEjC,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE7B,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;SACnC;IACL,CAAC;CACJ","sourcesContent":["import { Vector4 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { AbstractButton3D } from \"./abstractButton3D\";\r\nimport type { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Options used to create a button in 3D\r\n */\r\nexport interface IButton3DCreationOptions {\r\n /**\r\n * Width of the button. Default: 1\r\n */\r\n width?: number;\r\n\r\n /**\r\n * Height of the button. Default: 1\r\n */\r\n height?: number;\r\n\r\n /**\r\n * Depth of the button. Default: 0.08\r\n */\r\n depth?: number;\r\n}\r\n\r\n/**\r\n * Class used to create a button in 3D\r\n */\r\nexport class Button3D extends AbstractButton3D {\r\n /** @internal */\r\n protected _currentMaterial: Material;\r\n\r\n protected _options: IButton3DCreationOptions;\r\n protected _height: number;\r\n protected _depth: number;\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n */\r\n constructor(name?: string, options?: IButton3DCreationOptions) {\r\n super(name);\r\n\r\n this._options = {\r\n width: 1,\r\n height: 1,\r\n depth: 0.08,\r\n ...options,\r\n };\r\n\r\n // Default animations\r\n\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n (<StandardMaterial>this._currentMaterial).emissiveColor = Color3.Red();\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n (<StandardMaterial>this._currentMaterial).emissiveColor = Color3.Black();\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n this.mesh.scaling.scaleInPlace(0.95);\r\n };\r\n\r\n this.pointerUpAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n this.mesh.scaling.scaleInPlace(1.0 / 0.95);\r\n };\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n (<any>this._currentMaterial).emissiveTexture = facadeTexture;\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Button3D\";\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n const faceUV = new Array(6);\r\n\r\n for (let i = 0; i < 6; i++) {\r\n faceUV[i] = new Vector4(0, 0, 0, 0);\r\n }\r\n if (scene.useRightHandedSystem) {\r\n // Flip the u on the texture\r\n faceUV[0].copyFromFloats(1, 0, 0, 1);\r\n } else {\r\n faceUV[1].copyFromFloats(0, 0, 1, 1);\r\n }\r\n\r\n const mesh = CreateBox(\r\n this.name + \"_rootMesh\",\r\n {\r\n width: this._options.width,\r\n height: this._options.height,\r\n depth: this._options.depth,\r\n faceUV: faceUV,\r\n wrap: true,\r\n },\r\n scene\r\n );\r\n\r\n this._contentScaleRatioY = (this._contentScaleRatio * this._options.width!) / this._options.height!;\r\n this._setFacadeTextureScaling();\r\n\r\n return mesh;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n const material = new StandardMaterial(this.name + \"Material\", mesh.getScene());\r\n material.specularColor = Color3.Black();\r\n\r\n mesh.material = material;\r\n this._currentMaterial = material;\r\n\r\n this._resetContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._disposeFacadeTexture();\r\n\r\n if (this._currentMaterial) {\r\n this._currentMaterial.dispose();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"button3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/button3D.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAGjD,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AAGnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAsB/C;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,gBAAgB;IAQ1C;;;;OAIG;IACH,YAAY,IAAa,EAAE,OAAkC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,QAAQ,GAAG;YACZ,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,IAAI;YACX,GAAG,OAAO;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7B,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;SACnC;IACL,CAAC;CACJ","sourcesContent":["import { Vector4 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { AbstractButton3D } from \"./abstractButton3D\";\r\nimport type { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Options used to create a button in 3D\r\n */\r\nexport interface IButton3DCreationOptions {\r\n /**\r\n * Width of the button. Default: 1\r\n */\r\n width?: number;\r\n\r\n /**\r\n * Height of the button. Default: 1\r\n */\r\n height?: number;\r\n\r\n /**\r\n * Depth of the button. Default: 0.08\r\n */\r\n depth?: number;\r\n}\r\n\r\n/**\r\n * Class used to create a button in 3D\r\n */\r\nexport class Button3D extends AbstractButton3D {\r\n /** @internal */\r\n protected _currentMaterial: Material;\r\n\r\n protected _options: IButton3DCreationOptions;\r\n protected _height: number;\r\n protected _depth: number;\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n * @param options defines the options used to create the button\r\n */\r\n constructor(name?: string, options?: IButton3DCreationOptions) {\r\n super(name);\r\n\r\n this._options = {\r\n width: 1,\r\n height: 1,\r\n depth: 0.08,\r\n ...options,\r\n };\r\n\r\n // Default animations\r\n\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n (<StandardMaterial>this._currentMaterial).emissiveColor = Color3.Red();\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n (<StandardMaterial>this._currentMaterial).emissiveColor = Color3.Black();\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n this.mesh.scaling.scaleInPlace(0.95);\r\n };\r\n\r\n this.pointerUpAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n this.mesh.scaling.scaleInPlace(1.0 / 0.95);\r\n };\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n (<any>this._currentMaterial).emissiveTexture = facadeTexture;\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Button3D\";\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n const faceUV = new Array(6);\r\n\r\n for (let i = 0; i < 6; i++) {\r\n faceUV[i] = new Vector4(0, 0, 0, 0);\r\n }\r\n if (scene.useRightHandedSystem) {\r\n // Flip the u on the texture\r\n faceUV[0].copyFromFloats(1, 0, 0, 1);\r\n } else {\r\n faceUV[1].copyFromFloats(0, 0, 1, 1);\r\n }\r\n\r\n const mesh = CreateBox(\r\n this.name + \"_rootMesh\",\r\n {\r\n width: this._options.width,\r\n height: this._options.height,\r\n depth: this._options.depth,\r\n faceUV: faceUV,\r\n wrap: true,\r\n },\r\n scene\r\n );\r\n\r\n this._contentScaleRatioY = (this._contentScaleRatio * this._options.width!) / this._options.height!;\r\n this._setFacadeTextureScaling();\r\n\r\n return mesh;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n const material = new StandardMaterial(this.name + \"Material\", mesh.getScene());\r\n material.specularColor = Color3.Black();\r\n\r\n mesh.material = material;\r\n this._currentMaterial = material;\r\n\r\n this._resetContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._disposeFacadeTexture();\r\n\r\n if (this._currentMaterial) {\r\n this._currentMaterial.dispose();\r\n }\r\n }\r\n}\r\n"]}
@@ -127,7 +127,7 @@ export declare class Control3D implements IDisposable, IBehaviorAware<Control3D>
127
127
  */
128
128
  linkToTransformNode(node: Nullable<TransformNode>): Control3D;
129
129
  /**
130
- * @internal*
130
+ * @internal
131
131
  */
132
132
  _prepareNode(scene: Scene): void;
133
133
  protected _injectGUI3DReservedDataStore(node: TransformNode): any;
@@ -193,7 +193,7 @@ export class Control3D {
193
193
  return this;
194
194
  }
195
195
  /**
196
- * @internal*
196
+ * @internal
197
197
  */
198
198
  _prepareNode(scene) {
199
199
  if (!this._node) {
@@ -1 +1 @@
1
- {"version":3,"file":"control3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/control3D.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,iBAAiB,EAAE,gDAAkC;AAE9D,OAAO,EAAE,YAAY,EAAE,+CAAiC;AAKxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD;;GAEG;AACH,MAAM,OAAO,SAAS;IAalB,uDAAuD;IACvD,IAAW,QAAQ;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;SACzB;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC/B,CAAC;IAED,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO;SACV;QAED,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,sDAAsD;IACtD,IAAW,OAAO;QACd,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SAC/B;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9B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gB,CAAC,SAAS,CAAC,EAAE;gBACxC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;aACxG;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,gBAAgB;IACT,YAAY;QACf,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;SACrB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QAEtC,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,YAAY;QACZ,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;YACpC,QAAQ,CAAC,MAAM,EAAE,CAAC;SACrB;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { IBehaviorAware, Behavior } from \"core/Behaviors/behavior\";\r\nimport type { IDisposable, Scene } from \"core/scene\";\r\n\r\nimport type { GUI3DManager } from \"../gui3DManager\";\r\nimport { Vector3WithInfo } from \"../vector3WithInfo\";\r\nimport type { Container3D } from \"./container3D\";\r\n\r\nimport type { TouchButton3D } from \"./touchButton3D\";\r\n\r\n/**\r\n * Class used as base class for controls\r\n */\r\nexport class Control3D implements IDisposable, IBehaviorAware<Control3D> {\r\n private _node: Nullable<TransformNode>;\r\n private _downCount = 0;\r\n private _enterCount = -1;\r\n private _downPointerIds: { [id: number]: number } = {}; // Store number of pointer downs per ID, from near and far interactions\r\n\r\n protected _isVisible = true;\r\n\r\n /** @internal */\r\n public _host: GUI3DManager;\r\n /** @internal */\r\n public _isScaledByManager = false;\r\n\r\n /** Gets or sets the control position in world space */\r\n public get position(): Vector3 {\r\n if (!this._node) {\r\n return Vector3.Zero();\r\n }\r\n\r\n return this._node.position;\r\n }\r\n\r\n public set position(value: Vector3) {\r\n if (!this._node) {\r\n return;\r\n }\r\n\r\n this._node.position = value;\r\n }\r\n\r\n /** Gets or sets the control scaling in world space */\r\n public get scaling(): Vector3 {\r\n if (!this._node) {\r\n return new Vector3(1, 1, 1);\r\n }\r\n\r\n return this._node.scaling;\r\n }\r\n\r\n public set scaling(value: Vector3) {\r\n if (!this._node) {\r\n return;\r\n }\r\n\r\n this._isScaledByManager = false;\r\n this._node.scaling = value;\r\n }\r\n\r\n /** Callback used to start pointer enter animation */\r\n public pointerEnterAnimation: () => void;\r\n /** Callback used to start pointer out animation */\r\n public pointerOutAnimation: () => void;\r\n /** Callback used to start pointer down animation */\r\n public pointerDownAnimation: () => void;\r\n /** Callback used to start pointer up animation */\r\n public pointerUpAnimation: () => void;\r\n\r\n /**\r\n * An event triggered when the pointer moves over the control\r\n */\r\n public onPointerMoveObservable = new Observable<Vector3>();\r\n\r\n /**\r\n * An event triggered when the pointer moves out of the control\r\n */\r\n public onPointerOutObservable = new Observable<Control3D>();\r\n\r\n /**\r\n * An event triggered when the pointer taps the control\r\n */\r\n public onPointerDownObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when pointer is up\r\n */\r\n public onPointerUpObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when a control is clicked on (with a mouse)\r\n */\r\n public onPointerClickObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when pointer enters the control\r\n */\r\n public onPointerEnterObservable = new Observable<Control3D>();\r\n\r\n /**\r\n * Gets or sets the parent container\r\n */\r\n public parent: Nullable<Container3D>;\r\n\r\n // Behaviors\r\n private _behaviors = new Array<Behavior<Control3D>>();\r\n\r\n /**\r\n * Gets the list of attached behaviors\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n */\r\n public get behaviors(): Behavior<Control3D>[] {\r\n return this._behaviors;\r\n }\r\n\r\n /**\r\n * Attach a behavior to the control\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @param behavior defines the behavior to attach\r\n * @returns the current control\r\n */\r\n public addBehavior(behavior: Behavior<Control3D>): Control3D {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index !== -1) {\r\n return this;\r\n }\r\n\r\n behavior.init();\r\n const scene = this._host.scene;\r\n if (scene.isLoading) {\r\n // We defer the attach when the scene will be loaded\r\n scene.onDataLoadedObservable.addOnce(() => {\r\n behavior.attach(this);\r\n });\r\n } else {\r\n behavior.attach(this);\r\n }\r\n this._behaviors.push(behavior);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove an attached behavior\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @param behavior defines the behavior to attach\r\n * @returns the current control\r\n */\r\n public removeBehavior(behavior: Behavior<Control3D>): Control3D {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._behaviors[index].detach();\r\n this._behaviors.splice(index, 1);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets an attached behavior by name\r\n * @param name defines the name of the behavior to look for\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @returns null if behavior was not found else the requested behavior\r\n */\r\n public getBehaviorByName(name: string): Nullable<Behavior<Control3D>> {\r\n for (const behavior of this._behaviors) {\r\n if (behavior.name === name) {\r\n return behavior;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the control is visible */\r\n public get isVisible(): boolean {\r\n return this._isVisible;\r\n }\r\n\r\n public set isVisible(value: boolean) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n\r\n this._isVisible = value;\r\n\r\n const mesh = this.mesh;\r\n if (mesh) {\r\n mesh.setEnabled(value);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new control\r\n * @param name defines the control name\r\n */\r\n constructor(\r\n /** Defines the control name */\r\n public name?: string\r\n ) {}\r\n\r\n /**\r\n * Gets a string representing the class name\r\n */\r\n public get typeName(): string {\r\n return this._getTypeName();\r\n }\r\n\r\n /**\r\n * Get the current class name of the control.\r\n * @returns current class name\r\n */\r\n public getClassName(): string {\r\n return this._getTypeName();\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Control3D\";\r\n }\r\n\r\n /**\r\n * Gets the transform node used by this control\r\n */\r\n public get node(): Nullable<TransformNode> {\r\n return this._node;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public get mesh(): Nullable<AbstractMesh> {\r\n if (this._node instanceof AbstractMesh) {\r\n return this._node as AbstractMesh;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Link the control as child of the given node\r\n * @param node defines the node to link to. Use null to unlink the control\r\n * @returns the current control\r\n */\r\n public linkToTransformNode(node: Nullable<TransformNode>): Control3D {\r\n if (this._node) {\r\n this._node.parent = node;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * @internal*\r\n */\r\n public _prepareNode(scene: Scene): void {\r\n if (!this._node) {\r\n this._node = this._createNode(scene);\r\n\r\n if (!this.node) {\r\n return;\r\n }\r\n this._injectGUI3DReservedDataStore(this.node).control = this; // Store the control on the reservedDataStore field in order to get it when picking\r\n\r\n const mesh = this.mesh;\r\n if (mesh) {\r\n mesh.isPickable = true;\r\n\r\n this._affectMaterial(mesh);\r\n }\r\n }\r\n }\r\n\r\n protected _injectGUI3DReservedDataStore(node: TransformNode): any {\r\n node.reservedDataStore = node.reservedDataStore ?? {};\r\n node.reservedDataStore.GUI3D = node.reservedDataStore.GUI3D ?? {};\r\n return node.reservedDataStore.GUI3D;\r\n }\r\n\r\n /**\r\n * Node creation.\r\n * Can be overriden by children\r\n * @param scene defines the scene where the node must be attached\r\n * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an attached visible object\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n // Do nothing by default\r\n return null;\r\n }\r\n\r\n /**\r\n * Affect a material to the given mesh\r\n * @param mesh defines the mesh which will represent the control\r\n */\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n mesh.material = null;\r\n }\r\n\r\n private _isTouchButton3D(control: Control3D): control is TouchButton3D {\r\n return (control as TouchButton3D)._generatePointerEventType !== undefined;\r\n }\r\n\r\n // Pointers\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerMove(target: Control3D, coordinates: Vector3): void {\r\n this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerEnter(target: Control3D): boolean {\r\n if (this._enterCount === -1) {\r\n // -1 is for touch input, we are now sure we are with a mouse or pencil\r\n this._enterCount = 0;\r\n }\r\n\r\n this._enterCount++;\r\n\r\n if (this._enterCount > 1) {\r\n return false;\r\n }\r\n\r\n this.onPointerEnterObservable.notifyObservers(this, -1, target, this);\r\n\r\n if (this.pointerEnterAnimation) {\r\n this.pointerEnterAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerOut(target: Control3D): void {\r\n this._enterCount--;\r\n\r\n if (this._enterCount > 0) {\r\n return;\r\n }\r\n\r\n this._enterCount = 0;\r\n\r\n this.onPointerOutObservable.notifyObservers(this, -1, target, this);\r\n\r\n if (this.pointerOutAnimation) {\r\n this.pointerOutAnimation();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean {\r\n this._downCount++;\r\n this._downPointerIds[pointerId] = this._downPointerIds[pointerId] + 1 || 1;\r\n\r\n if (this._downCount !== 1) {\r\n return false;\r\n }\r\n\r\n this.onPointerDownObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n\r\n if (this.pointerDownAnimation) {\r\n this.pointerDownAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void {\r\n this._downCount--;\r\n this._downPointerIds[pointerId]--;\r\n\r\n if (this._downPointerIds[pointerId] <= 0) {\r\n delete this._downPointerIds[pointerId];\r\n }\r\n\r\n if (this._downCount < 0) {\r\n // Handle if forcePointerUp was called prior to this\r\n this._downCount = 0;\r\n return;\r\n }\r\n\r\n if (this._downCount == 0) {\r\n if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {\r\n this.onPointerClickObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n }\r\n this.onPointerUpObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n\r\n if (this.pointerUpAnimation) {\r\n this.pointerUpAnimation();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public forcePointerUp(pointerId: Nullable<number> = null) {\r\n if (pointerId !== null) {\r\n this._onPointerUp(this, Vector3.Zero(), pointerId, 0, true);\r\n } else {\r\n for (const key in this._downPointerIds) {\r\n this._onPointerUp(this, Vector3.Zero(), +key as number, 0, true);\r\n }\r\n if (this._downCount > 0) {\r\n this._downCount = 1;\r\n this._onPointerUp(this, Vector3.Zero(), 0, 0, true);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _processObservables(type: number, pickedPoint: Vector3, originMeshPosition: Nullable<Vector3>, pointerId: number, buttonIndex: number): boolean {\r\n if (this._isTouchButton3D(this) && originMeshPosition) {\r\n type = this._generatePointerEventType(type, originMeshPosition, this._downCount);\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n this._onPointerMove(this, pickedPoint);\r\n\r\n const previousControlOver = this._host._lastControlOver[pointerId];\r\n if (previousControlOver && previousControlOver !== this) {\r\n previousControlOver._onPointerOut(this);\r\n }\r\n\r\n if (previousControlOver !== this) {\r\n this._onPointerEnter(this);\r\n }\r\n\r\n this._host._lastControlOver[pointerId] = this;\r\n return true;\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERDOWN) {\r\n this._onPointerDown(this, pickedPoint, pointerId, buttonIndex);\r\n this._host._lastControlDown[pointerId] = this;\r\n this._host._lastPickedControl = this;\r\n return true;\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERUP || type === PointerEventTypes.POINTERDOUBLETAP) {\r\n if (this._host._lastControlDown[pointerId]) {\r\n this._host._lastControlDown[pointerId]._onPointerUp(this, pickedPoint, pointerId, buttonIndex, true);\r\n }\r\n delete this._host._lastControlDown[pointerId];\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n public _disposeNode(): void {\r\n if (this._node) {\r\n this._node.dispose();\r\n this._node = null;\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n this.onPointerDownObservable.clear();\r\n this.onPointerEnterObservable.clear();\r\n this.onPointerMoveObservable.clear();\r\n this.onPointerOutObservable.clear();\r\n this.onPointerUpObservable.clear();\r\n this.onPointerClickObservable.clear();\r\n\r\n this._disposeNode();\r\n\r\n // Behaviors\r\n for (const behavior of this._behaviors) {\r\n behavior.detach();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"control3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/control3D.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,iBAAiB,EAAE,gDAAkC;AAE9D,OAAO,EAAE,YAAY,EAAE,+CAAiC;AAKxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD;;GAEG;AACH,MAAM,OAAO,SAAS;IAalB,uDAAuD;IACvD,IAAW,QAAQ;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;SACzB;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC/B,CAAC;IAED,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO;SACV;QAED,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,sDAAsD;IACtD,IAAW,OAAO;QACd,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SAC/B;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,IAAW,OAAO,CAAC,KAAc;QAC7B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO;SACV;QAED,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;IAC/B,CAAC;IAiDD;;;OAGG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,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SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,gBAAgB;IACT,YAAY;QACf,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;SACrB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QAEtC,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,YAAY;QACZ,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;YACpC,QAAQ,CAAC,MAAM,EAAE,CAAC;SACrB;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { IBehaviorAware, Behavior } from \"core/Behaviors/behavior\";\r\nimport type { IDisposable, Scene } from \"core/scene\";\r\n\r\nimport type { GUI3DManager } from \"../gui3DManager\";\r\nimport { Vector3WithInfo } from \"../vector3WithInfo\";\r\nimport type { Container3D } from \"./container3D\";\r\n\r\nimport type { TouchButton3D } from \"./touchButton3D\";\r\n\r\n/**\r\n * Class used as base class for controls\r\n */\r\nexport class Control3D implements IDisposable, IBehaviorAware<Control3D> {\r\n private _node: Nullable<TransformNode>;\r\n private _downCount = 0;\r\n private _enterCount = -1;\r\n private _downPointerIds: { [id: number]: number } = {}; // Store number of pointer downs per ID, from near and far interactions\r\n\r\n protected _isVisible = true;\r\n\r\n /** @internal */\r\n public _host: GUI3DManager;\r\n /** @internal */\r\n public _isScaledByManager = false;\r\n\r\n /** Gets or sets the control position in world space */\r\n public get position(): Vector3 {\r\n if (!this._node) {\r\n return Vector3.Zero();\r\n }\r\n\r\n return this._node.position;\r\n }\r\n\r\n public set position(value: Vector3) {\r\n if (!this._node) {\r\n return;\r\n }\r\n\r\n this._node.position = value;\r\n }\r\n\r\n /** Gets or sets the control scaling in world space */\r\n public get scaling(): Vector3 {\r\n if (!this._node) {\r\n return new Vector3(1, 1, 1);\r\n }\r\n\r\n return this._node.scaling;\r\n }\r\n\r\n public set scaling(value: Vector3) {\r\n if (!this._node) {\r\n return;\r\n }\r\n\r\n this._isScaledByManager = false;\r\n this._node.scaling = value;\r\n }\r\n\r\n /** Callback used to start pointer enter animation */\r\n public pointerEnterAnimation: () => void;\r\n /** Callback used to start pointer out animation */\r\n public pointerOutAnimation: () => void;\r\n /** Callback used to start pointer down animation */\r\n public pointerDownAnimation: () => void;\r\n /** Callback used to start pointer up animation */\r\n public pointerUpAnimation: () => void;\r\n\r\n /**\r\n * An event triggered when the pointer moves over the control\r\n */\r\n public onPointerMoveObservable = new Observable<Vector3>();\r\n\r\n /**\r\n * An event triggered when the pointer moves out of the control\r\n */\r\n public onPointerOutObservable = new Observable<Control3D>();\r\n\r\n /**\r\n * An event triggered when the pointer taps the control\r\n */\r\n public onPointerDownObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when pointer is up\r\n */\r\n public onPointerUpObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when a control is clicked on (with a mouse)\r\n */\r\n public onPointerClickObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when pointer enters the control\r\n */\r\n public onPointerEnterObservable = new Observable<Control3D>();\r\n\r\n /**\r\n * Gets or sets the parent container\r\n */\r\n public parent: Nullable<Container3D>;\r\n\r\n // Behaviors\r\n private _behaviors = new Array<Behavior<Control3D>>();\r\n\r\n /**\r\n * Gets the list of attached behaviors\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n */\r\n public get behaviors(): Behavior<Control3D>[] {\r\n return this._behaviors;\r\n }\r\n\r\n /**\r\n * Attach a behavior to the control\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @param behavior defines the behavior to attach\r\n * @returns the current control\r\n */\r\n public addBehavior(behavior: Behavior<Control3D>): Control3D {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index !== -1) {\r\n return this;\r\n }\r\n\r\n behavior.init();\r\n const scene = this._host.scene;\r\n if (scene.isLoading) {\r\n // We defer the attach when the scene will be loaded\r\n scene.onDataLoadedObservable.addOnce(() => {\r\n behavior.attach(this);\r\n });\r\n } else {\r\n behavior.attach(this);\r\n }\r\n this._behaviors.push(behavior);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove an attached behavior\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @param behavior defines the behavior to attach\r\n * @returns the current control\r\n */\r\n public removeBehavior(behavior: Behavior<Control3D>): Control3D {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._behaviors[index].detach();\r\n this._behaviors.splice(index, 1);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets an attached behavior by name\r\n * @param name defines the name of the behavior to look for\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @returns null if behavior was not found else the requested behavior\r\n */\r\n public getBehaviorByName(name: string): Nullable<Behavior<Control3D>> {\r\n for (const behavior of this._behaviors) {\r\n if (behavior.name === name) {\r\n return behavior;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the control is visible */\r\n public get isVisible(): boolean {\r\n return this._isVisible;\r\n }\r\n\r\n public set isVisible(value: boolean) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n\r\n this._isVisible = value;\r\n\r\n const mesh = this.mesh;\r\n if (mesh) {\r\n mesh.setEnabled(value);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new control\r\n * @param name defines the control name\r\n */\r\n constructor(\r\n /** Defines the control name */\r\n public name?: string\r\n ) {}\r\n\r\n /**\r\n * Gets a string representing the class name\r\n */\r\n public get typeName(): string {\r\n return this._getTypeName();\r\n }\r\n\r\n /**\r\n * Get the current class name of the control.\r\n * @returns current class name\r\n */\r\n public getClassName(): string {\r\n return this._getTypeName();\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Control3D\";\r\n }\r\n\r\n /**\r\n * Gets the transform node used by this control\r\n */\r\n public get node(): Nullable<TransformNode> {\r\n return this._node;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public get mesh(): Nullable<AbstractMesh> {\r\n if (this._node instanceof AbstractMesh) {\r\n return this._node as AbstractMesh;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Link the control as child of the given node\r\n * @param node defines the node to link to. Use null to unlink the control\r\n * @returns the current control\r\n */\r\n public linkToTransformNode(node: Nullable<TransformNode>): Control3D {\r\n if (this._node) {\r\n this._node.parent = node;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _prepareNode(scene: Scene): void {\r\n if (!this._node) {\r\n this._node = this._createNode(scene);\r\n\r\n if (!this.node) {\r\n return;\r\n }\r\n this._injectGUI3DReservedDataStore(this.node).control = this; // Store the control on the reservedDataStore field in order to get it when picking\r\n\r\n const mesh = this.mesh;\r\n if (mesh) {\r\n mesh.isPickable = true;\r\n\r\n this._affectMaterial(mesh);\r\n }\r\n }\r\n }\r\n\r\n protected _injectGUI3DReservedDataStore(node: TransformNode): any {\r\n node.reservedDataStore = node.reservedDataStore ?? {};\r\n node.reservedDataStore.GUI3D = node.reservedDataStore.GUI3D ?? {};\r\n return node.reservedDataStore.GUI3D;\r\n }\r\n\r\n /**\r\n * Node creation.\r\n * Can be overriden by children\r\n * @param scene defines the scene where the node must be attached\r\n * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an attached visible object\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n // Do nothing by default\r\n return null;\r\n }\r\n\r\n /**\r\n * Affect a material to the given mesh\r\n * @param mesh defines the mesh which will represent the control\r\n */\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n mesh.material = null;\r\n }\r\n\r\n private _isTouchButton3D(control: Control3D): control is TouchButton3D {\r\n return (control as TouchButton3D)._generatePointerEventType !== undefined;\r\n }\r\n\r\n // Pointers\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerMove(target: Control3D, coordinates: Vector3): void {\r\n this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerEnter(target: Control3D): boolean {\r\n if (this._enterCount === -1) {\r\n // -1 is for touch input, we are now sure we are with a mouse or pencil\r\n this._enterCount = 0;\r\n }\r\n\r\n this._enterCount++;\r\n\r\n if (this._enterCount > 1) {\r\n return false;\r\n }\r\n\r\n this.onPointerEnterObservable.notifyObservers(this, -1, target, this);\r\n\r\n if (this.pointerEnterAnimation) {\r\n this.pointerEnterAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerOut(target: Control3D): void {\r\n this._enterCount--;\r\n\r\n if (this._enterCount > 0) {\r\n return;\r\n }\r\n\r\n this._enterCount = 0;\r\n\r\n this.onPointerOutObservable.notifyObservers(this, -1, target, this);\r\n\r\n if (this.pointerOutAnimation) {\r\n this.pointerOutAnimation();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean {\r\n this._downCount++;\r\n this._downPointerIds[pointerId] = this._downPointerIds[pointerId] + 1 || 1;\r\n\r\n if (this._downCount !== 1) {\r\n return false;\r\n }\r\n\r\n this.onPointerDownObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n\r\n if (this.pointerDownAnimation) {\r\n this.pointerDownAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void {\r\n this._downCount--;\r\n this._downPointerIds[pointerId]--;\r\n\r\n if (this._downPointerIds[pointerId] <= 0) {\r\n delete this._downPointerIds[pointerId];\r\n }\r\n\r\n if (this._downCount < 0) {\r\n // Handle if forcePointerUp was called prior to this\r\n this._downCount = 0;\r\n return;\r\n }\r\n\r\n if (this._downCount == 0) {\r\n if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {\r\n this.onPointerClickObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n }\r\n this.onPointerUpObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n\r\n if (this.pointerUpAnimation) {\r\n this.pointerUpAnimation();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public forcePointerUp(pointerId: Nullable<number> = null) {\r\n if (pointerId !== null) {\r\n this._onPointerUp(this, Vector3.Zero(), pointerId, 0, true);\r\n } else {\r\n for (const key in this._downPointerIds) {\r\n this._onPointerUp(this, Vector3.Zero(), +key as number, 0, true);\r\n }\r\n if (this._downCount > 0) {\r\n this._downCount = 1;\r\n this._onPointerUp(this, Vector3.Zero(), 0, 0, true);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _processObservables(type: number, pickedPoint: Vector3, originMeshPosition: Nullable<Vector3>, pointerId: number, buttonIndex: number): boolean {\r\n if (this._isTouchButton3D(this) && originMeshPosition) {\r\n type = this._generatePointerEventType(type, originMeshPosition, this._downCount);\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n this._onPointerMove(this, pickedPoint);\r\n\r\n const previousControlOver = this._host._lastControlOver[pointerId];\r\n if (previousControlOver && previousControlOver !== this) {\r\n previousControlOver._onPointerOut(this);\r\n }\r\n\r\n if (previousControlOver !== this) {\r\n this._onPointerEnter(this);\r\n }\r\n\r\n this._host._lastControlOver[pointerId] = this;\r\n return true;\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERDOWN) {\r\n this._onPointerDown(this, pickedPoint, pointerId, buttonIndex);\r\n this._host._lastControlDown[pointerId] = this;\r\n this._host._lastPickedControl = this;\r\n return true;\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERUP || type === PointerEventTypes.POINTERDOUBLETAP) {\r\n if (this._host._lastControlDown[pointerId]) {\r\n this._host._lastControlDown[pointerId]._onPointerUp(this, pickedPoint, pointerId, buttonIndex, true);\r\n }\r\n delete this._host._lastControlDown[pointerId];\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n public _disposeNode(): void {\r\n if (this._node) {\r\n this._node.dispose();\r\n this._node = null;\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n this.onPointerDownObservable.clear();\r\n this.onPointerEnterObservable.clear();\r\n this.onPointerMoveObservable.clear();\r\n this.onPointerOutObservable.clear();\r\n this.onPointerUpObservable.clear();\r\n this.onPointerClickObservable.clear();\r\n\r\n this._disposeNode();\r\n\r\n // Behaviors\r\n for (const behavior of this._behaviors) {\r\n behavior.detach();\r\n }\r\n }\r\n}\r\n"]}
@@ -115,7 +115,7 @@ export declare class HolographicSlate extends ContentDisplay3D {
115
115
  private _attachContentPlateBehavior;
116
116
  protected _affectMaterial(mesh: AbstractMesh): void;
117
117
  /**
118
- * @internal*
118
+ * @internal
119
119
  */
120
120
  _prepareNode(scene: Scene): void;
121
121
  /**
@@ -325,7 +325,7 @@ export class HolographicSlate extends ContentDisplay3D {
325
325
  this._applyContentViewport();
326
326
  }
327
327
  /**
328
- * @internal*
328
+ * @internal
329
329
  */
330
330
  _prepareNode(scene) {
331
331
  super._prepareNode(scene);
@@ -1 +1 @@
1
- {"version":3,"file":"holographicSlate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicSlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,gDAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACtE,OAAO,EAAE,QAAQ,EAAE,+CAAiC;AAEpD,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAEhE,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,UAAU,EAAE,kDAAoC;AAKzD;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IA0ClD;;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e,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 _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 _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 _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 _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 _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 _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 dispose() {\r\n super.dispose();\r\n this._titleBarMaterial.dispose();\r\n this._contentMaterial.dispose();\r\n\r\n this._titleBar.dispose();\r\n this._titleBarTitle.dispose();\r\n this._contentPlate.dispose();\r\n this._backPlate.dispose();\r\n\r\n this._followButton.dispose();\r\n this._closeButton.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver);\r\n\r\n this._defaultBehavior.detach();\r\n this._gizmo.dispose();\r\n this._contentDragBehavior.detach();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"holographicSlate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicSlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,gDAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,6C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B,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 _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 _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 _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 _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 _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 _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 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"]}
@@ -50,8 +50,8 @@ export declare class TouchHolographicMenu extends VolumeBasedPanel {
50
50
  /**
51
51
  * This method should not be used directly. It is inherited from `Container3D`.
52
52
  * Please use `addButton` instead.
53
- * @param _control
54
- * @returns
53
+ * @param _control the control to add
54
+ * @returns the current container
55
55
  */
56
56
  addControl(_control: Control3D): Container3D;
57
57
  /**
@@ -116,8 +116,8 @@ export class TouchHolographicMenu extends VolumeBasedPanel {
116
116
  /**
117
117
  * This method should not be used directly. It is inherited from `Container3D`.
118
118
  * Please use `addButton` instead.
119
- * @param _control
120
- * @returns
119
+ * @param _control the control to add
120
+ * @returns the current container
121
121
  */
122
122
  addControl(_control) {
123
123
  Logger.Warn("TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead.");