@vertexvis/viewer 0.24.4-canary.9 → 0.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.template.md +6 -0
- package/dist/cjs/{cursors-2dfb0ef3.js → cursors-17ad74ac.js} +2 -2
- package/dist/cjs/{cursors-2dfb0ef3.js.map → cursors-17ad74ac.js.map} +1 -1
- package/dist/cjs/dom-fc408b4c.js.map +1 -1
- package/dist/cjs/{index-5fa5a527.js → index-0abd8b0b.js} +2 -2
- package/dist/cjs/index-0abd8b0b.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/{queries-cf96c8bc.js → queries-4580caa5.js} +8 -2
- package/dist/cjs/queries-4580caa5.js.map +1 -0
- package/dist/cjs/{shadow-css-8962c4a9.js → shadow-css-37297ac8.js} +1 -1
- package/dist/cjs/shadow-css-37297ac8.js.map +1 -0
- package/dist/cjs/{stencil-a3f4e15b.js → stencil-40ef9119.js} +2 -2
- package/dist/cjs/{stencil-a3f4e15b.js.map → stencil-40ef9119.js.map} +1 -1
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js +8 -2
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-column.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-header.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-resize-divider.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-toolbar-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-annotation-callout.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-button_3.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-default-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-icon.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-layer.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-spinner.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +22 -11
- package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
- package/dist/cjs/viewer.cjs.js +1 -1
- package/dist/cjs/viewer.cjs.js.map +1 -1
- package/dist/collection/components/scene-tree-search/scene-tree-search.js +21 -1
- package/dist/collection/components/scene-tree-search/scene-tree-search.js.map +1 -1
- package/dist/collection/components/viewer/viewer.js +18 -7
- package/dist/collection/components/viewer/viewer.js.map +1 -1
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.css +5 -0
- package/dist/collection/components/viewer-walk-mode-tool/viewer-walk-mode-tool.js +3 -3
- package/dist/collection/components/viewer-walk-mode-tool/viewer-walk-mode-tool.js.map +1 -1
- package/dist/collection/lib/cursors.js +1 -1
- package/dist/collection/lib/cursors.js.map +1 -1
- package/dist/collection/lib/model-views/controller.js +7 -1
- package/dist/collection/lib/model-views/controller.js.map +1 -1
- package/dist/collection/lib/stream/stream.js +4 -3
- package/dist/collection/lib/stream/stream.js.map +1 -1
- package/dist/collection/testing/viewer.js +1 -1
- package/dist/collection/testing/viewer.js.map +1 -1
- package/dist/components/cursors.js +1 -1
- package/dist/components/cursors.js.map +1 -1
- package/dist/components/queries.js +7 -1
- package/dist/components/queries.js.map +1 -1
- package/dist/components/scene-tree-search.js +6 -0
- package/dist/components/scene-tree-search.js.map +1 -1
- package/dist/components/vertex-viewer-walk-mode-tool.js +3 -3
- package/dist/components/vertex-viewer-walk-mode-tool.js.map +1 -1
- package/dist/components/vertex-viewer.js +18 -7
- package/dist/components/vertex-viewer.js.map +1 -1
- package/dist/components/viewer-pin-group.js +1 -1
- package/dist/components/viewer-pin-group.js.map +1 -1
- package/dist/esm/{cursors-9e349d61.js → cursors-3806bc04.js} +2 -2
- package/dist/esm/{cursors-9e349d61.js.map → cursors-3806bc04.js.map} +1 -1
- package/dist/esm/dom-dba69343.js.map +1 -1
- package/dist/esm/{index-f3e96c9e.js → index-c12dc0cd.js} +2 -2
- package/dist/esm/index-c12dc0cd.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/loader.mjs +1 -1
- package/dist/esm/{queries-2f4a492c.js → queries-948a88f9.js} +8 -2
- package/dist/esm/queries-948a88f9.js.map +1 -0
- package/dist/esm/{shadow-css-9363884b.js → shadow-css-d5069bdf.js} +1 -1
- package/dist/esm/shadow-css-d5069bdf.js.map +1 -0
- package/dist/esm/{stencil-9d9f090f.js → stencil-38b2fc28.js} +2 -2
- package/dist/esm/{stencil-9d9f090f.js.map → stencil-38b2fc28.js.map} +1 -1
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js +8 -2
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js.map +1 -1
- package/dist/esm/vertex-scene-tree-table-cell.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-column.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-header.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-resize-divider.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-toolbar-group.entry.js +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +1 -1
- package/dist/esm/vertex-viewer-annotation-callout.entry.js +1 -1
- package/dist/esm/vertex-viewer-box-query-tool.entry.js +2 -2
- package/dist/esm/vertex-viewer-button_3.entry.js +1 -1
- package/dist/esm/vertex-viewer-default-toolbar.entry.js +1 -1
- package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
- package/dist/esm/vertex-viewer-dom-group.entry.js +1 -1
- package/dist/esm/vertex-viewer-hit-result-indicator.entry.js +2 -2
- package/dist/esm/vertex-viewer-icon.entry.js +1 -1
- package/dist/esm/vertex-viewer-layer.entry.js +1 -1
- package/dist/esm/vertex-viewer-markup-arrow_3.entry.js +1 -1
- package/dist/esm/vertex-viewer-markup-tool.entry.js +1 -1
- package/dist/esm/vertex-viewer-markup.entry.js +1 -1
- package/dist/esm/vertex-viewer-measurement-details.entry.js +1 -1
- package/dist/esm/vertex-viewer-measurement-distance.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +1 -1
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +2 -2
- package/dist/esm/vertex-viewer-pin-group.entry.js +3 -3
- package/dist/esm/vertex-viewer-pin-group.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-label_2.entry.js +2 -2
- package/dist/esm/vertex-viewer-pin-tool.entry.js +2 -2
- package/dist/esm/vertex-viewer-spinner.entry.js +1 -1
- package/dist/esm/vertex-viewer-teleport-tool.entry.js +1 -1
- package/dist/esm/vertex-viewer-transform-widget.entry.js +2 -2
- package/dist/esm/vertex-viewer-view-cube.entry.js +2 -2
- package/dist/esm/vertex-viewer-walk-mode-tool.entry.js +4 -4
- package/dist/esm/vertex-viewer-walk-mode-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer.entry.js +22 -11
- package/dist/esm/vertex-viewer.entry.js.map +1 -1
- package/dist/esm/viewer.js +1 -1
- package/dist/esm/viewer.js.map +1 -1
- package/dist/types/components/scene-tree-search/scene-tree-search.d.ts +5 -1
- package/dist/types/components/viewer/viewer.d.ts +3 -2
- package/dist/types/components.d.ts +9 -5
- package/dist/types/lib/stream/stream.d.ts +1 -1
- package/dist/types/testing/viewer.d.ts +1 -1
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/{p-0e0973f0.entry.js → p-03efd0d6.entry.js} +2 -2
- package/dist/viewer/{p-7f0eeb06.entry.js → p-0988832f.entry.js} +2 -2
- package/dist/viewer/{p-78a1be4e.entry.js → p-0aa04328.entry.js} +2 -2
- package/dist/viewer/p-18ce3f3b.entry.js +5 -0
- package/dist/viewer/{p-9bb550e2.entry.js.map → p-18ce3f3b.entry.js.map} +1 -1
- package/dist/viewer/{p-2ecdcd5d.entry.js → p-23f0bb30.entry.js} +2 -2
- package/dist/viewer/{p-06b8bca7.entry.js → p-296311d3.entry.js} +2 -2
- package/dist/viewer/{p-2172230d.entry.js → p-2fd66679.entry.js} +2 -2
- package/dist/viewer/{p-5540add8.entry.js → p-362f3e12.entry.js} +2 -2
- package/dist/viewer/{p-110f66c6.js → p-388f809e.js} +2 -2
- package/dist/viewer/p-388f809e.js.map +1 -0
- package/dist/viewer/{p-48b63c5f.entry.js → p-45044ff2.entry.js} +2 -2
- package/dist/viewer/{p-9fc2e56e.entry.js → p-45b5b5ed.entry.js} +2 -2
- package/dist/viewer/{p-f79933ae.entry.js → p-4bd1ea70.entry.js} +2 -2
- package/dist/viewer/{p-842cc51b.entry.js → p-4bf16450.entry.js} +2 -2
- package/dist/viewer/{p-a057d7f2.entry.js → p-56fa8168.entry.js} +2 -2
- package/dist/viewer/{p-8c367e87.entry.js → p-59f204e7.entry.js} +2 -2
- package/dist/viewer/p-59f204e7.entry.js.map +1 -0
- package/dist/viewer/{p-33033b58.entry.js → p-6cf6eb8a.entry.js} +2 -2
- package/dist/viewer/p-715255e1.entry.js +5 -0
- package/dist/viewer/p-715255e1.entry.js.map +1 -0
- package/dist/viewer/{p-5f9352c0.entry.js → p-75f5ae33.entry.js} +2 -2
- package/dist/viewer/{p-7eea3fb3.entry.js → p-7a87ae97.entry.js} +2 -2
- package/dist/viewer/{p-22b42d4b.entry.js → p-86e1ee86.entry.js} +2 -2
- package/dist/viewer/p-89d93218.entry.js +5 -0
- package/dist/viewer/p-89d93218.entry.js.map +1 -0
- package/dist/viewer/{p-07325d65.entry.js → p-8c53ed63.entry.js} +2 -2
- package/dist/viewer/p-991f7bac.js.map +1 -1
- package/dist/viewer/{p-983db3dd.entry.js → p-a009c6d9.entry.js} +2 -2
- package/dist/viewer/{p-dcb64250.entry.js → p-a3bc0b79.entry.js} +2 -2
- package/dist/viewer/{p-29318a17.entry.js → p-aece4279.entry.js} +2 -2
- package/dist/viewer/{p-be257155.js → p-b8c0f6ff.js} +1 -1
- package/dist/viewer/p-b8c0f6ff.js.map +1 -0
- package/dist/viewer/p-bab8266e.js +5 -0
- package/dist/viewer/p-bab8266e.js.map +1 -0
- package/dist/viewer/{p-05562c21.entry.js → p-bcddbdb2.entry.js} +2 -2
- package/dist/viewer/{p-40e8a5ea.entry.js → p-c3b071a3.entry.js} +2 -2
- package/dist/viewer/{p-fbfa1e82.entry.js → p-cd3f0870.entry.js} +2 -2
- package/dist/viewer/{p-d2677c13.entry.js → p-d9e75269.entry.js} +2 -2
- package/dist/viewer/p-e1eaedd8.js +5 -0
- package/dist/viewer/{p-a27a9775.entry.js → p-e70e2c04.entry.js} +2 -2
- package/dist/viewer/{p-ffa8a2dd.entry.js → p-ebea8f56.entry.js} +2 -2
- package/dist/viewer/{p-342dac8b.js → p-eda9f5d4.js} +2 -2
- package/dist/viewer/{p-342dac8b.js.map → p-eda9f5d4.js.map} +1 -1
- package/dist/viewer/{p-9d54d593.entry.js → p-f292e8ae.entry.js} +2 -2
- package/dist/viewer/{p-d024c250.entry.js → p-f8a9c4d2.entry.js} +2 -2
- package/dist/viewer/viewer.esm.js +1 -1
- package/dist/viewer/viewer.esm.js.map +1 -1
- package/package.json +7 -7
- package/readme.md +10 -4
- package/dist/cjs/index-5fa5a527.js.map +0 -1
- package/dist/cjs/queries-cf96c8bc.js.map +0 -1
- package/dist/cjs/shadow-css-8962c4a9.js.map +0 -1
- package/dist/esm/index-f3e96c9e.js.map +0 -1
- package/dist/esm/queries-2f4a492c.js.map +0 -1
- package/dist/esm/shadow-css-9363884b.js.map +0 -1
- package/dist/viewer/p-04bf6b89.js +0 -5
- package/dist/viewer/p-110f66c6.js.map +0 -1
- package/dist/viewer/p-51eff23a.entry.js +0 -5
- package/dist/viewer/p-51eff23a.entry.js.map +0 -1
- package/dist/viewer/p-629a5ae7.entry.js +0 -5
- package/dist/viewer/p-629a5ae7.entry.js.map +0 -1
- package/dist/viewer/p-8c367e87.entry.js.map +0 -1
- package/dist/viewer/p-9bb550e2.entry.js +0 -5
- package/dist/viewer/p-b2e80d7f.js +0 -5
- package/dist/viewer/p-b2e80d7f.js.map +0 -1
- package/dist/viewer/p-be257155.js.map +0 -1
- /package/dist/viewer/{p-0e0973f0.entry.js.map → p-03efd0d6.entry.js.map} +0 -0
- /package/dist/viewer/{p-7f0eeb06.entry.js.map → p-0988832f.entry.js.map} +0 -0
- /package/dist/viewer/{p-78a1be4e.entry.js.map → p-0aa04328.entry.js.map} +0 -0
- /package/dist/viewer/{p-2ecdcd5d.entry.js.map → p-23f0bb30.entry.js.map} +0 -0
- /package/dist/viewer/{p-06b8bca7.entry.js.map → p-296311d3.entry.js.map} +0 -0
- /package/dist/viewer/{p-2172230d.entry.js.map → p-2fd66679.entry.js.map} +0 -0
- /package/dist/viewer/{p-5540add8.entry.js.map → p-362f3e12.entry.js.map} +0 -0
- /package/dist/viewer/{p-48b63c5f.entry.js.map → p-45044ff2.entry.js.map} +0 -0
- /package/dist/viewer/{p-9fc2e56e.entry.js.map → p-45b5b5ed.entry.js.map} +0 -0
- /package/dist/viewer/{p-f79933ae.entry.js.map → p-4bd1ea70.entry.js.map} +0 -0
- /package/dist/viewer/{p-842cc51b.entry.js.map → p-4bf16450.entry.js.map} +0 -0
- /package/dist/viewer/{p-a057d7f2.entry.js.map → p-56fa8168.entry.js.map} +0 -0
- /package/dist/viewer/{p-33033b58.entry.js.map → p-6cf6eb8a.entry.js.map} +0 -0
- /package/dist/viewer/{p-5f9352c0.entry.js.map → p-75f5ae33.entry.js.map} +0 -0
- /package/dist/viewer/{p-7eea3fb3.entry.js.map → p-7a87ae97.entry.js.map} +0 -0
- /package/dist/viewer/{p-22b42d4b.entry.js.map → p-86e1ee86.entry.js.map} +0 -0
- /package/dist/viewer/{p-07325d65.entry.js.map → p-8c53ed63.entry.js.map} +0 -0
- /package/dist/viewer/{p-983db3dd.entry.js.map → p-a009c6d9.entry.js.map} +0 -0
- /package/dist/viewer/{p-dcb64250.entry.js.map → p-a3bc0b79.entry.js.map} +0 -0
- /package/dist/viewer/{p-29318a17.entry.js.map → p-aece4279.entry.js.map} +0 -0
- /package/dist/viewer/{p-05562c21.entry.js.map → p-bcddbdb2.entry.js.map} +0 -0
- /package/dist/viewer/{p-40e8a5ea.entry.js.map → p-c3b071a3.entry.js.map} +0 -0
- /package/dist/viewer/{p-fbfa1e82.entry.js.map → p-cd3f0870.entry.js.map} +0 -0
- /package/dist/viewer/{p-d2677c13.entry.js.map → p-d9e75269.entry.js.map} +0 -0
- /package/dist/viewer/{p-04bf6b89.js.map → p-e1eaedd8.js.map} +0 -0
- /package/dist/viewer/{p-a27a9775.entry.js.map → p-e70e2c04.entry.js.map} +0 -0
- /package/dist/viewer/{p-ffa8a2dd.entry.js.map → p-ebea8f56.entry.js.map} +0 -0
- /package/dist/viewer/{p-9d54d593.entry.js.map → p-f292e8ae.entry.js.map} +0 -0
- /package/dist/viewer/{p-d024c250.entry.js.map → p-f8a9c4d2.entry.js.map} +0 -0
package/dist/esm/viewer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import { d as doc, N as NAMESPACE, w as win, p as promiseResolve, b as bootstrapLazy } from './index-
|
|
4
|
+
import { d as doc, N as NAMESPACE, w as win, p as promiseResolve, b as bootstrapLazy } from './index-c12dc0cd.js';
|
|
5
5
|
import { g as globalScripts } from './app-globals-a0ad0331.js';
|
|
6
6
|
import './_commonjsHelpers-43fe435c.js';
|
|
7
7
|
|
package/dist/esm/viewer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"viewer.js","mappings":"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","names":[],"sources":["
|
|
1
|
+
{"file":"viewer.js","mappings":"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","names":[],"sources":["./node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n if (BUILD.cssVarShim) {\n // shim css vars\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","import { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"version":3}
|
|
@@ -34,10 +34,14 @@ export declare class SceneTreeSearch {
|
|
|
34
34
|
*/
|
|
35
35
|
value: string;
|
|
36
36
|
/**
|
|
37
|
-
* An event that is emitted when a user has
|
|
37
|
+
* An event that is emitted when a user has changed or cleared the search
|
|
38
38
|
* term. The event may be delayed according to the current `debounce` value.
|
|
39
39
|
*/
|
|
40
40
|
search: EventEmitter<string>;
|
|
41
|
+
/**
|
|
42
|
+
* An event that is emitted when a search has completed.
|
|
43
|
+
*/
|
|
44
|
+
searchCompleted: EventEmitter<string>;
|
|
41
45
|
private focused;
|
|
42
46
|
private isSearching;
|
|
43
47
|
private lastEmittedValue?;
|
|
@@ -164,12 +164,13 @@ export declare class Viewer {
|
|
|
164
164
|
*/
|
|
165
165
|
sceneComparison?: SceneComparisonOptions;
|
|
166
166
|
/**
|
|
167
|
-
* Specifies
|
|
167
|
+
* Specifies options related to presentation of cross-sections.
|
|
168
|
+
* Defaults to showing the cross-section with an end cap that matches the part color.
|
|
168
169
|
*/
|
|
169
170
|
crossSectioning?: CrossSectioningOptions;
|
|
170
171
|
/**
|
|
171
172
|
* Specifies when a feature map is returned from rendering. Feature maps
|
|
172
|
-
* include information about the surfaces, edges and cross
|
|
173
|
+
* include information about the surfaces, edges and cross-sections that are
|
|
173
174
|
* in a frame.
|
|
174
175
|
*
|
|
175
176
|
* Possible values are:
|
|
@@ -422,7 +422,7 @@ export namespace Components {
|
|
|
422
422
|
*/
|
|
423
423
|
"configEnv": Environment;
|
|
424
424
|
/**
|
|
425
|
-
* Specifies
|
|
425
|
+
* Specifies options related to presentation of cross-sections. Defaults to showing the cross-section with an end cap that matches the part color.
|
|
426
426
|
*/
|
|
427
427
|
"crossSectioning"?: CrossSectioningOptions;
|
|
428
428
|
/**
|
|
@@ -455,7 +455,7 @@ export namespace Components {
|
|
|
455
455
|
*/
|
|
456
456
|
"featureLines"?: FeatureLineOptions;
|
|
457
457
|
/**
|
|
458
|
-
* Specifies when a feature map is returned from rendering. Feature maps include information about the surfaces, edges and cross
|
|
458
|
+
* Specifies when a feature map is returned from rendering. Feature maps include information about the surfaces, edges and cross-sections that are in a frame. Possible values are: * `undefined`: A feature map is never requested. * `final`: A feature map is only requested on the final frame. * `all`: A feature map is requested for every frame. Feature maps can increase the amount of data that's sent to a client and can impact rendering performance. Values of `undefined` or `final` should be used when needing the highest rendering performance.
|
|
459
459
|
*/
|
|
460
460
|
"featureMaps"?: FrameType;
|
|
461
461
|
/**
|
|
@@ -1909,9 +1909,13 @@ declare namespace LocalJSX {
|
|
|
1909
1909
|
*/
|
|
1910
1910
|
"disabled"?: boolean;
|
|
1911
1911
|
/**
|
|
1912
|
-
* An event that is emitted when a user has
|
|
1912
|
+
* An event that is emitted when a user has changed or cleared the search term. The event may be delayed according to the current `debounce` value.
|
|
1913
1913
|
*/
|
|
1914
1914
|
"onSearch"?: (event: VertexSceneTreeSearchCustomEvent<string>) => void;
|
|
1915
|
+
/**
|
|
1916
|
+
* An event that is emitted when a search has completed.
|
|
1917
|
+
*/
|
|
1918
|
+
"onSearchCompleted"?: (event: VertexSceneTreeSearchCustomEvent<string>) => void;
|
|
1915
1919
|
/**
|
|
1916
1920
|
* Placeholder text if `value` is empty.
|
|
1917
1921
|
*/
|
|
@@ -2070,7 +2074,7 @@ declare namespace LocalJSX {
|
|
|
2070
2074
|
*/
|
|
2071
2075
|
"configEnv"?: Environment;
|
|
2072
2076
|
/**
|
|
2073
|
-
* Specifies
|
|
2077
|
+
* Specifies options related to presentation of cross-sections. Defaults to showing the cross-section with an end cap that matches the part color.
|
|
2074
2078
|
*/
|
|
2075
2079
|
"crossSectioning"?: CrossSectioningOptions;
|
|
2076
2080
|
/**
|
|
@@ -2094,7 +2098,7 @@ declare namespace LocalJSX {
|
|
|
2094
2098
|
*/
|
|
2095
2099
|
"featureLines"?: FeatureLineOptions;
|
|
2096
2100
|
/**
|
|
2097
|
-
* Specifies when a feature map is returned from rendering. Feature maps include information about the surfaces, edges and cross
|
|
2101
|
+
* Specifies when a feature map is returned from rendering. Feature maps include information about the surfaces, edges and cross-sections that are in a frame. Possible values are: * `undefined`: A feature map is never requested. * `final`: A feature map is only requested on the final frame. * `all`: A feature map is requested for every frame. Feature maps can increase the amount of data that's sent to a client and can impact rendering performance. Values of `undefined` or `final` should be used when needing the highest rendering performance.
|
|
2098
2102
|
*/
|
|
2099
2103
|
"featureMaps"?: FrameType;
|
|
2100
2104
|
/**
|
|
@@ -54,7 +54,7 @@ export declare class ViewerStream extends StreamApi {
|
|
|
54
54
|
isPaused(): boolean;
|
|
55
55
|
getState(): ViewerStreamState;
|
|
56
56
|
disconnect(): void;
|
|
57
|
-
load(urn: string, clientId: string | undefined, deviceId: string | undefined, config?: Config, cameraType?: FrameCameraType): Promise<
|
|
57
|
+
load(urn: string, clientId: string | undefined, deviceId: string | undefined, config?: Config, cameraType?: FrameCameraType): Promise<ViewerStreamState>;
|
|
58
58
|
update(fields: UpdateFields): void;
|
|
59
59
|
pause(): void;
|
|
60
60
|
resume(): Promise<void>;
|
|
@@ -8,7 +8,7 @@ interface ViewerStreamOperationCtx {
|
|
|
8
8
|
}
|
|
9
9
|
interface LoadViewerStreamKeyOptions {
|
|
10
10
|
token?: string;
|
|
11
|
-
beforeConnected?: VoidFunction;
|
|
11
|
+
beforeConnected?: VoidFunction | (() => Promise<void>);
|
|
12
12
|
}
|
|
13
13
|
export declare const key1 = "urn:vertex:stream-key:123";
|
|
14
14
|
export declare const key2 = "urn:vertex:stream-key:234";
|
package/dist/viewer/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
export{C as Camera,c as ColorMaterial,a as CrossSectioner,I as ItemOperationBuilder,l as LoadableResource,M as ModelViewController,P as PmiAnnotationOperationsBuilder,b as PmiAnnotationsQueryExecutor,k as PmiController,R as Raycaster,d as RootQuery,S as Scene,e as SceneElementQueryExecutor,f as SceneElementsOperationExecutor,g as SceneItemOperationsBuilder,h as SceneItemQueryExecutor,i as SceneItemsOperationExecutor,s as SceneViewStateIdentifier,j as SynchronizedClock}from"./p-
|
|
4
|
+
export{C as Camera,c as ColorMaterial,a as CrossSectioner,I as ItemOperationBuilder,l as LoadableResource,M as ModelViewController,P as PmiAnnotationOperationsBuilder,b as PmiAnnotationsQueryExecutor,k as PmiController,R as Raycaster,d as RootQuery,S as Scene,e as SceneElementQueryExecutor,f as SceneElementsOperationExecutor,g as SceneItemOperationsBuilder,h as SceneItemQueryExecutor,i as SceneItemsOperationExecutor,s as SceneViewStateIdentifier,j as SynchronizedClock}from"./p-bab8266e.js";export{S as SceneTreeController}from"./p-f8951894.js";export{f as fromNodeProto,i as isLoadedRow}from"./p-e4f95584.js";export{S as SCENE_ITEM_NAME_METADATA_KEY}from"./p-adf28726.js";export{C as CursorManager,b as boxQueryCursor,l as labelPinCursor,m as measurementCursor,a as measurementWithArrowCursor,p as pinCursor}from"./p-eda9f5d4.js";export{M as MeasurementController,a as MeasurementEntity}from"./p-0002067b.js";export{M as MeasurementModel}from"./p-85f178eb.js";export{M as MeasurementOverlayManager}from"./p-c907be82.js";export{m as makeMinimumDistanceResult}from"./p-c6d36163.js";import{v as r,q as o,m as n}from"./p-9d26f24e.js";export{T as TransformController}from"./p-ef71c07a.js";export{f as flattenPointArray,a as toDegreesTransform,e as toLocalTransform,b as toMatrix,t as toRadiansTransform,c as toTransform,d as toWorldTransform}from"./p-a4a34f15.js";export{A as AngleUnits,g as AreaUnits,c as CrossSectioning,D as DistanceUnits,F as FrameCameraBase,O as Orientation,a as ReceivedFrame,b as ReceivedFrameImage,d as ReceivedFrameScene,e as ReceivedOrthographicCamera,f as ReceivedPerspectiveCamera,S as StandardView}from"./p-e656bd4c.js";export{E as EntityType}from"./p-0d971ad6.js";export{A as ArrowMarkup,C as CircleMarkup,F as FreeformMarkup}from"./p-b46da63b.js";export{V as Viewport}from"./p-148e5f47.js";export{V as VolumeIntersectionQueryController,a as VolumeIntersectionQueryModel}from"./p-f117c0da.js";import"./p-6b00f7cd.js";import"./p-ba120f65.js";import"./p-e5cc48b6.js";import"./p-5ca72d4a.js";import"./p-7af4e8a6.js";import"./p-3a522068.js";import"./p-e3945092.js";import"./p-3060996e.js";import"./p-36dcfc94.js";const u=.9999;function x(e){const a=r.create(0,e.z,-e.y);const o=r.create(-e.z,0,e.x);const s=r.magnitudeSquared(a)>r.magnitudeSquared(o)?a:o;return r.normalize(r.cross(e,s))}function y(e,a){const s=r.dot(e,a);if(s>u){const r=x(e);const a=o.fromAxisAngle(r,Math.PI);return n.makeRotation(a)}else if(s<=-u){return n.makeIdentity()}else{const s=r.angleTo(a,e);const t=r.normalize(r.cross(e,a));return n.makeRotation(o.fromAxisAngle(t,s+Math.PI))}}function _(e,a,o,s){const t=y(e,o);const i=n.makeTranslation(s);return n.multiply(n.multiply(i,t),n.makeTranslation(r.negate(a)))}const v=Object.freeze({__proto__:null,ALMOST_ONE:u,calculateOrthogonalCoordinate:x,computeRotationMatrix:y,computeTransformationDelta:_});export{v as TransformationDelta};
|
|
5
5
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as r,H as s}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as e,h as r,H as s}from"./p-388f809e.js";const o=":host{width:100%;box-sizing:border-box}.header{display:flex;align-items:center;box-sizing:border-box;font-size:0.875rem;white-space:nowrap;overflow:hidden;padding:0.5rem 0}";const t=class{constructor(r){e(this,r)}render(){return r(s,null,r("div",{class:"header"},r("slot",null)))}};t.style=o;export{t as vertex_scene_tree_table_header};
|
|
5
|
+
//# sourceMappingURL=p-03efd0d6.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{r as i,c as e,h as t,H as s,g as o}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as i,c as e,h as t,H as s,g as o}from"./p-388f809e.js";import{a as l,V as r}from"./p-f117c0da.js";import{b as h}from"./p-eda9f5d4.js";import{g as n}from"./p-95f6305a.js";import"./p-3060996e.js";import"./p-9d26f24e.js";import"./p-6b00f7cd.js";class d{constructor(i){this.controller=i;this.handleDragBegin=this.handleDragBegin.bind(this);this.handleDrag=this.handleDrag.bind(this);this.handleDragEnd=this.handleDragEnd.bind(this);this.enabled=true}initialize(i,e){this.element=i;this.api=e;this.element.addEventListener("pointerdown",this.handleDragBegin);this.addCrosshairCursor()}dispose(){var i,e,t;(i=this.element)===null||i===void 0?void 0:i.removeEventListener("pointerdown",this.handleDragBegin);window.removeEventListener("pointermove",this.handleDrag);window.removeEventListener("pointerup",this.handleDragEnd);(e=this.crosshairCursorDisposable)===null||e===void 0?void 0:e.dispose();(t=this.waitCursorDisposable)===null||t===void 0?void 0:t.dispose();this.element=undefined;this.api=undefined;this.enabled=true}disable(){this.enabled=false}enable(){this.enabled=true}handleDragBegin(i){var e;if(this.enabled&&this.isPrimaryMouseButtonClick(i)&&!this.isInteracting){this.elementBounds=(e=this.element)===null||e===void 0?void 0:e.getBoundingClientRect();this.isInteracting=true;this.controller.setStartPoint(n(i,this.elementBounds));window.addEventListener("pointermove",this.handleDrag);window.addEventListener("pointerup",this.handleDragEnd)}}handleDrag(i){if(this.enabled){this.controller.setEndPoint(n(i,this.elementBounds))}}async handleDragEnd(){var i,e;this.isInteracting=false;window.removeEventListener("pointermove",this.handleDrag);window.removeEventListener("pointerup",this.handleDragEnd);(i=this.crosshairCursorDisposable)===null||i===void 0?void 0:i.dispose();if(this.enabled){this.addWaitCursor();try{await this.controller.execute()}finally{(e=this.waitCursorDisposable)===null||e===void 0?void 0:e.dispose();this.addCrosshairCursor()}}}isPrimaryMouseButtonClick(i){return i.buttons===1}addCrosshairCursor(){var i,e;(i=this.crosshairCursorDisposable)===null||i===void 0?void 0:i.dispose();this.crosshairCursorDisposable=(e=this.api)===null||e===void 0?void 0:e.addCursor(h)}addWaitCursor(){var i,e;(i=this.waitCursorDisposable)===null||i===void 0?void 0:i.dispose();this.waitCursorDisposable=(e=this.api)===null||e===void 0?void 0:e.addCursor("wait")}}const u=':host{--viewer-box-query-outline-exclusive-color:#0099cc;--viewer-box-query-outline-exclusive-border-style:solid;--viewer-box-query-outline-inclusive-color:#00cc00;--viewer-box-query-outline-inclusive-border-style:dashed;--viewer-box-query-outline-border-radius:0.25rem;--viewer-box-query-outline-fill-opacity:0.25}.bounds{position:absolute}.outline{position:absolute;top:0;left:0;width:100%;height:100%;box-sizing:border-box;border-radius:var(--viewer-box-query-outline-border-radius)}:host([exclusive="true"]) .outline{border:3px var(--viewer-box-query-outline-exclusive-border-style) var(--viewer-box-query-outline-exclusive-color)}:host([inclusive="true"]) .outline{border:3px var(--viewer-box-query-outline-inclusive-border-style) var(--viewer-box-query-outline-inclusive-color)}.fill{position:absolute;top:0;left:0;width:100%;height:100%;opacity:var(--viewer-box-query-outline-fill-opacity);border-radius:var(--viewer-box-query-outline-border-radius)}:host([exclusive="true"]) .fill{background-color:var(--viewer-box-query-outline-exclusive-color)}:host([inclusive="true"]) .fill{background-color:var(--viewer-box-query-outline-inclusive-color)}';const a=class{constructor(t){i(this,t);this.controllerChanged=e(this,"controllerChanged",7);this.operationType="clearAndSelect";this.handleScreenBoundsChanged=this.handleScreenBoundsChanged.bind(this);this.handleExecuteStarted=this.handleExecuteStarted.bind(this);this.handleExecuteComplete=this.handleExecuteComplete.bind(this)}componentWillLoad(){var i;this.model=(i=this.model)!==null&&i!==void 0?i:new l(this.mode);this.screenBoundsChangedDisposable=this.model.onScreenBoundsChanged(this.handleScreenBoundsChanged);this.handleViewerChanged(this.viewer);this.handleControllerChange(this.controller);this.handleDefaultOperationChange(this.operationType)}disconnectedCallback(){var i,e,t,s;(i=this.model)===null||i===void 0?void 0:i.reset();(e=this.screenBoundsChangedDisposable)===null||e===void 0?void 0:e.dispose();(t=this.operationStartedDisposable)===null||t===void 0?void 0:t.dispose();(s=this.operationCompleteDisposable)===null||s===void 0?void 0:s.dispose();this.deregisterInteractionHandler()}handleViewerChanged(i){this.deregisterInteractionHandler();if(this.model!=null&&i!=null){this.controller=new r(this.model,i);this.handleDefaultOperationChange(this.operationType);this.registerInteractionHandler(this.controller,i)}}handleDefaultOperationChange(i){switch(i){case"clearAndSelect":this.setDefaultClearAndSelectOperation();break;case"select":this.setDefaultSelectOperation();break;case"deselect":this.setDefaultDeselectOperation();break}}handleModeChange(i){var e;(e=this.model)===null||e===void 0?void 0:e.setMode(i)}handleControllerChange(i){var e,t;(e=this.operationStartedDisposable)===null||e===void 0?void 0:e.dispose();(t=this.operationCompleteDisposable)===null||t===void 0?void 0:t.dispose();this.operationStartedDisposable=i===null||i===void 0?void 0:i.onExecuteStarted(this.handleExecuteStarted);this.operationStartedDisposable=i===null||i===void 0?void 0:i.onExecuteComplete(this.handleExecuteComplete);this.controllerChanged.emit(this.controller)}render(){return t(s,null,t("vertex-viewer-layer",null,this.details!=null&&t("div",{class:"bounds",style:{left:`${this.details.screenBounds.x}px`,top:`${this.details.screenBounds.y}px`,width:`${this.details.screenBounds.width}px`,height:`${this.details.screenBounds.height}px`}},t("slot",{name:"bounds"},t("div",{class:"outline"}),t("div",{class:"fill"})))))}handleScreenBoundsChanged(i){this.details=i;this.updateTypeAttribute(i===null||i===void 0?void 0:i.type)}handleExecuteStarted(){var i;(i=this.interactionHandler)===null||i===void 0?void 0:i.disable()}handleExecuteComplete(){var i;(i=this.interactionHandler)===null||i===void 0?void 0:i.enable()}async registerInteractionHandler(i,e){this.interactionHandler=new d(i);this.interactionHandlerDisposable=await e.registerInteractionHandler(this.interactionHandler)}deregisterInteractionHandler(){var i,e;(i=this.interactionHandlerDisposable)===null||i===void 0?void 0:i.dispose();(e=this.interactionHandler)===null||e===void 0?void 0:e.dispose();this.interactionHandler=undefined}updateTypeAttribute(i){this.hostEl.setAttribute("inclusive",`${i==="inclusive"}`);this.hostEl.setAttribute("exclusive",`${i==="exclusive"}`)}setDefaultClearAndSelectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.select()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([i=>i.items.where((i=>i.withSelected())).deselect()])}setDefaultSelectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.select()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([])}setDefaultDeselectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.deselect()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([])}get hostEl(){return o(this)}static get watchers(){return{viewer:["handleViewerChanged"],operationType:["handleDefaultOperationChange"],mode:["handleModeChange"],controller:["handleControllerChange"]}}};a.style=u;export{a as vertex_viewer_box_query_tool};
|
|
5
|
+
//# sourceMappingURL=p-0988832f.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{h as i,r as t,c as s,H as n,g as o}from"./p-110f66c6.js";import{p as l,m as h,v as e,r,g as a,q as d,c as u,e as v,f as c,d as f,b as w}from"./p-9d26f24e.js";import{c as p}from"./p-92793987.js";import{w as x,r as g}from"./p-04bf6b89.js";import{T as y}from"./p-ef71c07a.js";import{D as m,A as z}from"./p-e656bd4c.js";import"./p-0d971ad6.js";import{E as b}from"./p-6b00f7cd.js";import{d as T,T as C,R as D,e as R,r as j,s as A,x as O,A as P,b as S,y as E,z as F,f as N,g as U,h as H,i as I,j as $}from"./p-945101b6.js";import"./p-e5cc48b6.js";import"./p-3060996e.js";import"./p-a4a34f15.js";import"./p-148e5f47.js";function M(i){if(window.document.activeElement!==i){i.focus();i.setSelectionRange(i.value.length,i.value.length)}}function _(i,t){return t!=null?l.create(i.x-t.left,i.y-t.top):undefined}function q(i,t,s,n){const o=n!=null?e.fromMatrixPosition(n):undefined;if(i!=null&&t!=null&&s!=null&&o!=null){const n=s.transformPointToRay(i,t.image,t.scene.camera);if(t.scene.camera.isOrthographic()){const i=r.at(r.create({origin:o,direction:t.scene.camera.direction}),e.magnitude(t.scene.camera.viewVector)*2);return r.intersectPlane(n,a.fromNormalAndCoplanarPoint(t.scene.camera.direction,i))}else{return r.intersectPlane(n,a.fromNormalAndCoplanarPoint(t.scene.camera.direction,o))}}return undefined}function J(i,t,s,n,o,l){return h.multiply(i,B(t,s,n,o,l))}function B(i,t,s,n,o){const l=new m(n);const r=new z(o);const a=()=>r.convertFrom(t-s);const u=()=>l.convertRealValueToWorld(t-s);switch(i){case"x-translate":return h.makeTranslation(e.create(u(),0,0));case"y-translate":return h.makeTranslation(e.create(0,u(),0));case"z-translate":return h.makeTranslation(e.create(0,0,u()));case"x-rotate":return h.makeRotation(d.fromAxisAngle(e.left(),a()));case"y-rotate":return h.makeRotation(d.fromAxisAngle(e.down(),a()));case"z-rotate":return h.makeRotation(d.fromAxisAngle(e.forward(),a()));default:return h.makeIdentity()}}function L(i){switch(i){case"x-rotate":return"xyz";case"y-rotate":return"yzx";case"z-rotate":return"zxy";default:return"xyz"}}function X(i,t,s,n,o){const l=new m(n);const r=new z(o);const a=()=>h.makeRotation(d.fromMatrixRotation(t));const c=()=>h.multiply(t,h.invert(s));const f=()=>e.transformMatrix(e.fromMatrixPosition(c()),h.invert(a()));const w=()=>v.fromRotationMatrix(h.multiply(h.invert(a()),s),L(i));switch(i){case"x-translate":return l.convertWorldValueToReal(f().x);case"y-translate":return l.convertWorldValueToReal(f().y);case"z-translate":return l.convertWorldValueToReal(f().z);case"x-rotate":return r.convertTo(u.normalizeRadians(w().x));case"y-rotate":return r.convertTo(u.normalizeRadians(w().y));case"z-rotate":return r.convertTo(u.normalizeRadians(w().z));default:return 0}}function k(i,t,s,n,o,l){return K(i,e.subtract(s,t),n,o,l)}function K(i,t,s,n,o){switch(o){case"x-translate":return Z(i,t,e.right());case"y-translate":return Z(i,t,e.up());case"z-translate":return Z(i,t,e.back());case"xy-translate":return G(i,t,e.create(0,0,1));case"xz-translate":return G(i,t,e.create(0,1,0));case"yz-translate":return G(i,t,e.create(1,0,0));case"x-rotate":return V(i,s,e.right(),n);case"y-rotate":return V(i,s,e.up(),n);case"z-rotate":return V(i,s,e.forward(),n);default:return i}}function V(i,t,s,n){const o=Y(i,t,s);const l=d.fromAxisAngle(o,n);const e=h.makeRotation(l);return h.multiply(i,e)}function Y(i,t,s){const n=h.makeRotation(d.fromMatrixRotation(i));const o=e.transformMatrix(s,n);const l=e.transformMatrix(e.negate(s),n);return e.dot(t,o)>e.dot(t,l)?s:e.negate(s)}function Z(i,t,s){const n=e.normalize(s);const o=h.makeRotation(d.fromMatrixRotation(i));const l=e.transformMatrix(n,o);const r=e.project(t,l);const a=h.makeTranslation(r);return h.multiply(a,i)}function G(i,t,s){const n=e.normalize(s);const o=h.makeRotation(d.fromMatrixRotation(i));const l=e.transformMatrix(n,o);const r=e.fromMatrixPosition(i);const u=a.fromNormalAndCoplanarPoint(l,r);const v=a.projectPoint(u,t);const c=e.add(v,e.scale(u.constant,u.normal));const f=h.makeTranslation(c);return h.multiply(f,i)}function Q(i,t,s){if(s.length===0){throw new Error("Unable to compute input position. At least one shape point must be provided.")}const n=c.pad(t,5);const o=s.map((t=>i.transformNdcPointToViewport(t)));const h=c.topLeft(n);const e=l.add(h,l.create(n.width,0));const r=c.bottomRight(n);const a=l.subtract(r,l.create(n.width,0));const d=l.scale(o.reduce(((i,t)=>l.add(i,t)),l.create()),1/o.length,1/o.length);const u=[e,a,r].reduce(((i,t)=>l.distance(d,t)<l.distance(d,i)?t:i),h);switch(u){case h:return{point:u,placement:"top-left"};case e:return{point:u,placement:"top-right"};case a:return{point:u,placement:"bottom-left"};default:return{point:u,placement:"bottom-right"}}}function W(i,t,s,n,o,l){const h=t==="alt"&&i.altKey||t==="ctrl"&&i.ctrlKey||t==="meta"&&i.metaKey||t==="shift"&&i.shiftKey;if(h&&l!=null&&l>0&&Number.isInteger(l)){const i=s-n;const t=u.toDegrees(i);const h=Math.round(t/l)*l;if(o!=null){const i=Math.round(o/l)*l;const t=o-i;const s=h-t;const e=u.toRadians(s);return e+n}else{const i=u.toRadians(h);return i+n}}else{return s}}const ii=({ref:t,bounds:s,viewport:n,point:o,placement:l,displayUnit:h},e)=>{const r=ni(n,s!==null&&s!==void 0?s:f.create(0,0),o,l);return i("div",{ref:t,class:"widget-input wrapper",style:Object.assign(Object.assign({},r),{height:(s===null||s===void 0?void 0:s.height)!=null?`${s.height}px`:undefined})},e,i("div",{class:"widget-input units"},h.unit.abbreviatedName))};const ti=({ref:t,identifier:s,disabled:n,onChange:o,onIncrement:l,onDecrement:h,onBlur:e,onUndo:r})=>{const a=i=>{if(i.target!=null){const t=parseFloat(i.target.value);if(!isNaN(t)){o===null||o===void 0?void 0:o(parseFloat(i.target.value))}}};const d=i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="ArrowUp"){l===null||l===void 0?void 0:l()}else if(i.key==="ArrowDown"){h===null||h===void 0?void 0:h()}else if(i.key==="z"&&t&&r){i.preventDefault();r()}};return i("input",{ref:t,disabled:n,class:`widget-input ${s}`,type:"text",onChange:a,onKeyDown:d,onBlur:e})};function si(i,t){return Math.min(i,Math.max(0,t))}function ni(i,t,s,n,o=5){const{width:l,height:h}=i.dimensions;const e=t.width+o;const r=t.height+o;function a(i){return`${i}px`}switch(n){case"top-left":return{right:a(si(l-e,l-s.x)),bottom:a(si(h-r,h-s.y))};case"top-right":return{left:a(si(l-e,s.x)),bottom:a(si(h-r,h-s.y))};case"bottom-left":return{right:a(si(l-e,l-s.x)),top:a(si(h-r,s.y))};case"bottom-right":default:return{left:a(si(l-e,s.x)),top:a(si(h-r,s.y))}}}function oi(i,t,s=3,n=1,o=1){return ei(i,t,e.back(),e.up(),s,n,o)}function li(i,t,s=3,n=1,o=1){return ei(i,t,e.right(),e.back(),s,n,o)}function hi(i,t,s=3,n=1,o=1){return ei(i,t,e.right(),e.up(),s,n,o)}function ei(i,t,s,n,o,l=1,a=1){const v=e.transformMatrix(e.add(s,n),h.makeRotation(d.fromMatrixRotation(i)));const c=e.transformMatrix(s,h.makeRotation(d.fromMatrixRotation(i)));const f=e.transformMatrix(n,h.makeRotation(d.fromMatrixRotation(i)));const w=10*a**.25;const p=e.fromMatrixPosition(i);const x=e.add(p,e.scale(o*w,v));const g=r.create({origin:x,direction:c});const y=r.create({origin:x,direction:f});const m=e.cross(c,f);const z=e.rotateAboutAxis(u.toRadians(45),r.at(y,-(o*l)),m,x);const b=e.rotateAboutAxis(u.toRadians(45),r.at(g,o*l),m,x);const C=e.rotateAboutAxis(u.toRadians(45),r.at(y,o*l),m,x);const D=e.rotateAboutAxis(u.toRadians(45),r.at(g,-(o*l)),m,x);return new T(e.dot(c,t.direction)!==-1&&e.dot(f,t.direction)!==-1,z,D,b,C,e.transformMatrix(z,t.projectionViewMatrix),e.transformMatrix(D,t.projectionViewMatrix),e.transformMatrix(b,t.projectionViewMatrix),e.transformMatrix(C,t.projectionViewMatrix))}function ri(i,t,s,n){if(i instanceof C){return ai(i,t,s,n)}return false}function ai(i,t,s,n){return di([i.points.worldLeft,i.points.worldRight,i.points.worldTip],t,s,n)||di([i.points.worldLeft,i.points.worldRight,i.points.worldBase],t,s,n)}function di(i,t,s,n){var o;if(i.length===3){const l=s.transformPointToRay(n,t.image,t.scene.camera);const h=e.subtract(i[1],i[0]);const r=e.subtract(i[2],i[0]);const a=w.epsilon((o=w.fromVectors([l.direction,l.origin,h,r]))!==null&&o!==void 0?o:w.create(h,r));const d=e.cross(l.direction,r);const u=e.dot(h,d);if(!(Math.abs(u)>=a)){return false}const v=e.subtract(l.origin,i[0]);const c=e.dot(v,d)/u;if(c<0||c>1){return false}const f=e.cross(v,h);const p=e.dot(l.direction,f)/u;if(p<0||c+p>1){return false}const x=e.dot(r,f)/u;return!isNaN(x)&&(x>0||t.scene.camera.isOrthographic())}return false}class ui extends D{constructor(i,t={},s={}){var n,o,l,h,e,r,a,d,u,v,c,f,w,p;super(i);this.customization=t;this.disabledAxis={xTranslation:false,yTranslation:false,zTranslation:false,xyTranslation:false,xzTranslation:false,yzTranslation:false,xRotation:false,yRotation:false,zRotation:false};this.axisLines=[];this.rotationLines=[];this.translationMeshes=[];this.rotationMeshes=[];this.hoveredChanged=new b;this.xArrowFillColor=(n=t.colors)===null||n===void 0?void 0:n.xArrow;this.yArrowFillColor=(o=t.colors)===null||o===void 0?void 0:o.yArrow;this.zArrowFillColor=(l=t.colors)===null||l===void 0?void 0:l.zArrow;this.hoveredArrowFillColor=(h=t.colors)===null||h===void 0?void 0:h.hovered;this.outlineColor=(e=t.colors)===null||e===void 0?void 0:e.outline;this.disabledAxis.xTranslation=(r=s.xTranslation)!==null&&r!==void 0?r:false;this.disabledAxis.yTranslation=(a=s.yTranslation)!==null&&a!==void 0?a:false;this.disabledAxis.zTranslation=(d=s.zTranslation)!==null&&d!==void 0?d:false;this.disabledAxis.xyTranslation=(u=s.xyTranslation)!==null&&u!==void 0?u:false;this.disabledAxis.xzTranslation=(v=s.xzTranslation)!==null&&v!==void 0?v:false;this.disabledAxis.yzTranslation=(c=s.yzTranslation)!==null&&c!==void 0?c:false;this.disabledAxis.xRotation=(f=s.xRotation)!==null&&f!==void 0?f:false;this.disabledAxis.yRotation=(w=s.yRotation)!==null&&w!==void 0?w:false;this.disabledAxis.zRotation=(p=s.zRotation)!==null&&p!==void 0?p:false}dispose(){var i;(i=this.reglFrameDisposable)===null||i===void 0?void 0:i.cancel()}getDrawableElements(){return this.drawableElements}getFullBounds(){return this.fullBounds}boundsContainsPoint(i){return this.interactiveBounds!=null&&this.frame!=null&&c.containsPoints(this.interactiveBounds,i)}updateDisabledAxis(i){this.disabledAxis=Object.assign(Object.assign({},this.disabledAxis),i);this.updateDisabledOnDrawables()}updateCursor(i){this.cursor=i;if(i!=null&&this.frame!=null){this.updateHovered()}else{this.clearHovered()}}updateTransform(i){var t;this.transform=i;if(i!=null&&this.frame!=null){this.updateAndDraw()}else{this.clear();(t=this.reglFrameDisposable)===null||t===void 0?void 0:t.cancel();this.reglFrameDisposable=undefined}}updateColors(i={}){var t,s,n,o,l,h,e,r,a,d,u,v,c,f,w,p;this.xArrowFillColor=(t=i.xArrow)!==null&&t!==void 0?t:this.xArrowFillColor;this.yArrowFillColor=(s=i.yArrow)!==null&&s!==void 0?s:this.yArrowFillColor;this.zArrowFillColor=(n=i.zArrow)!==null&&n!==void 0?n:this.zArrowFillColor;this.twoAxesSquareFillColor=(o=i.twoAxesSquare)!==null&&o!==void 0?o:this.twoAxesSquareFillColor;this.hoveredArrowFillColor=(l=i.hovered)!==null&&l!==void 0?l:this.hoveredArrowFillColor;this.outlineColor=(h=i.outline)!==null&&h!==void 0?h:this.outlineColor;(e=this.xArrow)===null||e===void 0?void 0:e.updateFillColor(this.getXTranslationColor(),true);(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor(this.getYTranslationColor(),true);(a=this.zArrow)===null||a===void 0?void 0:a.updateFillColor(this.getZTranslationColor(),true);(d=this.xRotation)===null||d===void 0?void 0:d.updateFillColor(this.getXRotationColor(),true);(u=this.yRotation)===null||u===void 0?void 0:u.updateFillColor(this.getYRotationColor(),true);(v=this.zRotation)===null||v===void 0?void 0:v.updateFillColor(this.getZRotationColor(),true);(c=this.xyTranslation)===null||c===void 0?void 0:c.updateFillColor(this.getTwoAxesTranslationColor(),true);(f=this.xzTranslation)===null||f===void 0?void 0:f.updateFillColor(this.getTwoAxesTranslationColor(),true);(w=this.yzTranslation)===null||w===void 0?void 0:w.updateFillColor(this.getTwoAxesTranslationColor(),true);(p=this.hoveredElement)===null||p===void 0?void 0:p.updateFillColor(this.hoveredArrowFillColor)}updateScalars(i){this.customization=Object.assign(Object.assign({},this.customization),{scalars:i});if(this.transform!=null&&this.frame!=null){this.updateElements(this.transform,this.frame)}}onHoveredChanged(i){return this.hoveredChanged.on(i)}updateDisabledOnDrawables(){var i,t,s,n,o,l,h,e,r,a,d,u,v,c,f;(i=this.xRotation)===null||i===void 0?void 0:i.setDisabled(this.disabledAxis.xRotation);(t=this.xyRotationLine)===null||t===void 0?void 0:t.setDisabled(this.disabledAxis.xRotation);(s=this.xzRotationLine)===null||s===void 0?void 0:s.setDisabled(this.disabledAxis.xRotation);(n=this.yRotation)===null||n===void 0?void 0:n.setDisabled(this.disabledAxis.yRotation);(o=this.yzRotationLine)===null||o===void 0?void 0:o.setDisabled(this.disabledAxis.yRotation);(l=this.yxRotationLine)===null||l===void 0?void 0:l.setDisabled(this.disabledAxis.yRotation);(h=this.zRotation)===null||h===void 0?void 0:h.setDisabled(this.disabledAxis.zRotation);(e=this.zxRotationLine)===null||e===void 0?void 0:e.setDisabled(this.disabledAxis.zRotation);(r=this.zyRotationLine)===null||r===void 0?void 0:r.setDisabled(this.disabledAxis.zRotation);(a=this.xArrow)===null||a===void 0?void 0:a.setDisabled(this.disabledAxis.xTranslation);(d=this.yArrow)===null||d===void 0?void 0:d.setDisabled(this.disabledAxis.yTranslation);(u=this.zArrow)===null||u===void 0?void 0:u.setDisabled(this.disabledAxis.zTranslation);(v=this.xyTranslation)===null||v===void 0?void 0:v.setDisabled(this.disabledAxis.xyTranslation);(c=this.xzTranslation)===null||c===void 0?void 0:c.setDisabled(this.disabledAxis.xzTranslation);(f=this.yzTranslation)===null||f===void 0?void 0:f.setDisabled(this.disabledAxis.yzTranslation);this.updateColors()}updateHovered(){var i,t,s,n,o,l,h,e,r,a;const d=this.hoveredElement;const u=this.frame;if(u!=null){this.hoveredElement=[...this.translationMeshes,...this.rotationMeshes].filter((i=>i.points.valid&&!i.isDisabled())).find((i=>this.cursor!=null?ri(i,u,this.viewport,this.cursor):false));if(this.hoveredElement!==d){this.hoveredChanged.emit(this.hoveredElement);(i=this.hoveredElement)===null||i===void 0?void 0:i.updateFillColor(this.hoveredArrowFillColor);this.clearFillColorOfPreviouslyHovered(d);if(((t=this.hoveredElement)===null||t===void 0?void 0:t.identifier)==="xy-translate"){(s=this.xArrow)===null||s===void 0?void 0:s.updateFillColor(this.hoveredArrowFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor(this.hoveredArrowFillColor)}else if(((o=this.hoveredElement)===null||o===void 0?void 0:o.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor(this.hoveredArrowFillColor);(h=this.zArrow)===null||h===void 0?void 0:h.updateFillColor(this.hoveredArrowFillColor)}else if(((e=this.hoveredElement)===null||e===void 0?void 0:e.identifier)==="yz-translate"){(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor(this.hoveredArrowFillColor);(a=this.zArrow)===null||a===void 0?void 0:a.updateFillColor(this.hoveredArrowFillColor)}}}}clearHovered(){const i=this.hoveredElement;this.hoveredElement=undefined;if(this.hoveredElement!==i){this.hoveredChanged.emit(this.hoveredElement);this.clearFillColorOfPreviouslyHovered(i)}}clearFillColorOfPreviouslyHovered(i){var t,s,n,o,l,h,e,r,a,d,u,v;i===null||i===void 0?void 0:i.updateFillColor(i===null||i===void 0?void 0:i.initialFillColor);if((i===null||i===void 0?void 0:i.identifier)==="xy-translate"){(t=this.xArrow)===null||t===void 0?void 0:t.updateFillColor((s=this.xArrow)===null||s===void 0?void 0:s.initialFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor((o=this.yArrow)===null||o===void 0?void 0:o.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor((h=this.xArrow)===null||h===void 0?void 0:h.initialFillColor);(e=this.zArrow)===null||e===void 0?void 0:e.updateFillColor((r=this.zArrow)===null||r===void 0?void 0:r.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="yz-translate"){(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor((d=this.yArrow)===null||d===void 0?void 0:d.initialFillColor);(u=this.zArrow)===null||u===void 0?void 0:u.updateFillColor((v=this.zArrow)===null||v===void 0?void 0:v.initialFillColor)}}hasData(){return this.transform!=null}createOrUpdateElements(){if(this.transform!=null&&this.frame!=null){if(this.xArrow==null||this.yArrow==null||this.zArrow==null){this.createElements(this.transform,this.frame)}else{this.updateElements(this.transform,this.frame)}this.interactiveBounds=R(this.viewport,...this.rotationMeshes,...this.translationMeshes);this.fullBounds=R(this.viewport,...this.rotationMeshes,...this.translationMeshes,...this.axisLines)}}createElements(i,t){var s,n,o,l,h,r,a,d,u,v,c,f;this.reglCommand=j({canvas:this.canvasElement,extensions:"angle_instanced_arrays"});const{createShape:w}=A(this.reglCommand);const p=this.computeTriangleSize(e.fromMatrixPosition(i),t);this.xArrow=new C(w,"x-translate",O(i,t.scene.camera,p,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation),this.outlineColor,this.getXTranslationColor());this.xRotation=new C(w,"x-rotate",oi(i,t.scene.camera,p,(n=this.customization.scalars)===null||n===void 0?void 0:n.xRotation,(o=this.customization.scalars)===null||o===void 0?void 0:o.xTranslation),this.outlineColor,this.getXRotationColor());this.xAxis=new P(w,"x-axis",S(i,t.scene.camera,this.xArrow),this.outlineColor,this.getXTranslationColor());this.yArrow=new C(w,"y-translate",E(i,t.scene.camera,p,(l=this.customization.scalars)===null||l===void 0?void 0:l.yTranslation),this.outlineColor,this.getYTranslationColor());this.yRotation=new C(w,"y-rotate",li(i,t.scene.camera,p,(h=this.customization.scalars)===null||h===void 0?void 0:h.yRotation,(r=this.customization.scalars)===null||r===void 0?void 0:r.yTranslation),this.outlineColor,this.getYRotationColor());this.yAxis=new P(w,"y-axis",S(i,t.scene.camera,this.yArrow),this.outlineColor,this.getYTranslationColor());this.zArrow=new C(w,"z-translate",F(i,t.scene.camera,p,(a=this.customization.scalars)===null||a===void 0?void 0:a.zTranslation),this.outlineColor,this.getZTranslationColor());this.zAxis=new P(w,"z-axis",S(i,t.scene.camera,this.zArrow),this.outlineColor,this.getZTranslationColor());this.zRotation=new C(w,"z-rotate",hi(i,t.scene.camera,p,(d=this.customization.scalars)===null||d===void 0?void 0:d.zRotation,(u=this.customization.scalars)===null||u===void 0?void 0:u.zTranslation),this.outlineColor,this.getZRotationColor());this.xyTranslation=new C(w,"xy-translate",N(i,t.scene.camera,p,(v=this.customization.scalars)===null||v===void 0?void 0:v.xyTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.xzTranslation=new C(w,"xz-translate",U(i,t.scene.camera,p,(c=this.customization.scalars)===null||c===void 0?void 0:c.xzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.yzTranslation=new C(w,"yz-translate",H(i,t.scene.camera,p,(f=this.customization.scalars)===null||f===void 0?void 0:f.yzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.createRotationLines(w,i,t);this.axisLines=[this.xAxis,this.yAxis,this.zAxis];this.translationMeshes=[this.xArrow,this.yArrow,this.zArrow,this.xyTranslation,this.xzTranslation,this.yzTranslation];this.rotationMeshes=[this.xRotation,this.yRotation,this.zRotation];this.updateDisabledOnDrawables();this.availableElements=[...this.axisLines,...this.rotationLines,...this.translationMeshes,...this.rotationMeshes]}getXRotationColor(){return this.xArrowFillColor}getYRotationColor(){return this.yArrowFillColor}getZRotationColor(){return this.zArrowFillColor}getXTranslationColor(){return this.xArrowFillColor}getYTranslationColor(){return this.yArrowFillColor}getZTranslationColor(){return this.zArrowFillColor}getTwoAxesTranslationColor(){return this.twoAxesSquareFillColor}createRotationLines(i,t,s){var n,o,l,h,r,a;const d=this.computeTriangleSize(e.fromMatrixPosition(t),s);const u=I(s.scene.camera,this.xRotation,(n=this.yArrow)===null||n===void 0?void 0:n.points.worldTip,d);const v=I(s.scene.camera,this.xRotation,(o=this.zArrow)===null||o===void 0?void 0:o.points.worldTip,d);const c=I(s.scene.camera,this.yRotation,(l=this.xArrow)===null||l===void 0?void 0:l.points.worldTip,d);const f=I(s.scene.camera,this.yRotation,(h=this.zArrow)===null||h===void 0?void 0:h.points.worldTip,d);const w=I(s.scene.camera,this.zRotation,(r=this.xArrow)===null||r===void 0?void 0:r.points.worldTip,d);const p=I(s.scene.camera,this.zRotation,(a=this.yArrow)===null||a===void 0?void 0:a.points.worldTip,d);if(u!=null){this.xyRotationLine=new $(i,"xy-rotation-line",u,this.outlineColor)}if(v!=null){this.xzRotationLine=new $(i,"xz-rotation-line",v,this.outlineColor)}if(c!=null){this.yxRotationLine=new $(i,"yx-rotation-line",c,this.outlineColor)}if(f!=null){this.yzRotationLine=new $(i,"yz-rotation-line",f,this.outlineColor)}if(w!=null){this.zxRotationLine=new $(i,"zx-rotation-line",w,this.outlineColor)}if(p!=null){this.zyRotationLine=new $(i,"zy-rotation-line",p,this.outlineColor)}this.rotationLines=[this.xyRotationLine,this.xzRotationLine,this.yxRotationLine,this.yzRotationLine,this.zxRotationLine,this.zyRotationLine].filter((i=>i!=null))}updateElements(i,t){var s,n,o,l,h,r,a,d,u,v,c,f,w,p,x,g,y,m,z,b,T,C,D,R,j,A,P,$,M,_;const q=this.computeTriangleSize(e.fromMatrixPosition(i),t);if(this.xArrow!=null){this.xArrow.updatePoints(O(i,t.scene.camera,q,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation));(n=this.xAxis)===null||n===void 0?void 0:n.updatePoints(S(i,t.scene.camera,this.xArrow))}(o=this.xRotation)===null||o===void 0?void 0:o.updatePoints(oi(i,t.scene.camera,q,(l=this.customization.scalars)===null||l===void 0?void 0:l.xRotation,(h=this.customization.scalars)===null||h===void 0?void 0:h.xTranslation));if(this.yArrow!=null){this.yArrow.updatePoints(E(i,t.scene.camera,q,(r=this.customization.scalars)===null||r===void 0?void 0:r.yTranslation));(a=this.yAxis)===null||a===void 0?void 0:a.updatePoints(S(i,t.scene.camera,this.yArrow))}(d=this.yRotation)===null||d===void 0?void 0:d.updatePoints(li(i,t.scene.camera,q,(u=this.customization.scalars)===null||u===void 0?void 0:u.yRotation,(v=this.customization.scalars)===null||v===void 0?void 0:v.yTranslation));if(this.zArrow!=null){this.zArrow.updatePoints(F(i,t.scene.camera,q,(c=this.customization.scalars)===null||c===void 0?void 0:c.zTranslation));(f=this.zAxis)===null||f===void 0?void 0:f.updatePoints(S(i,t.scene.camera,this.zArrow))}(w=this.zRotation)===null||w===void 0?void 0:w.updatePoints(hi(i,t.scene.camera,q,(p=this.customization.scalars)===null||p===void 0?void 0:p.zRotation,(x=this.customization.scalars)===null||x===void 0?void 0:x.zTranslation));(g=this.xyRotationLine)===null||g===void 0?void 0:g.updatePoints(I(t.scene.camera,this.xRotation,(y=this.yArrow)===null||y===void 0?void 0:y.points.worldTip,q));(m=this.xzRotationLine)===null||m===void 0?void 0:m.updatePoints(I(t.scene.camera,this.xRotation,(z=this.zArrow)===null||z===void 0?void 0:z.points.worldTip,q));(b=this.yxRotationLine)===null||b===void 0?void 0:b.updatePoints(I(t.scene.camera,this.yRotation,(T=this.xArrow)===null||T===void 0?void 0:T.points.worldTip,q));(C=this.yzRotationLine)===null||C===void 0?void 0:C.updatePoints(I(t.scene.camera,this.yRotation,(D=this.zArrow)===null||D===void 0?void 0:D.points.worldTip,q));(R=this.zxRotationLine)===null||R===void 0?void 0:R.updatePoints(I(t.scene.camera,this.zRotation,(j=this.xArrow)===null||j===void 0?void 0:j.points.worldTip,q));(A=this.zyRotationLine)===null||A===void 0?void 0:A.updatePoints(I(t.scene.camera,this.zRotation,(P=this.yArrow)===null||P===void 0?void 0:P.points.worldTip,q));if(this.xyTranslation!=null){this.xyTranslation.updatePoints(N(i,t.scene.camera,q,($=this.customization.scalars)===null||$===void 0?void 0:$.xyTranslation))}if(this.xzTranslation!=null){this.xzTranslation.updatePoints(U(i,t.scene.camera,q,(M=this.customization.scalars)===null||M===void 0?void 0:M.xzTranslation))}if(this.yzTranslation!=null){this.yzTranslation.updatePoints(H(i,t.scene.camera,q,(_=this.customization.scalars)===null||_===void 0?void 0:_.yzTranslation))}}}const vi=":host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-two-axes-square-color:var(--two-axes-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:8em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;pointer-events:auto;display:flex;align-items:center;border:1px solid #444444;border-radius:4px;width:var(--viewer-transform-widget-input-width);text-align:center;background-color:white;box-sizing:border-box}.widget-input.units{position:relative;width:25%;height:100%;padding:0 0.25rem;font-size:0.8125rem;color:#444444}input.widget-input{position:relative;text-align:center;box-sizing:border-box;width:75%;height:100%;outline:none;border-width:0 1px 0 0;border-color:#444444;border-radius:2px 0 0 2px;font-size:0.875rem;color:#444444}input.widget-input.x-translate,input.widget-input.x-rotate{border-left:5px solid var(--viewer-transform-widget-x-axis-arrow-color)}input.widget-input.y-translate,input.widget-input.y-rotate{border-left:5px solid var(--viewer-transform-widget-y-axis-arrow-color)}input.widget-input.z-translate,input.widget-input.z-rotate{border-left:5px solid var(--viewer-transform-widget-z-axis-arrow-color)}input.widget-input:disabled{color:#888888}input.widget-input:focus{outline:none}";const ci=class{constructor(i){t(this,i);this.positionChanged=s(this,"positionChanged",7);this.rotationChanged=s(this,"rotationChanged",7);this.interactionEnded=s(this,"interactionEnded",7);this.interactionStarted=s(this,"interactionStarted",7);this.xRotationDisabled=false;this.yRotationDisabled=false;this.zRotationDisabled=false;this.xTranslationDisabled=false;this.yTranslationDisabled=false;this.zTranslationDisabled=false;this.xyTranslationDisabled=false;this.xzTranslationDisabled=false;this.yzTranslationDisabled=false;this.showInputs=true;this.distanceUnit="millimeters";this.angleUnit="degrees";this.decimalPlaces=1;this.rotationSnapKey="shift";this.translationHandleScalar=1;this.rotationHandleScalar=1;this.interactionThrottle=75;this.EXPERIMENTAL_undoKeybindings=false;this.inputValue=0;this.isEndingTransform=false;this.inputShouldFocus=false;this.xArrowColor="#ea3324";this.yArrowColor="#4faf32";this.zArrowColor="#0000ff";this.twoAxesSquareColor="#e0e0e0";this.hoveredColor="#ffff00";this.lastAngle=0;this.handleHoveredDrawableChanged=i=>{this.hovered=i};this.handleViewerFrameDrawn=()=>{this.updatePropsFromViewer()};this.handleViewerDimensionsChange=()=>{x((()=>{if(this.viewer!=null&&this.canvasRef!=null){this.canvasRef.width=this.viewer.viewport.width;this.canvasRef.height=this.viewer.viewport.height;this.updateCanvasBounds(this.canvasRef)}}))};this.handleResize=()=>{if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef)}};this.handleInputResize=()=>{if(this.inputWrapperRef!=null){const i=this.inputWrapperRef;g((()=>{this.inputBounds=i.getBoundingClientRect()}))}};this.handleStyleChange=()=>{g((()=>{const i=window.getComputedStyle(this.hostEl);this.xArrowColor=i.getPropertyValue("--viewer-transform-widget-x-axis-arrow-color").trim();this.yArrowColor=i.getPropertyValue("--viewer-transform-widget-y-axis-arrow-color").trim();this.zArrowColor=i.getPropertyValue("--viewer-transform-widget-z-axis-arrow-color").trim();this.twoAxesSquareColor=i.getPropertyValue("--viewer-transform-widget-two-axes-square-color").trim();this.hoveredColor=i.getPropertyValue("--viewer-transform-widget-hovered-arrow-color").trim();this.getTransformWidget().updateColors({xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor})}))};this.handlePointerMove=i=>{if(this.dragging==null){const t=_(l.create(i.clientX,i.clientY),this.getCanvasBounds());const s=this.getTransformWidget();if(t!=null&&s.boundsContainsPoint(t)){s.updateCursor(t)}else{s.updateCursor(undefined);this.hovered=undefined}}};this.handleBeginDrag=async i=>{var t,s,n;const o=this.getCanvasBounds();if(this.hovered!=null&&o!=null&&this.viewer!=null&&this.position!=null&&this.viewer.frame!=null){this.dragging=this.hovered;if(this.dragging.identifier!==((t=this.lastDragged)===null||t===void 0?void 0:t.identifier)){this.inputValue=0;this.dragStartTransform=this.currentTransform;this.updateInputPosition();this.updateInputValue()}this.lastDragged=undefined;const h=_(l.create(i.clientX,i.clientY),o);const e=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);this.lastAngle=h!=null?u.fromPoints(e,h):0;this.lastWorldPosition=q(h,(s=this.viewer)===null||s===void 0?void 0:s.frame,(n=this.viewer)===null||n===void 0?void 0:n.viewport,this.currentTransform);this.interactionStarted.emit();window.removeEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointermove",this.handleDragWithTimer);window.addEventListener("pointerup",this.handleEndTransform)}};this.handleDragWithTimer=async i=>{if(i!=null){i.preventDefault();this.lastMouseEvent=i}if(this.interactionTimer==null){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.handleDrag();this.lastMouseEvent=undefined}),this.interactionThrottle)}};this.handleDrag=async()=>{var i,t,s;const n=this.getCanvasBounds();if(this.dragging!=null&&this.lastWorldPosition!=null&&n!=null&&this.viewer!=null&&this.viewer.frame!=null&&this.position!=null&&this.lastMouseEvent!=null){await((i=this.controller)===null||i===void 0?void 0:i.beginTransform());const o=_(l.create(this.lastMouseEvent.clientX,this.lastMouseEvent.clientY),n);const h=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);const e=q(o,(t=this.viewer)===null||t===void 0?void 0:t.frame,(s=this.viewer)===null||s===void 0?void 0:s.viewport,this.currentTransform);if(e!=null&&o!=null&&h!=null){const i=u.fromPoints(h,o);const t=W(this.lastMouseEvent,this.rotationSnapKey,i,this.lastAngle,this.getDisplayedAngle(),this.rotationSnapDegrees);this.transform(this.lastWorldPosition,e,t-this.lastAngle);this.updateInputPosition();this.updateInputValue();this.lastWorldPosition=e;this.lastAngle=t}}};this.handleEndTransform=async i=>{var t,s;const n=_(l.create(i.clientX,i.clientY),this.getCanvasBounds());const o=this.getTransformWidget();this.lastDragged=this.dragging;this.dragging=undefined;this.lastWorldPosition=undefined;this.lastAngle=0;this.updateInputPosition();this.updateInputValue();o.updateCursor(n);o.updateTransform(this.currentTransform);this.beginEndTransform();window.removeEventListener("pointermove",this.handleDragWithTimer);window.removeEventListener("pointerup",this.handleEndTransform);try{const i=(t=this.controller)===null||t===void 0?void 0:t.getCurrentDelta();await((s=this.controller)===null||s===void 0?void 0:s.endTransform());this.interactionEnded.emit(i)}catch(i){console.error("Failed to end transform interaction",i)}window.addEventListener("pointermove",this.handlePointerMove);this.completeEndTransform()};this.handleInputStep=async i=>{if(this.inputValue!=null&&this.lastInputValue!=null){if(this.isModifyingAngleUnits()){const t=new z(this.angleUnit);const s=t.convertFrom(this.lastInputValue);const n=u.normalizeRadians(s+u.toRadians(i));this.inputValue=t.convertTo(n)}else{this.inputValue=this.lastInputValue+i}await this.updateTransformFromInput(this.inputValue)}};this.handleInputChange=async i=>{await this.updateTransformFromInput(i)};this.handleKeyDown=async i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="z"&&t&&this.EXPERIMENTAL_undoKeybindings){i.stopPropagation();await this.EXPERIMENTAL_undo()}};this.updateTransformFromInput=async i=>{var t,s,n;if(this.lastDragged!=null&&this.currentTransform!=null&&this.startingTransform!=null&&this.lastInputValue!=null){this.currentTransform=J(this.currentTransform,this.lastDragged.identifier,i,this.lastInputValue,this.distanceUnit,this.angleUnit);this.updateInputValue();this.lastInputValue=i;await((t=this.controller)===null||t===void 0?void 0:t.beginTransform());this.getTransformWidget().updateTransform(this.currentTransform);await((s=this.controller)===null||s===void 0?void 0:s.updateTransform(h.multiply(this.currentTransform,h.invert(this.startingTransform))));this.updateInputPosition();await((n=this.controller)===null||n===void 0?void 0:n.endTransformDebounced(this.beginEndTransform,this.completeEndTransform))}};this.updatePropsFromViewer=()=>{const{frame:i}=this.viewer||{};if(i!=null){const t=this.getTransformWidget();t.updateFrame(i,this.dragging==null);this.updateInputPosition()}};this.setupTransformWidget=i=>{var t,s;console.debug(`Initializing transform widget. [initial-position=${JSON.stringify(this.position)}, has-initial-frame=${((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null}]`);const n=this.getTranslationScalar();const o=this.getRotationScalar();this.widget=new ui(i,{colors:{xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor},scalars:{xTranslation:n,yTranslation:n,zTranslation:n,xyTranslation:o,xzTranslation:o,yzTranslation:o,xRotation:o,yRotation:o,zRotation:o}});if(this.rotation!=null){this.currentTransform=this.getTransformForNewRotation(this.rotation);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(this.position!=null){this.currentTransform=this.getTransformForNewPosition(this.position);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(((s=this.viewer)===null||s===void 0?void 0:s.frame)!=null){this.widget.updateFrame(this.viewer.frame,true)}this.handleSettingDisabledAxis();this.hoveredChangeDisposable=this.widget.onHoveredChanged(this.handleHoveredDrawableChanged);return this.widget};this.updateCanvasBounds=i=>{g((()=>{this.canvasBounds=i.getBoundingClientRect();this.getTransformWidget().updateDimensions(i)}))};this.updateInputValue=()=>{var i,t,s;const n=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const o=(n===null||n===void 0?void 0:n.identifier)==="xy-translate"||(n===null||n===void 0?void 0:n.identifier)==="xz-translate"||(n===null||n===void 0?void 0:n.identifier)==="yz-translate";if(n!=null&&this.currentTransform!=null&&this.dragStartTransform!=null&&!o){this.lastInputValue=this.inputValue;this.inputValue=X(n.identifier,this.currentTransform,this.dragStartTransform,this.distanceUnit,this.angleUnit);if(this.inputRef!=null){const i=(s=(t=this.getDisplayedDistance())!==null&&t!==void 0?t:this.getDisplayedAngle())!==null&&s!==void 0?s:0;const n=`${parseFloat(i.toFixed(this.decimalPlaces))}`;this.inputRef.value=n}}};this.updateInputPosition=()=>{var i,t;const s=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const n=(s===null||s===void 0?void 0:s.identifier)==="xy-translate"||(s===null||s===void 0?void 0:s.identifier)==="xz-translate"||(s===null||s===void 0?void 0:s.identifier)==="yz-translate";if(this.showInputs&&((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null&&this.position!=null&&s!=null&&!n){const i=this.getTransformWidget();const t=i.getFullBounds();this.inputPosition=t!=null?Q(this.viewer.viewport,t,s.points.toArray()):undefined}else if(n){this.inputPosition=undefined}};this.beginEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:true,yRotation:true,zRotation:true,xTranslation:true,yTranslation:true,zTranslation:true,xyTranslation:true,xzTranslation:true,yzTranslation:true});this.isEndingTransform=true};this.completeEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled});this.isEndingTransform=false;this.inputShouldFocus=true;if(this.currentTransform!=null){this.position=e.fromMatrixPosition(this.currentTransform);this.rotation=v.fromRotationMatrix(this.currentTransform)}};this.isModifyingAngleUnits=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;return!!(n===null||n===void 0?void 0:n.includes("rotate"))};this.getTranslationScalar=()=>{if(this.translationHandleScalar>0){return this.translationHandleScalar}console.warn("Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getRotationScalar=()=>{if(this.rotationHandleScalar>0){return this.rotationHandleScalar}console.warn("Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getDisplayedUnits=()=>{if(this.isModifyingAngleUnits()){return new z(this.angleUnit)}return new m(this.distanceUnit)};this.getDisplayedAngle=()=>{if(this.isModifyingAngleUnits()){return this.inputValue}};this.getDisplayedDistance=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;if(n===null||n===void 0?void 0:n.includes("translate")){return this.inputValue}};this.getTransformForNewPosition=i=>{if(i!=null){const t=this.currentTransform!=null?this.currentTransform:h.makeIdentity();const s=h.makeRotation(d.fromMatrixRotation(t));const n=h.makeTranslation(i);return h.multiply(n,s)}};this.getTransformForNewRotation=i=>{const t=this.currentTransform!=null?this.currentTransform:h.makeIdentity();const s=h.invert(h.makeRotation(d.fromMatrixRotation(t)));const n=h.makeRotation(d.fromEuler(i));const o=h.multiply(t,s);return h.multiply(o,n)};this.getCanvasBounds=()=>{if(this.canvasBounds!=null){return this.canvasBounds}else if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef);return this.canvasBounds}};this.getTransformWidget=()=>{if(this.widget==null&&this.canvasRef!=null){return this.setupTransformWidget(this.canvasRef)}else if(this.widget!=null){return this.widget}else{throw new Error("Transform widget was not initialized. The canvas element may not have been initialized.")}}}componentDidLoad(){window.addEventListener("pointermove",this.handlePointerMove);this.canvasResizeObserver=new ResizeObserver(this.handleResize);this.inputResizeObserver=new ResizeObserver(this.handleInputResize);this.hostStyleObserver=new MutationObserver(this.handleStyleChange);if(this.canvasRef!=null){this.canvasResizeObserver.observe(this.canvasRef);this.setupTransformWidget(this.canvasRef)}this.hostStyleObserver.observe(this.hostEl,{attributes:true,attributeFilter:["style"]});this.handleViewerChanged(this.viewer,undefined);this.handleStyleChange()}disconnectedCallback(){var i,t,s,n,o;window.removeEventListener("pointermove",this.handlePointerMove);(i=this.canvasResizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.inputResizeObserver)===null||t===void 0?void 0:t.disconnect();(s=this.hostStyleObserver)===null||s===void 0?void 0:s.disconnect();(n=this.hoveredChangeDisposable)===null||n===void 0?void 0:n.dispose();(o=this.widget)===null||o===void 0?void 0:o.dispose()}componentDidRender(){if(this.inputShouldFocus&&this.inputRef!=null){M(this.inputRef);this.inputShouldFocus=false}}async EXPERIMENTAL_undo(){var i,t;const s=await((i=this.controller)===null||i===void 0?void 0:i.EXPERIMENTAL_undoTransform());if(this.currentTransform!=null&&s!=null){this.currentTransform=h.multiply(s,this.currentTransform);(t=this.widget)===null||t===void 0?void 0:t.updateTransform(this.currentTransform);this.updateInputPosition();this.updateInputValue();this.lastInputValue=this.inputValue;this.position=e.fromMatrixPosition(this.currentTransform);this.rotation=v.fromRotationMatrix(this.currentTransform)}}handleViewerChanged(i,t){var s;t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.removeEventListener("dimensionschange",this.handleViewerDimensionsChange);i===null||i===void 0?void 0:i.addEventListener("frameDrawn",this.handleViewerFrameDrawn);i===null||i===void 0?void 0:i.addEventListener("dimensionschange",this.handleViewerDimensionsChange);if((i===null||i===void 0?void 0:i.stream)!=null){(s=this.controller)===null||s===void 0?void 0:s.dispose();this.controller=new y(i.stream)}}handleDisabledPropertyChanged(){var i;(i=this.widget)===null||i===void 0?void 0:i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}handleTransformHandleScalarChanged(){var i;const t=this.getTranslationScalar();const s=this.getRotationScalar();(i=this.widget)===null||i===void 0?void 0:i.updateScalars({xTranslation:t,yTranslation:t,zTranslation:t,xyTranslation:s,xzTranslation:s,yzTranslation:s,xRotation:s,yRotation:s,zRotation:s})}handleRotationChanged(i,t){var s;const n=i!==null&&i!==void 0?i:v.create();this.currentTransform=this.getTransformForNewRotation(n);this.startingTransform=this.currentTransform;if(i==null&&this.currentTransform!=null&&h.isIdentity(this.currentTransform)){this.currentTransform=undefined;this.startingTransform=this.currentTransform}(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);console.debug(`Updating widget rotation [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);this.rotationChanged.emit(i)}handlePositionChanged(i,t){var s,n;this.currentTransform=this.getTransformForNewPosition(i);this.startingTransform=this.currentTransform;console.debug(`Updating widget position [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);if(i==null){this.lastDragged=undefined;this.inputPosition=undefined;(n=this.controller)===null||n===void 0?void 0:n.clearTransform()}this.positionChanged.emit(i)}handleInputFormattingChanged(){this.updateInputValue();this.lastInputValue=this.inputValue}render(){var t,s,o,l,h,e;return i(n,null,i("canvas",{ref:i=>{this.canvasRef=i},class:p("widget",{hovered:this.hovered!=null}),tabindex:"0",width:(t=this.viewer)===null||t===void 0?void 0:t.viewport.width,height:(s=this.viewer)===null||s===void 0?void 0:s.viewport.height,onPointerDown:this.handleBeginDrag,onKeyDown:this.handleKeyDown}),this.showInputs&&this.inputPosition&&((o=this.viewer)===null||o===void 0?void 0:o.viewport)&&i(ii,{ref:i=>{var t,s;if(i!=null){(t=this.inputResizeObserver)===null||t===void 0?void 0:t.observe(i)}else if(this.inputRef!=null){(s=this.inputResizeObserver)===null||s===void 0?void 0:s.unobserve(this.inputRef)}this.inputWrapperRef=i},bounds:this.inputBounds,viewport:this.viewer.viewport,point:this.inputPosition.point,placement:this.inputPosition.placement,displayUnit:this.getDisplayedUnits()},i(ti,{ref:i=>{this.inputRef=i},identifier:(h=(l=this.dragging)===null||l===void 0?void 0:l.identifier)!==null&&h!==void 0?h:(e=this.lastDragged)===null||e===void 0?void 0:e.identifier,disabled:this.isEndingTransform,onChange:this.handleInputChange,onIncrement:()=>this.handleInputStep(1),onDecrement:()=>this.handleInputStep(-1),onBlur:()=>{this.inputShouldFocus=false},onUndo:this.EXPERIMENTAL_undoKeybindings?()=>this.EXPERIMENTAL_undo():undefined})))}transform(i,t,s){var n,o;if(this.position!=null&&this.startingTransform!=null&&this.currentTransform!=null&&this.dragging!=null&&this.viewer!=null&&this.viewer.frame!=null){this.currentTransform=k(this.currentTransform,i,t,(n=this.viewer)===null||n===void 0?void 0:n.frame.scene.camera.viewVector,s,this.dragging.identifier);this.getTransformWidget().updateTransform(this.currentTransform);(o=this.controller)===null||o===void 0?void 0:o.updateTransform(h.multiply(this.currentTransform,h.invert(this.startingTransform)))}}handleSettingDisabledAxis(){if(this.widget){this.widget.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}else{console.warn("Cannot set disabled values - no widget defined")}}get hostEl(){return o(this)}static get watchers(){return{viewer:["handleViewerChanged"],xTranslationDisabled:["handleDisabledPropertyChanged"],yTranslationDisabled:["handleDisabledPropertyChanged"],zTranslationDisabled:["handleDisabledPropertyChanged"],xyTranslationDisabled:["handleDisabledPropertyChanged"],xzTranslationDisabled:["handleDisabledPropertyChanged"],yzTranslationDisabled:["handleDisabledPropertyChanged"],xRotationDisabled:["handleDisabledPropertyChanged"],yRotationDisabled:["handleDisabledPropertyChanged"],zRotationDisabled:["handleDisabledPropertyChanged"],translationHandleScalar:["handleTransformHandleScalarChanged"],rotationHandleScalar:["handleTransformHandleScalarChanged"],rotation:["handleRotationChanged"],position:["handlePositionChanged"],distanceUnit:["handleInputFormattingChanged"],angleUnit:["handleInputFormattingChanged"],decimalPlaces:["handleInputFormattingChanged"]}}};ci.style=vi;export{ci as vertex_viewer_transform_widget};
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{h as i,r as t,c as s,H as n,g as o}from"./p-388f809e.js";import{p as l,m as h,v as e,r,g as a,q as d,c as u,e as v,f as c,d as f,b as w}from"./p-9d26f24e.js";import{c as p}from"./p-92793987.js";import{w as x,r as g}from"./p-e1eaedd8.js";import{T as y}from"./p-ef71c07a.js";import{D as m,A as z}from"./p-e656bd4c.js";import"./p-0d971ad6.js";import{E as b}from"./p-6b00f7cd.js";import{d as T,T as C,R as D,e as R,r as j,s as A,x as O,A as P,b as S,y as E,z as F,f as N,g as U,h as H,i as I,j as $}from"./p-945101b6.js";import"./p-e5cc48b6.js";import"./p-3060996e.js";import"./p-a4a34f15.js";import"./p-148e5f47.js";function M(i){if(window.document.activeElement!==i){i.focus();i.setSelectionRange(i.value.length,i.value.length)}}function _(i,t){return t!=null?l.create(i.x-t.left,i.y-t.top):undefined}function q(i,t,s,n){const o=n!=null?e.fromMatrixPosition(n):undefined;if(i!=null&&t!=null&&s!=null&&o!=null){const n=s.transformPointToRay(i,t.image,t.scene.camera);if(t.scene.camera.isOrthographic()){const i=r.at(r.create({origin:o,direction:t.scene.camera.direction}),e.magnitude(t.scene.camera.viewVector)*2);return r.intersectPlane(n,a.fromNormalAndCoplanarPoint(t.scene.camera.direction,i))}else{return r.intersectPlane(n,a.fromNormalAndCoplanarPoint(t.scene.camera.direction,o))}}return undefined}function J(i,t,s,n,o,l){return h.multiply(i,B(t,s,n,o,l))}function B(i,t,s,n,o){const l=new m(n);const r=new z(o);const a=()=>r.convertFrom(t-s);const u=()=>l.convertRealValueToWorld(t-s);switch(i){case"x-translate":return h.makeTranslation(e.create(u(),0,0));case"y-translate":return h.makeTranslation(e.create(0,u(),0));case"z-translate":return h.makeTranslation(e.create(0,0,u()));case"x-rotate":return h.makeRotation(d.fromAxisAngle(e.left(),a()));case"y-rotate":return h.makeRotation(d.fromAxisAngle(e.down(),a()));case"z-rotate":return h.makeRotation(d.fromAxisAngle(e.forward(),a()));default:return h.makeIdentity()}}function L(i){switch(i){case"x-rotate":return"xyz";case"y-rotate":return"yzx";case"z-rotate":return"zxy";default:return"xyz"}}function X(i,t,s,n,o){const l=new m(n);const r=new z(o);const a=()=>h.makeRotation(d.fromMatrixRotation(t));const c=()=>h.multiply(t,h.invert(s));const f=()=>e.transformMatrix(e.fromMatrixPosition(c()),h.invert(a()));const w=()=>v.fromRotationMatrix(h.multiply(h.invert(a()),s),L(i));switch(i){case"x-translate":return l.convertWorldValueToReal(f().x);case"y-translate":return l.convertWorldValueToReal(f().y);case"z-translate":return l.convertWorldValueToReal(f().z);case"x-rotate":return r.convertTo(u.normalizeRadians(w().x));case"y-rotate":return r.convertTo(u.normalizeRadians(w().y));case"z-rotate":return r.convertTo(u.normalizeRadians(w().z));default:return 0}}function k(i,t,s,n,o,l){return K(i,e.subtract(s,t),n,o,l)}function K(i,t,s,n,o){switch(o){case"x-translate":return Z(i,t,e.right());case"y-translate":return Z(i,t,e.up());case"z-translate":return Z(i,t,e.back());case"xy-translate":return G(i,t,e.create(0,0,1));case"xz-translate":return G(i,t,e.create(0,1,0));case"yz-translate":return G(i,t,e.create(1,0,0));case"x-rotate":return V(i,s,e.right(),n);case"y-rotate":return V(i,s,e.up(),n);case"z-rotate":return V(i,s,e.forward(),n);default:return i}}function V(i,t,s,n){const o=Y(i,t,s);const l=d.fromAxisAngle(o,n);const e=h.makeRotation(l);return h.multiply(i,e)}function Y(i,t,s){const n=h.makeRotation(d.fromMatrixRotation(i));const o=e.transformMatrix(s,n);const l=e.transformMatrix(e.negate(s),n);return e.dot(t,o)>e.dot(t,l)?s:e.negate(s)}function Z(i,t,s){const n=e.normalize(s);const o=h.makeRotation(d.fromMatrixRotation(i));const l=e.transformMatrix(n,o);const r=e.project(t,l);const a=h.makeTranslation(r);return h.multiply(a,i)}function G(i,t,s){const n=e.normalize(s);const o=h.makeRotation(d.fromMatrixRotation(i));const l=e.transformMatrix(n,o);const r=e.fromMatrixPosition(i);const u=a.fromNormalAndCoplanarPoint(l,r);const v=a.projectPoint(u,t);const c=e.add(v,e.scale(u.constant,u.normal));const f=h.makeTranslation(c);return h.multiply(f,i)}function Q(i,t,s){if(s.length===0){throw new Error("Unable to compute input position. At least one shape point must be provided.")}const n=c.pad(t,5);const o=s.map((t=>i.transformNdcPointToViewport(t)));const h=c.topLeft(n);const e=l.add(h,l.create(n.width,0));const r=c.bottomRight(n);const a=l.subtract(r,l.create(n.width,0));const d=l.scale(o.reduce(((i,t)=>l.add(i,t)),l.create()),1/o.length,1/o.length);const u=[e,a,r].reduce(((i,t)=>l.distance(d,t)<l.distance(d,i)?t:i),h);switch(u){case h:return{point:u,placement:"top-left"};case e:return{point:u,placement:"top-right"};case a:return{point:u,placement:"bottom-left"};default:return{point:u,placement:"bottom-right"}}}function W(i,t,s,n,o,l){const h=t==="alt"&&i.altKey||t==="ctrl"&&i.ctrlKey||t==="meta"&&i.metaKey||t==="shift"&&i.shiftKey;if(h&&l!=null&&l>0&&Number.isInteger(l)){const i=s-n;const t=u.toDegrees(i);const h=Math.round(t/l)*l;if(o!=null){const i=Math.round(o/l)*l;const t=o-i;const s=h-t;const e=u.toRadians(s);return e+n}else{const i=u.toRadians(h);return i+n}}else{return s}}const ii=({ref:t,bounds:s,viewport:n,point:o,placement:l,displayUnit:h},e)=>{const r=ni(n,s!==null&&s!==void 0?s:f.create(0,0),o,l);return i("div",{ref:t,class:"widget-input wrapper",style:Object.assign(Object.assign({},r),{height:(s===null||s===void 0?void 0:s.height)!=null?`${s.height}px`:undefined})},e,i("div",{class:"widget-input units"},h.unit.abbreviatedName))};const ti=({ref:t,identifier:s,disabled:n,onChange:o,onIncrement:l,onDecrement:h,onBlur:e,onUndo:r})=>{const a=i=>{if(i.target!=null){const t=parseFloat(i.target.value);if(!isNaN(t)){o===null||o===void 0?void 0:o(parseFloat(i.target.value))}}};const d=i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="ArrowUp"){l===null||l===void 0?void 0:l()}else if(i.key==="ArrowDown"){h===null||h===void 0?void 0:h()}else if(i.key==="z"&&t&&r){i.preventDefault();r()}};return i("input",{ref:t,disabled:n,class:`widget-input ${s}`,type:"text",onChange:a,onKeyDown:d,onBlur:e})};function si(i,t){return Math.min(i,Math.max(0,t))}function ni(i,t,s,n,o=5){const{width:l,height:h}=i.dimensions;const e=t.width+o;const r=t.height+o;function a(i){return`${i}px`}switch(n){case"top-left":return{right:a(si(l-e,l-s.x)),bottom:a(si(h-r,h-s.y))};case"top-right":return{left:a(si(l-e,s.x)),bottom:a(si(h-r,h-s.y))};case"bottom-left":return{right:a(si(l-e,l-s.x)),top:a(si(h-r,s.y))};case"bottom-right":default:return{left:a(si(l-e,s.x)),top:a(si(h-r,s.y))}}}function oi(i,t,s=3,n=1,o=1){return ei(i,t,e.back(),e.up(),s,n,o)}function li(i,t,s=3,n=1,o=1){return ei(i,t,e.right(),e.back(),s,n,o)}function hi(i,t,s=3,n=1,o=1){return ei(i,t,e.right(),e.up(),s,n,o)}function ei(i,t,s,n,o,l=1,a=1){const v=e.transformMatrix(e.add(s,n),h.makeRotation(d.fromMatrixRotation(i)));const c=e.transformMatrix(s,h.makeRotation(d.fromMatrixRotation(i)));const f=e.transformMatrix(n,h.makeRotation(d.fromMatrixRotation(i)));const w=10*a**.25;const p=e.fromMatrixPosition(i);const x=e.add(p,e.scale(o*w,v));const g=r.create({origin:x,direction:c});const y=r.create({origin:x,direction:f});const m=e.cross(c,f);const z=e.rotateAboutAxis(u.toRadians(45),r.at(y,-(o*l)),m,x);const b=e.rotateAboutAxis(u.toRadians(45),r.at(g,o*l),m,x);const C=e.rotateAboutAxis(u.toRadians(45),r.at(y,o*l),m,x);const D=e.rotateAboutAxis(u.toRadians(45),r.at(g,-(o*l)),m,x);return new T(e.dot(c,t.direction)!==-1&&e.dot(f,t.direction)!==-1,z,D,b,C,e.transformMatrix(z,t.projectionViewMatrix),e.transformMatrix(D,t.projectionViewMatrix),e.transformMatrix(b,t.projectionViewMatrix),e.transformMatrix(C,t.projectionViewMatrix))}function ri(i,t,s,n){if(i instanceof C){return ai(i,t,s,n)}return false}function ai(i,t,s,n){return di([i.points.worldLeft,i.points.worldRight,i.points.worldTip],t,s,n)||di([i.points.worldLeft,i.points.worldRight,i.points.worldBase],t,s,n)}function di(i,t,s,n){var o;if(i.length===3){const l=s.transformPointToRay(n,t.image,t.scene.camera);const h=e.subtract(i[1],i[0]);const r=e.subtract(i[2],i[0]);const a=w.epsilon((o=w.fromVectors([l.direction,l.origin,h,r]))!==null&&o!==void 0?o:w.create(h,r));const d=e.cross(l.direction,r);const u=e.dot(h,d);if(!(Math.abs(u)>=a)){return false}const v=e.subtract(l.origin,i[0]);const c=e.dot(v,d)/u;if(c<0||c>1){return false}const f=e.cross(v,h);const p=e.dot(l.direction,f)/u;if(p<0||c+p>1){return false}const x=e.dot(r,f)/u;return!isNaN(x)&&(x>0||t.scene.camera.isOrthographic())}return false}class ui extends D{constructor(i,t={},s={}){var n,o,l,h,e,r,a,d,u,v,c,f,w,p;super(i);this.customization=t;this.disabledAxis={xTranslation:false,yTranslation:false,zTranslation:false,xyTranslation:false,xzTranslation:false,yzTranslation:false,xRotation:false,yRotation:false,zRotation:false};this.axisLines=[];this.rotationLines=[];this.translationMeshes=[];this.rotationMeshes=[];this.hoveredChanged=new b;this.xArrowFillColor=(n=t.colors)===null||n===void 0?void 0:n.xArrow;this.yArrowFillColor=(o=t.colors)===null||o===void 0?void 0:o.yArrow;this.zArrowFillColor=(l=t.colors)===null||l===void 0?void 0:l.zArrow;this.hoveredArrowFillColor=(h=t.colors)===null||h===void 0?void 0:h.hovered;this.outlineColor=(e=t.colors)===null||e===void 0?void 0:e.outline;this.disabledAxis.xTranslation=(r=s.xTranslation)!==null&&r!==void 0?r:false;this.disabledAxis.yTranslation=(a=s.yTranslation)!==null&&a!==void 0?a:false;this.disabledAxis.zTranslation=(d=s.zTranslation)!==null&&d!==void 0?d:false;this.disabledAxis.xyTranslation=(u=s.xyTranslation)!==null&&u!==void 0?u:false;this.disabledAxis.xzTranslation=(v=s.xzTranslation)!==null&&v!==void 0?v:false;this.disabledAxis.yzTranslation=(c=s.yzTranslation)!==null&&c!==void 0?c:false;this.disabledAxis.xRotation=(f=s.xRotation)!==null&&f!==void 0?f:false;this.disabledAxis.yRotation=(w=s.yRotation)!==null&&w!==void 0?w:false;this.disabledAxis.zRotation=(p=s.zRotation)!==null&&p!==void 0?p:false}dispose(){var i;(i=this.reglFrameDisposable)===null||i===void 0?void 0:i.cancel()}getDrawableElements(){return this.drawableElements}getFullBounds(){return this.fullBounds}boundsContainsPoint(i){return this.interactiveBounds!=null&&this.frame!=null&&c.containsPoints(this.interactiveBounds,i)}updateDisabledAxis(i){this.disabledAxis=Object.assign(Object.assign({},this.disabledAxis),i);this.updateDisabledOnDrawables()}updateCursor(i){this.cursor=i;if(i!=null&&this.frame!=null){this.updateHovered()}else{this.clearHovered()}}updateTransform(i){var t;this.transform=i;if(i!=null&&this.frame!=null){this.updateAndDraw()}else{this.clear();(t=this.reglFrameDisposable)===null||t===void 0?void 0:t.cancel();this.reglFrameDisposable=undefined}}updateColors(i={}){var t,s,n,o,l,h,e,r,a,d,u,v,c,f,w,p;this.xArrowFillColor=(t=i.xArrow)!==null&&t!==void 0?t:this.xArrowFillColor;this.yArrowFillColor=(s=i.yArrow)!==null&&s!==void 0?s:this.yArrowFillColor;this.zArrowFillColor=(n=i.zArrow)!==null&&n!==void 0?n:this.zArrowFillColor;this.twoAxesSquareFillColor=(o=i.twoAxesSquare)!==null&&o!==void 0?o:this.twoAxesSquareFillColor;this.hoveredArrowFillColor=(l=i.hovered)!==null&&l!==void 0?l:this.hoveredArrowFillColor;this.outlineColor=(h=i.outline)!==null&&h!==void 0?h:this.outlineColor;(e=this.xArrow)===null||e===void 0?void 0:e.updateFillColor(this.getXTranslationColor(),true);(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor(this.getYTranslationColor(),true);(a=this.zArrow)===null||a===void 0?void 0:a.updateFillColor(this.getZTranslationColor(),true);(d=this.xRotation)===null||d===void 0?void 0:d.updateFillColor(this.getXRotationColor(),true);(u=this.yRotation)===null||u===void 0?void 0:u.updateFillColor(this.getYRotationColor(),true);(v=this.zRotation)===null||v===void 0?void 0:v.updateFillColor(this.getZRotationColor(),true);(c=this.xyTranslation)===null||c===void 0?void 0:c.updateFillColor(this.getTwoAxesTranslationColor(),true);(f=this.xzTranslation)===null||f===void 0?void 0:f.updateFillColor(this.getTwoAxesTranslationColor(),true);(w=this.yzTranslation)===null||w===void 0?void 0:w.updateFillColor(this.getTwoAxesTranslationColor(),true);(p=this.hoveredElement)===null||p===void 0?void 0:p.updateFillColor(this.hoveredArrowFillColor)}updateScalars(i){this.customization=Object.assign(Object.assign({},this.customization),{scalars:i});if(this.transform!=null&&this.frame!=null){this.updateElements(this.transform,this.frame)}}onHoveredChanged(i){return this.hoveredChanged.on(i)}updateDisabledOnDrawables(){var i,t,s,n,o,l,h,e,r,a,d,u,v,c,f;(i=this.xRotation)===null||i===void 0?void 0:i.setDisabled(this.disabledAxis.xRotation);(t=this.xyRotationLine)===null||t===void 0?void 0:t.setDisabled(this.disabledAxis.xRotation);(s=this.xzRotationLine)===null||s===void 0?void 0:s.setDisabled(this.disabledAxis.xRotation);(n=this.yRotation)===null||n===void 0?void 0:n.setDisabled(this.disabledAxis.yRotation);(o=this.yzRotationLine)===null||o===void 0?void 0:o.setDisabled(this.disabledAxis.yRotation);(l=this.yxRotationLine)===null||l===void 0?void 0:l.setDisabled(this.disabledAxis.yRotation);(h=this.zRotation)===null||h===void 0?void 0:h.setDisabled(this.disabledAxis.zRotation);(e=this.zxRotationLine)===null||e===void 0?void 0:e.setDisabled(this.disabledAxis.zRotation);(r=this.zyRotationLine)===null||r===void 0?void 0:r.setDisabled(this.disabledAxis.zRotation);(a=this.xArrow)===null||a===void 0?void 0:a.setDisabled(this.disabledAxis.xTranslation);(d=this.yArrow)===null||d===void 0?void 0:d.setDisabled(this.disabledAxis.yTranslation);(u=this.zArrow)===null||u===void 0?void 0:u.setDisabled(this.disabledAxis.zTranslation);(v=this.xyTranslation)===null||v===void 0?void 0:v.setDisabled(this.disabledAxis.xyTranslation);(c=this.xzTranslation)===null||c===void 0?void 0:c.setDisabled(this.disabledAxis.xzTranslation);(f=this.yzTranslation)===null||f===void 0?void 0:f.setDisabled(this.disabledAxis.yzTranslation);this.updateColors()}updateHovered(){var i,t,s,n,o,l,h,e,r,a;const d=this.hoveredElement;const u=this.frame;if(u!=null){this.hoveredElement=[...this.translationMeshes,...this.rotationMeshes].filter((i=>i.points.valid&&!i.isDisabled())).find((i=>this.cursor!=null?ri(i,u,this.viewport,this.cursor):false));if(this.hoveredElement!==d){this.hoveredChanged.emit(this.hoveredElement);(i=this.hoveredElement)===null||i===void 0?void 0:i.updateFillColor(this.hoveredArrowFillColor);this.clearFillColorOfPreviouslyHovered(d);if(((t=this.hoveredElement)===null||t===void 0?void 0:t.identifier)==="xy-translate"){(s=this.xArrow)===null||s===void 0?void 0:s.updateFillColor(this.hoveredArrowFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor(this.hoveredArrowFillColor)}else if(((o=this.hoveredElement)===null||o===void 0?void 0:o.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor(this.hoveredArrowFillColor);(h=this.zArrow)===null||h===void 0?void 0:h.updateFillColor(this.hoveredArrowFillColor)}else if(((e=this.hoveredElement)===null||e===void 0?void 0:e.identifier)==="yz-translate"){(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor(this.hoveredArrowFillColor);(a=this.zArrow)===null||a===void 0?void 0:a.updateFillColor(this.hoveredArrowFillColor)}}}}clearHovered(){const i=this.hoveredElement;this.hoveredElement=undefined;if(this.hoveredElement!==i){this.hoveredChanged.emit(this.hoveredElement);this.clearFillColorOfPreviouslyHovered(i)}}clearFillColorOfPreviouslyHovered(i){var t,s,n,o,l,h,e,r,a,d,u,v;i===null||i===void 0?void 0:i.updateFillColor(i===null||i===void 0?void 0:i.initialFillColor);if((i===null||i===void 0?void 0:i.identifier)==="xy-translate"){(t=this.xArrow)===null||t===void 0?void 0:t.updateFillColor((s=this.xArrow)===null||s===void 0?void 0:s.initialFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor((o=this.yArrow)===null||o===void 0?void 0:o.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor((h=this.xArrow)===null||h===void 0?void 0:h.initialFillColor);(e=this.zArrow)===null||e===void 0?void 0:e.updateFillColor((r=this.zArrow)===null||r===void 0?void 0:r.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="yz-translate"){(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor((d=this.yArrow)===null||d===void 0?void 0:d.initialFillColor);(u=this.zArrow)===null||u===void 0?void 0:u.updateFillColor((v=this.zArrow)===null||v===void 0?void 0:v.initialFillColor)}}hasData(){return this.transform!=null}createOrUpdateElements(){if(this.transform!=null&&this.frame!=null){if(this.xArrow==null||this.yArrow==null||this.zArrow==null){this.createElements(this.transform,this.frame)}else{this.updateElements(this.transform,this.frame)}this.interactiveBounds=R(this.viewport,...this.rotationMeshes,...this.translationMeshes);this.fullBounds=R(this.viewport,...this.rotationMeshes,...this.translationMeshes,...this.axisLines)}}createElements(i,t){var s,n,o,l,h,r,a,d,u,v,c,f;this.reglCommand=j({canvas:this.canvasElement,extensions:"angle_instanced_arrays"});const{createShape:w}=A(this.reglCommand);const p=this.computeTriangleSize(e.fromMatrixPosition(i),t);this.xArrow=new C(w,"x-translate",O(i,t.scene.camera,p,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation),this.outlineColor,this.getXTranslationColor());this.xRotation=new C(w,"x-rotate",oi(i,t.scene.camera,p,(n=this.customization.scalars)===null||n===void 0?void 0:n.xRotation,(o=this.customization.scalars)===null||o===void 0?void 0:o.xTranslation),this.outlineColor,this.getXRotationColor());this.xAxis=new P(w,"x-axis",S(i,t.scene.camera,this.xArrow),this.outlineColor,this.getXTranslationColor());this.yArrow=new C(w,"y-translate",E(i,t.scene.camera,p,(l=this.customization.scalars)===null||l===void 0?void 0:l.yTranslation),this.outlineColor,this.getYTranslationColor());this.yRotation=new C(w,"y-rotate",li(i,t.scene.camera,p,(h=this.customization.scalars)===null||h===void 0?void 0:h.yRotation,(r=this.customization.scalars)===null||r===void 0?void 0:r.yTranslation),this.outlineColor,this.getYRotationColor());this.yAxis=new P(w,"y-axis",S(i,t.scene.camera,this.yArrow),this.outlineColor,this.getYTranslationColor());this.zArrow=new C(w,"z-translate",F(i,t.scene.camera,p,(a=this.customization.scalars)===null||a===void 0?void 0:a.zTranslation),this.outlineColor,this.getZTranslationColor());this.zAxis=new P(w,"z-axis",S(i,t.scene.camera,this.zArrow),this.outlineColor,this.getZTranslationColor());this.zRotation=new C(w,"z-rotate",hi(i,t.scene.camera,p,(d=this.customization.scalars)===null||d===void 0?void 0:d.zRotation,(u=this.customization.scalars)===null||u===void 0?void 0:u.zTranslation),this.outlineColor,this.getZRotationColor());this.xyTranslation=new C(w,"xy-translate",N(i,t.scene.camera,p,(v=this.customization.scalars)===null||v===void 0?void 0:v.xyTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.xzTranslation=new C(w,"xz-translate",U(i,t.scene.camera,p,(c=this.customization.scalars)===null||c===void 0?void 0:c.xzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.yzTranslation=new C(w,"yz-translate",H(i,t.scene.camera,p,(f=this.customization.scalars)===null||f===void 0?void 0:f.yzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.createRotationLines(w,i,t);this.axisLines=[this.xAxis,this.yAxis,this.zAxis];this.translationMeshes=[this.xArrow,this.yArrow,this.zArrow,this.xyTranslation,this.xzTranslation,this.yzTranslation];this.rotationMeshes=[this.xRotation,this.yRotation,this.zRotation];this.updateDisabledOnDrawables();this.availableElements=[...this.axisLines,...this.rotationLines,...this.translationMeshes,...this.rotationMeshes]}getXRotationColor(){return this.xArrowFillColor}getYRotationColor(){return this.yArrowFillColor}getZRotationColor(){return this.zArrowFillColor}getXTranslationColor(){return this.xArrowFillColor}getYTranslationColor(){return this.yArrowFillColor}getZTranslationColor(){return this.zArrowFillColor}getTwoAxesTranslationColor(){return this.twoAxesSquareFillColor}createRotationLines(i,t,s){var n,o,l,h,r,a;const d=this.computeTriangleSize(e.fromMatrixPosition(t),s);const u=I(s.scene.camera,this.xRotation,(n=this.yArrow)===null||n===void 0?void 0:n.points.worldTip,d);const v=I(s.scene.camera,this.xRotation,(o=this.zArrow)===null||o===void 0?void 0:o.points.worldTip,d);const c=I(s.scene.camera,this.yRotation,(l=this.xArrow)===null||l===void 0?void 0:l.points.worldTip,d);const f=I(s.scene.camera,this.yRotation,(h=this.zArrow)===null||h===void 0?void 0:h.points.worldTip,d);const w=I(s.scene.camera,this.zRotation,(r=this.xArrow)===null||r===void 0?void 0:r.points.worldTip,d);const p=I(s.scene.camera,this.zRotation,(a=this.yArrow)===null||a===void 0?void 0:a.points.worldTip,d);if(u!=null){this.xyRotationLine=new $(i,"xy-rotation-line",u,this.outlineColor)}if(v!=null){this.xzRotationLine=new $(i,"xz-rotation-line",v,this.outlineColor)}if(c!=null){this.yxRotationLine=new $(i,"yx-rotation-line",c,this.outlineColor)}if(f!=null){this.yzRotationLine=new $(i,"yz-rotation-line",f,this.outlineColor)}if(w!=null){this.zxRotationLine=new $(i,"zx-rotation-line",w,this.outlineColor)}if(p!=null){this.zyRotationLine=new $(i,"zy-rotation-line",p,this.outlineColor)}this.rotationLines=[this.xyRotationLine,this.xzRotationLine,this.yxRotationLine,this.yzRotationLine,this.zxRotationLine,this.zyRotationLine].filter((i=>i!=null))}updateElements(i,t){var s,n,o,l,h,r,a,d,u,v,c,f,w,p,x,g,y,m,z,b,T,C,D,R,j,A,P,$,M,_;const q=this.computeTriangleSize(e.fromMatrixPosition(i),t);if(this.xArrow!=null){this.xArrow.updatePoints(O(i,t.scene.camera,q,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation));(n=this.xAxis)===null||n===void 0?void 0:n.updatePoints(S(i,t.scene.camera,this.xArrow))}(o=this.xRotation)===null||o===void 0?void 0:o.updatePoints(oi(i,t.scene.camera,q,(l=this.customization.scalars)===null||l===void 0?void 0:l.xRotation,(h=this.customization.scalars)===null||h===void 0?void 0:h.xTranslation));if(this.yArrow!=null){this.yArrow.updatePoints(E(i,t.scene.camera,q,(r=this.customization.scalars)===null||r===void 0?void 0:r.yTranslation));(a=this.yAxis)===null||a===void 0?void 0:a.updatePoints(S(i,t.scene.camera,this.yArrow))}(d=this.yRotation)===null||d===void 0?void 0:d.updatePoints(li(i,t.scene.camera,q,(u=this.customization.scalars)===null||u===void 0?void 0:u.yRotation,(v=this.customization.scalars)===null||v===void 0?void 0:v.yTranslation));if(this.zArrow!=null){this.zArrow.updatePoints(F(i,t.scene.camera,q,(c=this.customization.scalars)===null||c===void 0?void 0:c.zTranslation));(f=this.zAxis)===null||f===void 0?void 0:f.updatePoints(S(i,t.scene.camera,this.zArrow))}(w=this.zRotation)===null||w===void 0?void 0:w.updatePoints(hi(i,t.scene.camera,q,(p=this.customization.scalars)===null||p===void 0?void 0:p.zRotation,(x=this.customization.scalars)===null||x===void 0?void 0:x.zTranslation));(g=this.xyRotationLine)===null||g===void 0?void 0:g.updatePoints(I(t.scene.camera,this.xRotation,(y=this.yArrow)===null||y===void 0?void 0:y.points.worldTip,q));(m=this.xzRotationLine)===null||m===void 0?void 0:m.updatePoints(I(t.scene.camera,this.xRotation,(z=this.zArrow)===null||z===void 0?void 0:z.points.worldTip,q));(b=this.yxRotationLine)===null||b===void 0?void 0:b.updatePoints(I(t.scene.camera,this.yRotation,(T=this.xArrow)===null||T===void 0?void 0:T.points.worldTip,q));(C=this.yzRotationLine)===null||C===void 0?void 0:C.updatePoints(I(t.scene.camera,this.yRotation,(D=this.zArrow)===null||D===void 0?void 0:D.points.worldTip,q));(R=this.zxRotationLine)===null||R===void 0?void 0:R.updatePoints(I(t.scene.camera,this.zRotation,(j=this.xArrow)===null||j===void 0?void 0:j.points.worldTip,q));(A=this.zyRotationLine)===null||A===void 0?void 0:A.updatePoints(I(t.scene.camera,this.zRotation,(P=this.yArrow)===null||P===void 0?void 0:P.points.worldTip,q));if(this.xyTranslation!=null){this.xyTranslation.updatePoints(N(i,t.scene.camera,q,($=this.customization.scalars)===null||$===void 0?void 0:$.xyTranslation))}if(this.xzTranslation!=null){this.xzTranslation.updatePoints(U(i,t.scene.camera,q,(M=this.customization.scalars)===null||M===void 0?void 0:M.xzTranslation))}if(this.yzTranslation!=null){this.yzTranslation.updatePoints(H(i,t.scene.camera,q,(_=this.customization.scalars)===null||_===void 0?void 0:_.yzTranslation))}}}const vi=":host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-two-axes-square-color:var(--two-axes-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:8em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;pointer-events:auto;display:flex;align-items:center;border:1px solid #444444;border-radius:4px;width:var(--viewer-transform-widget-input-width);text-align:center;background-color:white;box-sizing:border-box}.widget-input.units{position:relative;width:25%;height:100%;padding:0 0.25rem;font-size:0.8125rem;color:#444444}input.widget-input{position:relative;text-align:center;box-sizing:border-box;width:75%;height:100%;outline:none;border-width:0 1px 0 0;border-color:#444444;border-radius:2px 0 0 2px;font-size:0.875rem;color:#444444}input.widget-input.x-translate,input.widget-input.x-rotate{border-left:5px solid var(--viewer-transform-widget-x-axis-arrow-color)}input.widget-input.y-translate,input.widget-input.y-rotate{border-left:5px solid var(--viewer-transform-widget-y-axis-arrow-color)}input.widget-input.z-translate,input.widget-input.z-rotate{border-left:5px solid var(--viewer-transform-widget-z-axis-arrow-color)}input.widget-input:disabled{color:#888888}input.widget-input:focus{outline:none}";const ci=class{constructor(i){t(this,i);this.positionChanged=s(this,"positionChanged",7);this.rotationChanged=s(this,"rotationChanged",7);this.interactionEnded=s(this,"interactionEnded",7);this.interactionStarted=s(this,"interactionStarted",7);this.xRotationDisabled=false;this.yRotationDisabled=false;this.zRotationDisabled=false;this.xTranslationDisabled=false;this.yTranslationDisabled=false;this.zTranslationDisabled=false;this.xyTranslationDisabled=false;this.xzTranslationDisabled=false;this.yzTranslationDisabled=false;this.showInputs=true;this.distanceUnit="millimeters";this.angleUnit="degrees";this.decimalPlaces=1;this.rotationSnapKey="shift";this.translationHandleScalar=1;this.rotationHandleScalar=1;this.interactionThrottle=75;this.EXPERIMENTAL_undoKeybindings=false;this.inputValue=0;this.isEndingTransform=false;this.inputShouldFocus=false;this.xArrowColor="#ea3324";this.yArrowColor="#4faf32";this.zArrowColor="#0000ff";this.twoAxesSquareColor="#e0e0e0";this.hoveredColor="#ffff00";this.lastAngle=0;this.handleHoveredDrawableChanged=i=>{this.hovered=i};this.handleViewerFrameDrawn=()=>{this.updatePropsFromViewer()};this.handleViewerDimensionsChange=()=>{x((()=>{if(this.viewer!=null&&this.canvasRef!=null){this.canvasRef.width=this.viewer.viewport.width;this.canvasRef.height=this.viewer.viewport.height;this.updateCanvasBounds(this.canvasRef)}}))};this.handleResize=()=>{if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef)}};this.handleInputResize=()=>{if(this.inputWrapperRef!=null){const i=this.inputWrapperRef;g((()=>{this.inputBounds=i.getBoundingClientRect()}))}};this.handleStyleChange=()=>{g((()=>{const i=window.getComputedStyle(this.hostEl);this.xArrowColor=i.getPropertyValue("--viewer-transform-widget-x-axis-arrow-color").trim();this.yArrowColor=i.getPropertyValue("--viewer-transform-widget-y-axis-arrow-color").trim();this.zArrowColor=i.getPropertyValue("--viewer-transform-widget-z-axis-arrow-color").trim();this.twoAxesSquareColor=i.getPropertyValue("--viewer-transform-widget-two-axes-square-color").trim();this.hoveredColor=i.getPropertyValue("--viewer-transform-widget-hovered-arrow-color").trim();this.getTransformWidget().updateColors({xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor})}))};this.handlePointerMove=i=>{if(this.dragging==null){const t=_(l.create(i.clientX,i.clientY),this.getCanvasBounds());const s=this.getTransformWidget();if(t!=null&&s.boundsContainsPoint(t)){s.updateCursor(t)}else{s.updateCursor(undefined);this.hovered=undefined}}};this.handleBeginDrag=async i=>{var t,s,n;const o=this.getCanvasBounds();if(this.hovered!=null&&o!=null&&this.viewer!=null&&this.position!=null&&this.viewer.frame!=null){this.dragging=this.hovered;if(this.dragging.identifier!==((t=this.lastDragged)===null||t===void 0?void 0:t.identifier)){this.inputValue=0;this.dragStartTransform=this.currentTransform;this.updateInputPosition();this.updateInputValue()}this.lastDragged=undefined;const h=_(l.create(i.clientX,i.clientY),o);const e=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);this.lastAngle=h!=null?u.fromPoints(e,h):0;this.lastWorldPosition=q(h,(s=this.viewer)===null||s===void 0?void 0:s.frame,(n=this.viewer)===null||n===void 0?void 0:n.viewport,this.currentTransform);this.interactionStarted.emit();window.removeEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointermove",this.handleDragWithTimer);window.addEventListener("pointerup",this.handleEndTransform)}};this.handleDragWithTimer=async i=>{if(i!=null){i.preventDefault();this.lastMouseEvent=i}if(this.interactionTimer==null){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.handleDrag();this.lastMouseEvent=undefined}),this.interactionThrottle)}};this.handleDrag=async()=>{var i,t,s;const n=this.getCanvasBounds();if(this.dragging!=null&&this.lastWorldPosition!=null&&n!=null&&this.viewer!=null&&this.viewer.frame!=null&&this.position!=null&&this.lastMouseEvent!=null){await((i=this.controller)===null||i===void 0?void 0:i.beginTransform());const o=_(l.create(this.lastMouseEvent.clientX,this.lastMouseEvent.clientY),n);const h=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);const e=q(o,(t=this.viewer)===null||t===void 0?void 0:t.frame,(s=this.viewer)===null||s===void 0?void 0:s.viewport,this.currentTransform);if(e!=null&&o!=null&&h!=null){const i=u.fromPoints(h,o);const t=W(this.lastMouseEvent,this.rotationSnapKey,i,this.lastAngle,this.getDisplayedAngle(),this.rotationSnapDegrees);this.transform(this.lastWorldPosition,e,t-this.lastAngle);this.updateInputPosition();this.updateInputValue();this.lastWorldPosition=e;this.lastAngle=t}}};this.handleEndTransform=async i=>{var t,s;const n=_(l.create(i.clientX,i.clientY),this.getCanvasBounds());const o=this.getTransformWidget();this.lastDragged=this.dragging;this.dragging=undefined;this.lastWorldPosition=undefined;this.lastAngle=0;this.updateInputPosition();this.updateInputValue();o.updateCursor(n);o.updateTransform(this.currentTransform);this.beginEndTransform();window.removeEventListener("pointermove",this.handleDragWithTimer);window.removeEventListener("pointerup",this.handleEndTransform);try{const i=(t=this.controller)===null||t===void 0?void 0:t.getCurrentDelta();await((s=this.controller)===null||s===void 0?void 0:s.endTransform());this.interactionEnded.emit(i)}catch(i){console.error("Failed to end transform interaction",i)}window.addEventListener("pointermove",this.handlePointerMove);this.completeEndTransform()};this.handleInputStep=async i=>{if(this.inputValue!=null&&this.lastInputValue!=null){if(this.isModifyingAngleUnits()){const t=new z(this.angleUnit);const s=t.convertFrom(this.lastInputValue);const n=u.normalizeRadians(s+u.toRadians(i));this.inputValue=t.convertTo(n)}else{this.inputValue=this.lastInputValue+i}await this.updateTransformFromInput(this.inputValue)}};this.handleInputChange=async i=>{await this.updateTransformFromInput(i)};this.handleKeyDown=async i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="z"&&t&&this.EXPERIMENTAL_undoKeybindings){i.stopPropagation();await this.EXPERIMENTAL_undo()}};this.updateTransformFromInput=async i=>{var t,s,n;if(this.lastDragged!=null&&this.currentTransform!=null&&this.startingTransform!=null&&this.lastInputValue!=null){this.currentTransform=J(this.currentTransform,this.lastDragged.identifier,i,this.lastInputValue,this.distanceUnit,this.angleUnit);this.updateInputValue();this.lastInputValue=i;await((t=this.controller)===null||t===void 0?void 0:t.beginTransform());this.getTransformWidget().updateTransform(this.currentTransform);await((s=this.controller)===null||s===void 0?void 0:s.updateTransform(h.multiply(this.currentTransform,h.invert(this.startingTransform))));this.updateInputPosition();await((n=this.controller)===null||n===void 0?void 0:n.endTransformDebounced(this.beginEndTransform,this.completeEndTransform))}};this.updatePropsFromViewer=()=>{const{frame:i}=this.viewer||{};if(i!=null){const t=this.getTransformWidget();t.updateFrame(i,this.dragging==null);this.updateInputPosition()}};this.setupTransformWidget=i=>{var t,s;console.debug(`Initializing transform widget. [initial-position=${JSON.stringify(this.position)}, has-initial-frame=${((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null}]`);const n=this.getTranslationScalar();const o=this.getRotationScalar();this.widget=new ui(i,{colors:{xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor},scalars:{xTranslation:n,yTranslation:n,zTranslation:n,xyTranslation:o,xzTranslation:o,yzTranslation:o,xRotation:o,yRotation:o,zRotation:o}});if(this.rotation!=null){this.currentTransform=this.getTransformForNewRotation(this.rotation);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(this.position!=null){this.currentTransform=this.getTransformForNewPosition(this.position);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(((s=this.viewer)===null||s===void 0?void 0:s.frame)!=null){this.widget.updateFrame(this.viewer.frame,true)}this.handleSettingDisabledAxis();this.hoveredChangeDisposable=this.widget.onHoveredChanged(this.handleHoveredDrawableChanged);return this.widget};this.updateCanvasBounds=i=>{g((()=>{this.canvasBounds=i.getBoundingClientRect();this.getTransformWidget().updateDimensions(i)}))};this.updateInputValue=()=>{var i,t,s;const n=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const o=(n===null||n===void 0?void 0:n.identifier)==="xy-translate"||(n===null||n===void 0?void 0:n.identifier)==="xz-translate"||(n===null||n===void 0?void 0:n.identifier)==="yz-translate";if(n!=null&&this.currentTransform!=null&&this.dragStartTransform!=null&&!o){this.lastInputValue=this.inputValue;this.inputValue=X(n.identifier,this.currentTransform,this.dragStartTransform,this.distanceUnit,this.angleUnit);if(this.inputRef!=null){const i=(s=(t=this.getDisplayedDistance())!==null&&t!==void 0?t:this.getDisplayedAngle())!==null&&s!==void 0?s:0;const n=`${parseFloat(i.toFixed(this.decimalPlaces))}`;this.inputRef.value=n}}};this.updateInputPosition=()=>{var i,t;const s=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const n=(s===null||s===void 0?void 0:s.identifier)==="xy-translate"||(s===null||s===void 0?void 0:s.identifier)==="xz-translate"||(s===null||s===void 0?void 0:s.identifier)==="yz-translate";if(this.showInputs&&((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null&&this.position!=null&&s!=null&&!n){const i=this.getTransformWidget();const t=i.getFullBounds();this.inputPosition=t!=null?Q(this.viewer.viewport,t,s.points.toArray()):undefined}else if(n){this.inputPosition=undefined}};this.beginEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:true,yRotation:true,zRotation:true,xTranslation:true,yTranslation:true,zTranslation:true,xyTranslation:true,xzTranslation:true,yzTranslation:true});this.isEndingTransform=true};this.completeEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled});this.isEndingTransform=false;this.inputShouldFocus=true;if(this.currentTransform!=null){this.position=e.fromMatrixPosition(this.currentTransform);this.rotation=v.fromRotationMatrix(this.currentTransform)}};this.isModifyingAngleUnits=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;return!!(n===null||n===void 0?void 0:n.includes("rotate"))};this.getTranslationScalar=()=>{if(this.translationHandleScalar>0){return this.translationHandleScalar}console.warn("Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getRotationScalar=()=>{if(this.rotationHandleScalar>0){return this.rotationHandleScalar}console.warn("Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getDisplayedUnits=()=>{if(this.isModifyingAngleUnits()){return new z(this.angleUnit)}return new m(this.distanceUnit)};this.getDisplayedAngle=()=>{if(this.isModifyingAngleUnits()){return this.inputValue}};this.getDisplayedDistance=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;if(n===null||n===void 0?void 0:n.includes("translate")){return this.inputValue}};this.getTransformForNewPosition=i=>{if(i!=null){const t=this.currentTransform!=null?this.currentTransform:h.makeIdentity();const s=h.makeRotation(d.fromMatrixRotation(t));const n=h.makeTranslation(i);return h.multiply(n,s)}};this.getTransformForNewRotation=i=>{const t=this.currentTransform!=null?this.currentTransform:h.makeIdentity();const s=h.invert(h.makeRotation(d.fromMatrixRotation(t)));const n=h.makeRotation(d.fromEuler(i));const o=h.multiply(t,s);return h.multiply(o,n)};this.getCanvasBounds=()=>{if(this.canvasBounds!=null){return this.canvasBounds}else if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef);return this.canvasBounds}};this.getTransformWidget=()=>{if(this.widget==null&&this.canvasRef!=null){return this.setupTransformWidget(this.canvasRef)}else if(this.widget!=null){return this.widget}else{throw new Error("Transform widget was not initialized. The canvas element may not have been initialized.")}}}componentDidLoad(){window.addEventListener("pointermove",this.handlePointerMove);this.canvasResizeObserver=new ResizeObserver(this.handleResize);this.inputResizeObserver=new ResizeObserver(this.handleInputResize);this.hostStyleObserver=new MutationObserver(this.handleStyleChange);if(this.canvasRef!=null){this.canvasResizeObserver.observe(this.canvasRef);this.setupTransformWidget(this.canvasRef)}this.hostStyleObserver.observe(this.hostEl,{attributes:true,attributeFilter:["style"]});this.handleViewerChanged(this.viewer,undefined);this.handleStyleChange()}disconnectedCallback(){var i,t,s,n,o;window.removeEventListener("pointermove",this.handlePointerMove);(i=this.canvasResizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.inputResizeObserver)===null||t===void 0?void 0:t.disconnect();(s=this.hostStyleObserver)===null||s===void 0?void 0:s.disconnect();(n=this.hoveredChangeDisposable)===null||n===void 0?void 0:n.dispose();(o=this.widget)===null||o===void 0?void 0:o.dispose()}componentDidRender(){if(this.inputShouldFocus&&this.inputRef!=null){M(this.inputRef);this.inputShouldFocus=false}}async EXPERIMENTAL_undo(){var i,t;const s=await((i=this.controller)===null||i===void 0?void 0:i.EXPERIMENTAL_undoTransform());if(this.currentTransform!=null&&s!=null){this.currentTransform=h.multiply(s,this.currentTransform);(t=this.widget)===null||t===void 0?void 0:t.updateTransform(this.currentTransform);this.updateInputPosition();this.updateInputValue();this.lastInputValue=this.inputValue;this.position=e.fromMatrixPosition(this.currentTransform);this.rotation=v.fromRotationMatrix(this.currentTransform)}}handleViewerChanged(i,t){var s;t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.removeEventListener("dimensionschange",this.handleViewerDimensionsChange);i===null||i===void 0?void 0:i.addEventListener("frameDrawn",this.handleViewerFrameDrawn);i===null||i===void 0?void 0:i.addEventListener("dimensionschange",this.handleViewerDimensionsChange);if((i===null||i===void 0?void 0:i.stream)!=null){(s=this.controller)===null||s===void 0?void 0:s.dispose();this.controller=new y(i.stream)}}handleDisabledPropertyChanged(){var i;(i=this.widget)===null||i===void 0?void 0:i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}handleTransformHandleScalarChanged(){var i;const t=this.getTranslationScalar();const s=this.getRotationScalar();(i=this.widget)===null||i===void 0?void 0:i.updateScalars({xTranslation:t,yTranslation:t,zTranslation:t,xyTranslation:s,xzTranslation:s,yzTranslation:s,xRotation:s,yRotation:s,zRotation:s})}handleRotationChanged(i,t){var s;const n=i!==null&&i!==void 0?i:v.create();this.currentTransform=this.getTransformForNewRotation(n);this.startingTransform=this.currentTransform;if(i==null&&this.currentTransform!=null&&h.isIdentity(this.currentTransform)){this.currentTransform=undefined;this.startingTransform=this.currentTransform}(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);console.debug(`Updating widget rotation [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);this.rotationChanged.emit(i)}handlePositionChanged(i,t){var s,n;this.currentTransform=this.getTransformForNewPosition(i);this.startingTransform=this.currentTransform;console.debug(`Updating widget position [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);if(i==null){this.lastDragged=undefined;this.inputPosition=undefined;(n=this.controller)===null||n===void 0?void 0:n.clearTransform()}this.positionChanged.emit(i)}handleInputFormattingChanged(){this.updateInputValue();this.lastInputValue=this.inputValue}render(){var t,s,o,l,h,e;return i(n,null,i("canvas",{ref:i=>{this.canvasRef=i},class:p("widget",{hovered:this.hovered!=null}),tabindex:"0",width:(t=this.viewer)===null||t===void 0?void 0:t.viewport.width,height:(s=this.viewer)===null||s===void 0?void 0:s.viewport.height,onPointerDown:this.handleBeginDrag,onKeyDown:this.handleKeyDown}),this.showInputs&&this.inputPosition&&((o=this.viewer)===null||o===void 0?void 0:o.viewport)&&i(ii,{ref:i=>{var t,s;if(i!=null){(t=this.inputResizeObserver)===null||t===void 0?void 0:t.observe(i)}else if(this.inputRef!=null){(s=this.inputResizeObserver)===null||s===void 0?void 0:s.unobserve(this.inputRef)}this.inputWrapperRef=i},bounds:this.inputBounds,viewport:this.viewer.viewport,point:this.inputPosition.point,placement:this.inputPosition.placement,displayUnit:this.getDisplayedUnits()},i(ti,{ref:i=>{this.inputRef=i},identifier:(h=(l=this.dragging)===null||l===void 0?void 0:l.identifier)!==null&&h!==void 0?h:(e=this.lastDragged)===null||e===void 0?void 0:e.identifier,disabled:this.isEndingTransform,onChange:this.handleInputChange,onIncrement:()=>this.handleInputStep(1),onDecrement:()=>this.handleInputStep(-1),onBlur:()=>{this.inputShouldFocus=false},onUndo:this.EXPERIMENTAL_undoKeybindings?()=>this.EXPERIMENTAL_undo():undefined})))}transform(i,t,s){var n,o;if(this.position!=null&&this.startingTransform!=null&&this.currentTransform!=null&&this.dragging!=null&&this.viewer!=null&&this.viewer.frame!=null){this.currentTransform=k(this.currentTransform,i,t,(n=this.viewer)===null||n===void 0?void 0:n.frame.scene.camera.viewVector,s,this.dragging.identifier);this.getTransformWidget().updateTransform(this.currentTransform);(o=this.controller)===null||o===void 0?void 0:o.updateTransform(h.multiply(this.currentTransform,h.invert(this.startingTransform)))}}handleSettingDisabledAxis(){if(this.widget){this.widget.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}else{console.warn("Cannot set disabled values - no widget defined")}}get hostEl(){return o(this)}static get watchers(){return{viewer:["handleViewerChanged"],xTranslationDisabled:["handleDisabledPropertyChanged"],yTranslationDisabled:["handleDisabledPropertyChanged"],zTranslationDisabled:["handleDisabledPropertyChanged"],xyTranslationDisabled:["handleDisabledPropertyChanged"],xzTranslationDisabled:["handleDisabledPropertyChanged"],yzTranslationDisabled:["handleDisabledPropertyChanged"],xRotationDisabled:["handleDisabledPropertyChanged"],yRotationDisabled:["handleDisabledPropertyChanged"],zRotationDisabled:["handleDisabledPropertyChanged"],translationHandleScalar:["handleTransformHandleScalarChanged"],rotationHandleScalar:["handleTransformHandleScalarChanged"],rotation:["handleRotationChanged"],position:["handlePositionChanged"],distanceUnit:["handleInputFormattingChanged"],angleUnit:["handleInputFormattingChanged"],decimalPlaces:["handleInputFormattingChanged"]}}};ci.style=vi;export{ci as vertex_viewer_transform_widget};
|
|
5
|
+
//# sourceMappingURL=p-0aa04328.entry.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{h as i,F as t,r as n}from"./p-388f809e.js";import{p as e,m as o,v as s}from"./p-9d26f24e.js";import"./p-f8951894.js";import"./p-eda9f5d4.js";import"./p-7af4e8a6.js";import"./p-5ca72d4a.js";import"./p-36dcfc94.js";import"./p-e656bd4c.js";import"./p-e3945092.js";import"./p-0d971ad6.js";import{V as r}from"./p-148e5f47.js";import{g as a,i as l,b as d,P as p,a as h,c}from"./p-4637d762.js";import{c as v}from"./p-92793987.js";import"./p-ba120f65.js";import"./p-e5cc48b6.js";import"./p-6b00f7cd.js";import"./p-e4f95584.js";import"./p-3060996e.js";const u=({pin:n,selected:e,occluded:o,detached:s})=>{const{primaryColor:r}=a(n);return i(t,null,d(n)&&i("div",{id:"pin-anchor",class:v("pin-anchor",{selected:e,"pin-occluded":o,"pin-detached":s}),style:{background:r}}),l(n)&&i("vertex-viewer-icon",{name:"pin-fill",size:"lg",class:v("pin",{"pin-selected":e,"pin-occluded":o,"pin-detached":s}),style:{color:r}}))};function w(i,t,n){const o={x:i.x+n.width/2,y:i.y};const s={x:i.x+n.width/2,y:i.y+n.height};const r={x:i.x+n.width,y:i.y+n.height/2};const a={x:i.x,y:i.y+n.height/2};const l=[o,s,a,r];const d=l.map((i=>e.distance(i,t)));const p=d.indexOf(Math.min(...d));return l[p]}const m=":host{--viewer-annotations-pin-primary-color:var(--blue-700);--viewer-annotations-pin-accent-color:var(--blue-200);--viewer-annotations-pin-dot-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-font-size:0.75rem;--viewer-annotations-pin-selected-stroke:var(--white);--viewer-annotations-pin-selected-border:2px solid var(--white);--viewer-annotations-pin-label-border:2px solid var(--black);--viewer-annotations-pin-selected-stroke:var(--white);font-size:var(--viewer-annotations-pin-font-size);position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none}.pin-anchor{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block;width:9px;height:9px;box-sizing:border-box;border:var(--viewer-annotations-pin-label-border);background:var(--viewer-annotations-pin-dot-color);pointer-events:auto;cursor:pointer}.selected{width:13px;height:13px;border:var(--viewer-annotations-pin-selected-border)}.pin{color:var(--viewer-annotations-pin-color);cursor:pointer;transition:opacity 0.3s ease-in;transform:translate(0px, -12px)}.pin-selected{stroke-width:1;stroke:var(--viewer-annotations-pin-selected-stroke)}.pin-occluded{opacity:.3;transition:opacity 0.3s ease-in}.pin-detached{visibility:hidden}";const b=class{constructor(i){n(this,i);this.matrix=o.makeIdentity();this.projectionViewMatrix=o.makeIdentity();this.pinModel=new p;this.selected=false;this.occluded=false;this.detached=false;this.invalidateStateCounter=0;this.invalidateState=()=>{this.invalidateStateCounter=this.invalidateStateCounter+1}}componentDidLoad(){var i;this.setLabelObserver();if(this.pinController==null){this.pinController=new h(this.pinModel)}if(this.selected){(i=this.labelEl)===null||i===void 0?void 0:i.setFocus()}}async handleOcclusionStateChanged(i){this.occluded=i.detail}async handleDetachedStateChanged(i){this.detached=i.detail}disconnectedCallback(){var i,t;(i=this.labelEl)===null||i===void 0?void 0:i.removeEventListener("labelChanged",this.invalidateState);(t=this.resizeObserver)===null||t===void 0?void 0:t.disconnect()}render(){var n;if(this.pin==null){throw new Error("Unable to draw pin")}const{pinPoint:e,labelPoint:o}=this.computePinPoints(this.pin);return i(t,null,i("vertex-viewer-dom-element",{"data-testid":`drawn-pin-${this.pin.id}`,position:this.pin.worldPosition,onPointerDown:async()=>{var i;await((i=this.labelEl)===null||i===void 0?void 0:i.submit());this.selectPin();this.handleAnchorPointerDown()},detachedOff:false},i(u,{pin:this.pin,selected:this.selected,occluded:this.occluded,detached:this.detached})),d(this.pin)&&!this.occluded&&!this.detached&&i(t,null,i("vertex-viewer-pin-label-line",{id:`pin-label-line-${(n=this.pin)===null||n===void 0?void 0:n.id}`,pinPoint:e,pin:this.pin,labelPoint:o,onPointerDown:()=>this.selectPin()}),i("vertex-viewer-pin-label",{pin:this.pin,ref:i=>this.labelEl=i,elementBounds:this.elementBounds,pinController:this.pinController,onPointerDown:()=>this.selectPin()})))}setLabelObserver(){if(this.labelEl!=null){this.labelEl.addEventListener("labelChanged",this.invalidateState);this.resizeObserver=new ResizeObserver((()=>this.invalidateState()));this.resizeObserver.observe(this.labelEl)}}computePinPoints(i){if(this.elementBounds!=null&&this.pin!=null){return d(this.pin)&&this.pin.label.point!=null?this.computeTextPinPoints(this.pin,this.elementBounds):this.computeDefaultPinPoints(this.pin,this.elementBounds)}return{pinPoint:i.worldPosition}}computeDefaultPinPoints(i,t){return{pinPoint:this.getFromWorldPosition(i.worldPosition,this.projectionViewMatrix,t)}}computeTextPinPoints(i,t){var n,e,o,s;const{pinPoint:r}=this.computeDefaultPinPoints(i,t);const a=c(i.label.point,t);const l=((e=(n=this.labelEl)===null||n===void 0?void 0:n.firstElementChild)===null||e===void 0?void 0:e.clientWidth)||0;const d=((s=(o=this.labelEl)===null||o===void 0?void 0:o.firstElementChild)===null||s===void 0?void 0:s.clientHeight)||0;return{pinPoint:r,labelPoint:w(a,r,{width:l,height:d})}}handleAnchorPointerDown(){var i,t;if(this.elementBounds!=null&&((i=this.pinController)===null||i===void 0?void 0:i.getToolMode())==="edit"&&this.pin!=null){(t=this.pinController)===null||t===void 0?void 0:t.setDraggable({id:this.pin.id})}}selectPin(){var i,t;(i=this.pinController)===null||i===void 0?void 0:i.setSelectedPinId((t=this.pin)===null||t===void 0?void 0:t.id)}getFromWorldPosition(i,t,n){const e=s.transformMatrix(i,t);return r.fromDimensions(n).transformVectorToViewport(e)}};b.style=m;export{b as vertex_viewer_pin_group};
|
|
5
|
+
//# sourceMappingURL=p-18ce3f3b.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["src/components/viewer-pin-group/pin-renderer.tsx","src/components/viewer-pin-group/utils.ts","src/components/viewer-pin-group/viewer-pin-group.css?tag=vertex-viewer-pin-group","src/components/viewer-pin-group/viewer-pin-group.tsx"],"names":["PinRenderer","pin","selected","occluded","detached","primaryColor","getPinColors","h","Fragment","isTextPin","id","class","classNames","pin-occluded","pin-detached","style","background","isIconPin","name","size","pin-selected","color","getClosestCenterToPoint","boxPoint","pointToMeasure","dimensions","topPoint","x","width","y","bottomPoint","height","rightPoint","leftPoint","candidates","distances","map","candidate","Point","distance","candidateIndex","indexOf","Math","min","viewerPinGroupCss","ViewerPinGroup","[object Object]","hostRef","this","matrix","Matrix4","makeIdentity","projectionViewMatrix","pinModel","PinModel","invalidateStateCounter","invalidateState","setLabelObserver","pinController","PinController","_a","labelEl","setFocus","event","detail","removeEventListener","_b","resizeObserver","disconnect","Error","pinPoint","labelPoint","computePinPoints","data-testid","position","worldPosition","onPointerDown","async","submit","selectPin","handleAnchorPointerDown","detachedOff","ref","el","elementBounds","addEventListener","ResizeObserver","observe","label","point","computeTextPinPoints","computeDefaultPinPoints","getFromWorldPosition","screenPosition","translatePointToScreen","labelWidth","firstElementChild","clientWidth","labelHeight","_d","_c","clientHeight","getToolMode","setDraggable","setSelectedPinId","pt","ndcPt","Vector3","transformMatrix","Viewport","fromDimensions","transformVectorToViewport"],"mappings":"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","sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Fragment, FunctionalComponent, h } from '@stencil/core';\nimport classNames from 'classnames';\n\nimport { getPinColors, isIconPin, isTextPin, Pin } from '../../lib/pins/model';\n\ninterface PinRendererProps {\n pin?: Pin;\n selected: boolean;\n occluded: boolean;\n detached: boolean;\n}\n\nexport const PinRenderer: FunctionalComponent<PinRendererProps> = ({\n pin,\n selected,\n occluded,\n detached,\n}) => {\n const { primaryColor } = getPinColors(pin);\n\n return (\n <Fragment>\n {isTextPin(pin) && (\n <div\n id=\"pin-anchor\"\n class={classNames('pin-anchor', {\n selected: selected,\n 'pin-occluded': occluded,\n 'pin-detached': detached,\n })}\n style={{\n background: primaryColor,\n }}\n ></div>\n )}\n\n {isIconPin(pin) && (\n <vertex-viewer-icon\n name=\"pin-fill\"\n size=\"lg\"\n class={classNames('pin', {\n 'pin-selected': selected,\n 'pin-occluded': occluded,\n 'pin-detached': detached,\n })}\n style={{\n color: primaryColor,\n }}\n />\n )}\n </Fragment>\n );\n};\n","import { Dimensions, Point } from '@vertexvis/geometry';\n\nexport function getClosestCenterToPoint(\n boxPoint: Point.Point,\n pointToMeasure: Point.Point,\n dimensions: Dimensions.Dimensions\n): Point.Point {\n const topPoint = {\n x: boxPoint.x + dimensions.width / 2,\n y: boxPoint.y,\n };\n\n const bottomPoint = {\n x: boxPoint.x + dimensions.width / 2,\n y: boxPoint.y + dimensions.height,\n };\n\n const rightPoint = {\n x: boxPoint.x + dimensions.width,\n y: boxPoint.y + dimensions.height / 2,\n };\n\n const leftPoint = {\n x: boxPoint.x,\n y: boxPoint.y + dimensions.height / 2,\n };\n\n const candidates = [topPoint, bottomPoint, leftPoint, rightPoint];\n\n const distances = candidates.map((candidate) =>\n Point.distance(candidate, pointToMeasure)\n );\n\n const candidateIndex = distances.indexOf(Math.min(...distances));\n return candidates[candidateIndex];\n}\n",":host {\n\n /**\n * @prop --viewer-annotations-pin-primary-color: A CSS color that\n * specifies the primary color for the pins. This value gets used for the dot color \n * and borders\n */\n --viewer-annotations-pin-primary-color: var(--blue-700);\n\n /**\n * @prop --viewer-annotations-pin-accent-color: A CSS color that\n * specifies the accent color for the pins. This value gets used for background colors\n * \n */\n\n --viewer-annotations-pin-accent-color: var(--blue-200);\n /**\n * @prop viewer-annotations-pin-dot-color: A CSS color that\n * specifies the color of the anchor dot\n */\n --viewer-annotations-pin-dot-color: var(--viewer-annotations-pin-primary-color);\n\n /**\n * @prop --viewer-annotations-pin-color: A CSS color that\n * specifies the color of the pin\n */\n --viewer-annotations-pin-color: var(--viewer-annotations-pin-primary-color);\n\n /**\n * @prop --viewer-annotations-pin-font-size: A CSS property to specify\n the font size of the pin\n */\n --viewer-annotations-pin-font-size: 0.75rem;\n\n /**\n * @prop --viewer-annotations-pin-selected-stroke: A CSS color that\n * specifies the stroke color of a selected pin\n */\n --viewer-annotations-pin-selected-stroke: var(--white);\n\n /**\n * @prop --viewer-annotations-pin-selected-border: A CSS color that\n * specifies the border of a selected pin\n */\n --viewer-annotations-pin-selected-border: 2px solid var(--white);\n\n /**\n * @prop --viewer-annotations-pin-label-border: A CSS color that\n * specifies the border of a text pin anchor\n */\n --viewer-annotations-pin-label-border: 2px solid var(--black);\n\n /**\n * @prop --viewer-annotations-pin-selected-border: A CSS color that\n * specifies the stroke of a selected default pin\n */\n --viewer-annotations-pin-selected-stroke: var(--white);\n\n font-size: var(--viewer-annotations-pin-font-size);\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.pin-anchor {\n position: absolute;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n display: block;\n width: 9px;\n height: 9px;\n box-sizing: border-box;\n border: var(--viewer-annotations-pin-label-border);\n background: var(--viewer-annotations-pin-dot-color);\n pointer-events: auto;\n cursor: pointer;\n}\n\n.selected {\n width: 13px;\n height: 13px;\n border: var(--viewer-annotations-pin-selected-border)\n}\n\n.pin {\n color: var(--viewer-annotations-pin-color);\n cursor: pointer;\n transition: opacity 0.3s ease-in;\n}\n\n.pin-selected {\n stroke-width: 1;\n stroke: var(--viewer-annotations-pin-selected-stroke);\n}\n\n.pin-occluded {\n opacity: .3;\n transition: opacity 0.3s ease-in;\n}\n\n.pin-detached {\n visibility: hidden;\n}","import {\n Component,\n Fragment,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n h,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { Dimensions, Matrix4, Point, Vector3 } from '@vertexvis/geometry';\n\nimport { Viewport } from '../..';\nimport { PinController } from '../../lib/pins/controller';\nimport { isTextPin, Pin, TextPin } from '../../lib/pins/model';\nimport { PinModel } from '../../lib/pins/model';\nimport { translatePointToScreen } from '../viewer-pin-tool/utils';\nimport { PinRenderer } from './pin-renderer';\nimport { getClosestCenterToPoint } from './utils';\n\ninterface ComputedPoints {\n pinPoint: Point.Point;\n labelPoint?: Point.Point;\n}\n\n@Component({\n tag: 'vertex-viewer-pin-group',\n styleUrl: 'viewer-pin-group.css',\n shadow: false,\n})\nexport class ViewerPinGroup {\n /**\n * The pin to draw for the group\n */\n @Prop()\n public pin?: Pin;\n\n /**\n * The local matrix of this element.\n */\n @Prop({ mutable: true, attribute: null })\n public matrix: Matrix4.Matrix4 = Matrix4.makeIdentity();\n\n /**\n * Projection view matrix used for computing the position of the pin line\n */\n @Prop()\n public projectionViewMatrix: Matrix4.Matrix4 = Matrix4.makeIdentity();\n\n /**\n * The dimensions of the canvas for the pins\n */\n @Prop({ mutable: true })\n public elementBounds?: DOMRect;\n\n /**\n * The model that contains the entities and outcomes from performing pin operations\n */\n @Prop()\n public pinModel: PinModel = new PinModel();\n\n /**\n * The controller that drives behavior for pin operations\n */\n @Prop()\n public pinController?: PinController;\n\n /**\n * Whether the pin is \"selected\"\n */\n @Prop()\n public selected = false;\n\n /**\n * @internal\n * Whether the pin is occluded\n */\n @Prop({ mutable: true, reflect: true })\n public occluded = false;\n\n /**\n * @internal\n * Whether the pin is detached\n */\n @Prop({ mutable: true, reflect: true })\n public detached = false;\n\n @State()\n private invalidateStateCounter = 0;\n\n private labelEl: HTMLVertexViewerPinLabelElement | undefined;\n\n private resizeObserver?: ResizeObserver;\n\n protected componentDidLoad(): void {\n this.setLabelObserver();\n\n if (this.pinController == null) {\n this.pinController = new PinController(this.pinModel);\n }\n\n if (this.selected) {\n this.labelEl?.setFocus();\n }\n }\n\n /**\n * @ignore\n */\n @Listen('occlusionStateChanged')\n protected async handleOcclusionStateChanged(\n event: CustomEvent<boolean>\n ): Promise<void> {\n this.occluded = event.detail;\n }\n\n /**\n * @ignore\n */\n @Listen('detachedStateChanged')\n protected async handleDetachedStateChanged(\n event: CustomEvent<boolean>\n ): Promise<void> {\n this.detached = event.detail;\n }\n\n protected disconnectedCallback(): void {\n this.labelEl?.removeEventListener('labelChanged', this.invalidateState);\n this.resizeObserver?.disconnect();\n }\n\n protected render(): JSX.Element {\n if (this.pin == null) {\n throw new Error('Unable to draw pin');\n }\n\n const { pinPoint, labelPoint } = this.computePinPoints(this.pin);\n\n return (\n <Fragment>\n <vertex-viewer-dom-element\n data-testid={`drawn-pin-${this.pin.id}`}\n position={this.pin.worldPosition}\n onPointerDown={async () => {\n await this.labelEl?.submit();\n this.selectPin();\n this.handleAnchorPointerDown();\n }}\n detachedOff={false}\n >\n <PinRenderer\n pin={this.pin}\n selected={this.selected}\n occluded={this.occluded}\n detached={this.detached}\n />\n </vertex-viewer-dom-element>\n\n {isTextPin(this.pin) && !this.occluded && !this.detached && (\n <Fragment>\n <vertex-viewer-pin-label-line\n id={`pin-label-line-${this.pin?.id}`}\n pinPoint={pinPoint}\n pin={this.pin}\n labelPoint={labelPoint}\n onPointerDown={() => this.selectPin()}\n ></vertex-viewer-pin-label-line>\n\n <vertex-viewer-pin-label\n pin={this.pin}\n ref={(el) => (this.labelEl = el)}\n elementBounds={this.elementBounds}\n pinController={this.pinController}\n onPointerDown={() => this.selectPin()}\n ></vertex-viewer-pin-label>\n </Fragment>\n )}\n </Fragment>\n );\n }\n\n private invalidateState = (): void => {\n this.invalidateStateCounter = this.invalidateStateCounter + 1;\n };\n\n private setLabelObserver(): void {\n if (this.labelEl != null) {\n this.labelEl.addEventListener('labelChanged', this.invalidateState);\n\n this.resizeObserver = new ResizeObserver(() => this.invalidateState());\n this.resizeObserver.observe(this.labelEl);\n }\n }\n\n private computePinPoints(pin: Pin): ComputedPoints {\n if (this.elementBounds != null && this.pin != null) {\n return isTextPin(this.pin) && this.pin.label.point != null\n ? this.computeTextPinPoints(this.pin, this.elementBounds)\n : this.computeDefaultPinPoints(this.pin, this.elementBounds);\n }\n\n return { pinPoint: pin.worldPosition };\n }\n\n private computeDefaultPinPoints(\n pin: Pin,\n elementBounds: DOMRect\n ): ComputedPoints {\n return {\n pinPoint: this.getFromWorldPosition(\n pin.worldPosition,\n this.projectionViewMatrix,\n elementBounds\n ),\n };\n }\n\n private computeTextPinPoints(\n pin: TextPin,\n elementBounds: DOMRect\n ): ComputedPoints {\n const { pinPoint } = this.computeDefaultPinPoints(pin, elementBounds);\n\n const screenPosition = translatePointToScreen(\n pin.label.point,\n elementBounds\n );\n\n const labelWidth = this.labelEl?.firstElementChild?.clientWidth || 0;\n const labelHeight = this.labelEl?.firstElementChild?.clientHeight || 0;\n\n return {\n pinPoint,\n labelPoint: getClosestCenterToPoint(screenPosition, pinPoint, {\n width: labelWidth,\n height: labelHeight,\n }),\n };\n }\n\n private handleAnchorPointerDown(): void {\n if (\n this.elementBounds != null &&\n this.pinController?.getToolMode() === 'edit' &&\n this.pin != null\n ) {\n this.pinController?.setDraggable({ id: this.pin.id });\n }\n }\n\n private selectPin(): void {\n this.pinController?.setSelectedPinId(this.pin?.id);\n }\n\n private getFromWorldPosition(\n pt: Vector3.Vector3,\n projectionViewMatrix: Matrix4.Matrix4,\n dimensions: Dimensions.Dimensions\n ): Point.Point {\n const ndcPt = Vector3.transformMatrix(pt, projectionViewMatrix);\n return Viewport.fromDimensions(dimensions).transformVectorToViewport(ndcPt);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["src/components/viewer-pin-group/pin-renderer.tsx","src/components/viewer-pin-group/utils.ts","src/components/viewer-pin-group/viewer-pin-group.css?tag=vertex-viewer-pin-group","src/components/viewer-pin-group/viewer-pin-group.tsx"],"names":["PinRenderer","pin","selected","occluded","detached","primaryColor","getPinColors","h","Fragment","isTextPin","id","class","classNames","pin-occluded","pin-detached","style","background","isIconPin","name","size","pin-selected","color","getClosestCenterToPoint","boxPoint","pointToMeasure","dimensions","topPoint","x","width","y","bottomPoint","height","rightPoint","leftPoint","candidates","distances","map","candidate","Point","distance","candidateIndex","indexOf","Math","min","viewerPinGroupCss","ViewerPinGroup","[object Object]","hostRef","this","matrix","Matrix4","makeIdentity","projectionViewMatrix","pinModel","PinModel","invalidateStateCounter","invalidateState","setLabelObserver","pinController","PinController","_a","labelEl","setFocus","event","detail","removeEventListener","_b","resizeObserver","disconnect","Error","pinPoint","labelPoint","computePinPoints","data-testid","position","worldPosition","onPointerDown","async","submit","selectPin","handleAnchorPointerDown","detachedOff","ref","el","elementBounds","addEventListener","ResizeObserver","observe","label","point","computeTextPinPoints","computeDefaultPinPoints","getFromWorldPosition","screenPosition","translatePointToScreen","labelWidth","firstElementChild","clientWidth","labelHeight","_d","_c","clientHeight","getToolMode","setDraggable","setSelectedPinId","pt","ndcPt","Vector3","transformMatrix","Viewport","fromDimensions","transformVectorToViewport"],"mappings":"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","sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Fragment, FunctionalComponent, h } from '@stencil/core';\nimport classNames from 'classnames';\n\nimport { getPinColors, isIconPin, isTextPin, Pin } from '../../lib/pins/model';\n\ninterface PinRendererProps {\n pin?: Pin;\n selected: boolean;\n occluded: boolean;\n detached: boolean;\n}\n\nexport const PinRenderer: FunctionalComponent<PinRendererProps> = ({\n pin,\n selected,\n occluded,\n detached,\n}) => {\n const { primaryColor } = getPinColors(pin);\n\n return (\n <Fragment>\n {isTextPin(pin) && (\n <div\n id=\"pin-anchor\"\n class={classNames('pin-anchor', {\n selected: selected,\n 'pin-occluded': occluded,\n 'pin-detached': detached,\n })}\n style={{\n background: primaryColor,\n }}\n ></div>\n )}\n\n {isIconPin(pin) && (\n <vertex-viewer-icon\n name=\"pin-fill\"\n size=\"lg\"\n class={classNames('pin', {\n 'pin-selected': selected,\n 'pin-occluded': occluded,\n 'pin-detached': detached,\n })}\n style={{\n color: primaryColor,\n }}\n />\n )}\n </Fragment>\n );\n};\n","import { Dimensions, Point } from '@vertexvis/geometry';\n\nexport function getClosestCenterToPoint(\n boxPoint: Point.Point,\n pointToMeasure: Point.Point,\n dimensions: Dimensions.Dimensions\n): Point.Point {\n const topPoint = {\n x: boxPoint.x + dimensions.width / 2,\n y: boxPoint.y,\n };\n\n const bottomPoint = {\n x: boxPoint.x + dimensions.width / 2,\n y: boxPoint.y + dimensions.height,\n };\n\n const rightPoint = {\n x: boxPoint.x + dimensions.width,\n y: boxPoint.y + dimensions.height / 2,\n };\n\n const leftPoint = {\n x: boxPoint.x,\n y: boxPoint.y + dimensions.height / 2,\n };\n\n const candidates = [topPoint, bottomPoint, leftPoint, rightPoint];\n\n const distances = candidates.map((candidate) =>\n Point.distance(candidate, pointToMeasure)\n );\n\n const candidateIndex = distances.indexOf(Math.min(...distances));\n return candidates[candidateIndex];\n}\n",":host {\n\n /**\n * @prop --viewer-annotations-pin-primary-color: A CSS color that\n * specifies the primary color for the pins. This value gets used for the dot color \n * and borders\n */\n --viewer-annotations-pin-primary-color: var(--blue-700);\n\n /**\n * @prop --viewer-annotations-pin-accent-color: A CSS color that\n * specifies the accent color for the pins. This value gets used for background colors\n * \n */\n\n --viewer-annotations-pin-accent-color: var(--blue-200);\n /**\n * @prop viewer-annotations-pin-dot-color: A CSS color that\n * specifies the color of the anchor dot\n */\n --viewer-annotations-pin-dot-color: var(--viewer-annotations-pin-primary-color);\n\n /**\n * @prop --viewer-annotations-pin-color: A CSS color that\n * specifies the color of the pin\n */\n --viewer-annotations-pin-color: var(--viewer-annotations-pin-primary-color);\n\n /**\n * @prop --viewer-annotations-pin-font-size: A CSS property to specify\n the font size of the pin\n */\n --viewer-annotations-pin-font-size: 0.75rem;\n\n /**\n * @prop --viewer-annotations-pin-selected-stroke: A CSS color that\n * specifies the stroke color of a selected pin\n */\n --viewer-annotations-pin-selected-stroke: var(--white);\n\n /**\n * @prop --viewer-annotations-pin-selected-border: A CSS color that\n * specifies the border of a selected pin\n */\n --viewer-annotations-pin-selected-border: 2px solid var(--white);\n\n /**\n * @prop --viewer-annotations-pin-label-border: A CSS color that\n * specifies the border of a text pin anchor\n */\n --viewer-annotations-pin-label-border: 2px solid var(--black);\n\n /**\n * @prop --viewer-annotations-pin-selected-border: A CSS color that\n * specifies the stroke of a selected default pin\n */\n --viewer-annotations-pin-selected-stroke: var(--white);\n\n font-size: var(--viewer-annotations-pin-font-size);\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.pin-anchor {\n position: absolute;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n display: block;\n width: 9px;\n height: 9px;\n box-sizing: border-box;\n border: var(--viewer-annotations-pin-label-border);\n background: var(--viewer-annotations-pin-dot-color);\n pointer-events: auto;\n cursor: pointer;\n}\n\n.selected {\n width: 13px;\n height: 13px;\n border: var(--viewer-annotations-pin-selected-border)\n}\n\n.pin {\n color: var(--viewer-annotations-pin-color);\n cursor: pointer;\n transition: opacity 0.3s ease-in;\n\n /**\n * Place bottom point of the pin at the location instead of the middle of the pin\n */\n transform: translate(0px, -12px);\n}\n\n.pin-selected {\n stroke-width: 1;\n stroke: var(--viewer-annotations-pin-selected-stroke);\n}\n\n.pin-occluded {\n opacity: .3;\n transition: opacity 0.3s ease-in;\n}\n\n.pin-detached {\n visibility: hidden;\n}","import {\n Component,\n Fragment,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n h,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { Dimensions, Matrix4, Point, Vector3 } from '@vertexvis/geometry';\n\nimport { Viewport } from '../..';\nimport { PinController } from '../../lib/pins/controller';\nimport { isTextPin, Pin, TextPin } from '../../lib/pins/model';\nimport { PinModel } from '../../lib/pins/model';\nimport { translatePointToScreen } from '../viewer-pin-tool/utils';\nimport { PinRenderer } from './pin-renderer';\nimport { getClosestCenterToPoint } from './utils';\n\ninterface ComputedPoints {\n pinPoint: Point.Point;\n labelPoint?: Point.Point;\n}\n\n@Component({\n tag: 'vertex-viewer-pin-group',\n styleUrl: 'viewer-pin-group.css',\n shadow: false,\n})\nexport class ViewerPinGroup {\n /**\n * The pin to draw for the group\n */\n @Prop()\n public pin?: Pin;\n\n /**\n * The local matrix of this element.\n */\n @Prop({ mutable: true, attribute: null })\n public matrix: Matrix4.Matrix4 = Matrix4.makeIdentity();\n\n /**\n * Projection view matrix used for computing the position of the pin line\n */\n @Prop()\n public projectionViewMatrix: Matrix4.Matrix4 = Matrix4.makeIdentity();\n\n /**\n * The dimensions of the canvas for the pins\n */\n @Prop({ mutable: true })\n public elementBounds?: DOMRect;\n\n /**\n * The model that contains the entities and outcomes from performing pin operations\n */\n @Prop()\n public pinModel: PinModel = new PinModel();\n\n /**\n * The controller that drives behavior for pin operations\n */\n @Prop()\n public pinController?: PinController;\n\n /**\n * Whether the pin is \"selected\"\n */\n @Prop()\n public selected = false;\n\n /**\n * @internal\n * Whether the pin is occluded\n */\n @Prop({ mutable: true, reflect: true })\n public occluded = false;\n\n /**\n * @internal\n * Whether the pin is detached\n */\n @Prop({ mutable: true, reflect: true })\n public detached = false;\n\n @State()\n private invalidateStateCounter = 0;\n\n private labelEl: HTMLVertexViewerPinLabelElement | undefined;\n\n private resizeObserver?: ResizeObserver;\n\n protected componentDidLoad(): void {\n this.setLabelObserver();\n\n if (this.pinController == null) {\n this.pinController = new PinController(this.pinModel);\n }\n\n if (this.selected) {\n this.labelEl?.setFocus();\n }\n }\n\n /**\n * @ignore\n */\n @Listen('occlusionStateChanged')\n protected async handleOcclusionStateChanged(\n event: CustomEvent<boolean>\n ): Promise<void> {\n this.occluded = event.detail;\n }\n\n /**\n * @ignore\n */\n @Listen('detachedStateChanged')\n protected async handleDetachedStateChanged(\n event: CustomEvent<boolean>\n ): Promise<void> {\n this.detached = event.detail;\n }\n\n protected disconnectedCallback(): void {\n this.labelEl?.removeEventListener('labelChanged', this.invalidateState);\n this.resizeObserver?.disconnect();\n }\n\n protected render(): JSX.Element {\n if (this.pin == null) {\n throw new Error('Unable to draw pin');\n }\n\n const { pinPoint, labelPoint } = this.computePinPoints(this.pin);\n\n return (\n <Fragment>\n <vertex-viewer-dom-element\n data-testid={`drawn-pin-${this.pin.id}`}\n position={this.pin.worldPosition}\n onPointerDown={async () => {\n await this.labelEl?.submit();\n this.selectPin();\n this.handleAnchorPointerDown();\n }}\n detachedOff={false}\n >\n <PinRenderer\n pin={this.pin}\n selected={this.selected}\n occluded={this.occluded}\n detached={this.detached}\n />\n </vertex-viewer-dom-element>\n\n {isTextPin(this.pin) && !this.occluded && !this.detached && (\n <Fragment>\n <vertex-viewer-pin-label-line\n id={`pin-label-line-${this.pin?.id}`}\n pinPoint={pinPoint}\n pin={this.pin}\n labelPoint={labelPoint}\n onPointerDown={() => this.selectPin()}\n ></vertex-viewer-pin-label-line>\n\n <vertex-viewer-pin-label\n pin={this.pin}\n ref={(el) => (this.labelEl = el)}\n elementBounds={this.elementBounds}\n pinController={this.pinController}\n onPointerDown={() => this.selectPin()}\n ></vertex-viewer-pin-label>\n </Fragment>\n )}\n </Fragment>\n );\n }\n\n private invalidateState = (): void => {\n this.invalidateStateCounter = this.invalidateStateCounter + 1;\n };\n\n private setLabelObserver(): void {\n if (this.labelEl != null) {\n this.labelEl.addEventListener('labelChanged', this.invalidateState);\n\n this.resizeObserver = new ResizeObserver(() => this.invalidateState());\n this.resizeObserver.observe(this.labelEl);\n }\n }\n\n private computePinPoints(pin: Pin): ComputedPoints {\n if (this.elementBounds != null && this.pin != null) {\n return isTextPin(this.pin) && this.pin.label.point != null\n ? this.computeTextPinPoints(this.pin, this.elementBounds)\n : this.computeDefaultPinPoints(this.pin, this.elementBounds);\n }\n\n return { pinPoint: pin.worldPosition };\n }\n\n private computeDefaultPinPoints(\n pin: Pin,\n elementBounds: DOMRect\n ): ComputedPoints {\n return {\n pinPoint: this.getFromWorldPosition(\n pin.worldPosition,\n this.projectionViewMatrix,\n elementBounds\n ),\n };\n }\n\n private computeTextPinPoints(\n pin: TextPin,\n elementBounds: DOMRect\n ): ComputedPoints {\n const { pinPoint } = this.computeDefaultPinPoints(pin, elementBounds);\n\n const screenPosition = translatePointToScreen(\n pin.label.point,\n elementBounds\n );\n\n const labelWidth = this.labelEl?.firstElementChild?.clientWidth || 0;\n const labelHeight = this.labelEl?.firstElementChild?.clientHeight || 0;\n\n return {\n pinPoint,\n labelPoint: getClosestCenterToPoint(screenPosition, pinPoint, {\n width: labelWidth,\n height: labelHeight,\n }),\n };\n }\n\n private handleAnchorPointerDown(): void {\n if (\n this.elementBounds != null &&\n this.pinController?.getToolMode() === 'edit' &&\n this.pin != null\n ) {\n this.pinController?.setDraggable({ id: this.pin.id });\n }\n }\n\n private selectPin(): void {\n this.pinController?.setSelectedPinId(this.pin?.id);\n }\n\n private getFromWorldPosition(\n pt: Vector3.Vector3,\n projectionViewMatrix: Matrix4.Matrix4,\n dimensions: Dimensions.Dimensions\n ): Point.Point {\n const ndcPt = Vector3.transformMatrix(pt, projectionViewMatrix);\n return Viewport.fromDimensions(dimensions).transformVectorToViewport(ndcPt);\n }\n}\n"]}
|