@vertexvis/viewer 0.18.2-testing.0 → 0.18.2-testing.1
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/dist/cjs/index-b99cd335.js +126 -1
- package/dist/esm/index-fd7d7b68.js +126 -1
- package/package.json +7 -7
- package/dist/components/_commonjsHelpers.js +0 -41
- package/dist/components/_commonjsHelpers.js.map +0 -1
- package/dist/components/browser.esm.js +0 -3173
- package/dist/components/browser.esm.js.map +0 -1
- package/dist/components/bundle.esm.js +0 -2250
- package/dist/components/bundle.esm.js.map +0 -1
- package/dist/components/bundle.esm2.js +0 -39740
- package/dist/components/bundle.esm2.js.map +0 -1
- package/dist/components/config.js +0 -81
- package/dist/components/config.js.map +0 -1
- package/dist/components/controller.js +0 -7627
- package/dist/components/controller.js.map +0 -1
- package/dist/components/controller2.js +0 -124
- package/dist/components/controller2.js.map +0 -1
- package/dist/components/controller3.js +0 -111
- package/dist/components/controller3.js.map +0 -1
- package/dist/components/cursors.js +0 -110
- package/dist/components/cursors.js.map +0 -1
- package/dist/components/dom.js +0 -43
- package/dist/components/dom.js.map +0 -1
- package/dist/components/dom2.js +0 -10
- package/dist/components/dom2.js.map +0 -1
- package/dist/components/elementRectObserver.js +0 -25
- package/dist/components/elementRectObserver.js.map +0 -1
- package/dist/components/entities.js +0 -179
- package/dist/components/entities.js.map +0 -1
- package/dist/components/errors.js +0 -80
- package/dist/components/errors.js.map +0 -1
- package/dist/components/events.js +0 -11
- package/dist/components/events.js.map +0 -1
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -365
- package/dist/components/index.js.map +0 -1
- package/dist/components/index2.js +0 -63
- package/dist/components/index2.js.map +0 -1
- package/dist/components/interactions.js +0 -236
- package/dist/components/interactions.js.map +0 -1
- package/dist/components/mapper.js +0 -9811
- package/dist/components/mapper.js.map +0 -1
- package/dist/components/markup.js +0 -33
- package/dist/components/markup.js.map +0 -1
- package/dist/components/model.js +0 -134
- package/dist/components/model.js.map +0 -1
- package/dist/components/model2.js +0 -157
- package/dist/components/model2.js.map +0 -1
- package/dist/components/overlays.js +0 -76
- package/dist/components/overlays.js.map +0 -1
- package/dist/components/png-decoder.js +0 -2405
- package/dist/components/png-decoder.js.map +0 -1
- package/dist/components/regl-component.js +0 -12582
- package/dist/components/regl-component.js.map +0 -1
- package/dist/components/results.js +0 -24
- package/dist/components/results.js.map +0 -1
- package/dist/components/row.js +0 -32
- package/dist/components/row.js.map +0 -1
- package/dist/components/scene-tree-search.js +0 -146
- package/dist/components/scene-tree-search.js.map +0 -1
- package/dist/components/scene-tree-table-layout.js +0 -928
- package/dist/components/scene-tree-table-layout.js.map +0 -1
- package/dist/components/scene-tree-toolbar.js +0 -35
- package/dist/components/scene-tree-toolbar.js.map +0 -1
- package/dist/components/scene.js +0 -1508
- package/dist/components/scene.js.map +0 -1
- package/dist/components/stencil.js +0 -25
- package/dist/components/stencil.js.map +0 -1
- package/dist/components/streamAttributes.js +0 -40833
- package/dist/components/streamAttributes.js.map +0 -1
- package/dist/components/templates.js +0 -36
- package/dist/components/templates.js.map +0 -1
- package/dist/components/tslib.es6.js +0 -125
- package/dist/components/tslib.es6.js.map +0 -1
- package/dist/components/vertex-scene-tree-search.d.ts +0 -11
- package/dist/components/vertex-scene-tree-search.js +0 -11
- package/dist/components/vertex-scene-tree-search.js.map +0 -1
- package/dist/components/vertex-scene-tree-table-cell.d.ts +0 -11
- package/dist/components/vertex-scene-tree-table-cell.js +0 -209
- package/dist/components/vertex-scene-tree-table-cell.js.map +0 -1
- package/dist/components/vertex-scene-tree-table-column.d.ts +0 -11
- package/dist/components/vertex-scene-tree-table-column.js +0 -42
- package/dist/components/vertex-scene-tree-table-column.js.map +0 -1
- package/dist/components/vertex-scene-tree-table-header.d.ts +0 -11
- package/dist/components/vertex-scene-tree-table-header.js +0 -38
- package/dist/components/vertex-scene-tree-table-header.js.map +0 -1
- package/dist/components/vertex-scene-tree-table-layout.d.ts +0 -11
- package/dist/components/vertex-scene-tree-table-layout.js +0 -11
- package/dist/components/vertex-scene-tree-table-layout.js.map +0 -1
- package/dist/components/vertex-scene-tree-table-resize-divider.d.ts +0 -11
- package/dist/components/vertex-scene-tree-table-resize-divider.js +0 -57
- package/dist/components/vertex-scene-tree-table-resize-divider.js.map +0 -1
- package/dist/components/vertex-scene-tree-toolbar-group.d.ts +0 -11
- package/dist/components/vertex-scene-tree-toolbar-group.js +0 -38
- package/dist/components/vertex-scene-tree-toolbar-group.js.map +0 -1
- package/dist/components/vertex-scene-tree-toolbar.d.ts +0 -11
- package/dist/components/vertex-scene-tree-toolbar.js +0 -11
- package/dist/components/vertex-scene-tree-toolbar.js.map +0 -1
- package/dist/components/vertex-scene-tree.d.ts +0 -11
- package/dist/components/vertex-scene-tree.js +0 -803
- package/dist/components/vertex-scene-tree.js.map +0 -1
- package/dist/components/vertex-viewer-box-query-tool.d.ts +0 -11
- package/dist/components/vertex-viewer-box-query-tool.js +0 -352
- package/dist/components/vertex-viewer-box-query-tool.js.map +0 -1
- package/dist/components/vertex-viewer-button.d.ts +0 -11
- package/dist/components/vertex-viewer-button.js +0 -11
- package/dist/components/vertex-viewer-button.js.map +0 -1
- package/dist/components/vertex-viewer-default-toolbar.d.ts +0 -11
- package/dist/components/vertex-viewer-default-toolbar.js +0 -99
- package/dist/components/vertex-viewer-default-toolbar.js.map +0 -1
- package/dist/components/vertex-viewer-dom-element.d.ts +0 -11
- package/dist/components/vertex-viewer-dom-element.js +0 -11
- package/dist/components/vertex-viewer-dom-element.js.map +0 -1
- package/dist/components/vertex-viewer-dom-group.d.ts +0 -11
- package/dist/components/vertex-viewer-dom-group.js +0 -11
- package/dist/components/vertex-viewer-dom-group.js.map +0 -1
- package/dist/components/vertex-viewer-dom-renderer.d.ts +0 -11
- package/dist/components/vertex-viewer-dom-renderer.js +0 -11
- package/dist/components/vertex-viewer-dom-renderer.js.map +0 -1
- package/dist/components/vertex-viewer-hit-result-indicator.d.ts +0 -11
- package/dist/components/vertex-viewer-hit-result-indicator.js +0 -335
- package/dist/components/vertex-viewer-hit-result-indicator.js.map +0 -1
- package/dist/components/vertex-viewer-icon.d.ts +0 -11
- package/dist/components/vertex-viewer-icon.js +0 -11
- package/dist/components/vertex-viewer-icon.js.map +0 -1
- package/dist/components/vertex-viewer-layer.d.ts +0 -11
- package/dist/components/vertex-viewer-layer.js +0 -11
- package/dist/components/vertex-viewer-layer.js.map +0 -1
- package/dist/components/vertex-viewer-markup-arrow.d.ts +0 -11
- package/dist/components/vertex-viewer-markup-arrow.js +0 -11
- package/dist/components/vertex-viewer-markup-arrow.js.map +0 -1
- package/dist/components/vertex-viewer-markup-circle.d.ts +0 -11
- package/dist/components/vertex-viewer-markup-circle.js +0 -11
- package/dist/components/vertex-viewer-markup-circle.js.map +0 -1
- package/dist/components/vertex-viewer-markup-freeform.d.ts +0 -11
- package/dist/components/vertex-viewer-markup-freeform.js +0 -11
- package/dist/components/vertex-viewer-markup-freeform.js.map +0 -1
- package/dist/components/vertex-viewer-markup-tool.d.ts +0 -11
- package/dist/components/vertex-viewer-markup-tool.js +0 -257
- package/dist/components/vertex-viewer-markup-tool.js.map +0 -1
- package/dist/components/vertex-viewer-markup.d.ts +0 -11
- package/dist/components/vertex-viewer-markup.js +0 -362
- package/dist/components/vertex-viewer-markup.js.map +0 -1
- package/dist/components/vertex-viewer-measurement-details.d.ts +0 -11
- package/dist/components/vertex-viewer-measurement-details.js +0 -307
- package/dist/components/vertex-viewer-measurement-details.js.map +0 -1
- package/dist/components/vertex-viewer-measurement-distance.d.ts +0 -11
- package/dist/components/vertex-viewer-measurement-distance.js +0 -1067
- package/dist/components/vertex-viewer-measurement-distance.js.map +0 -1
- package/dist/components/vertex-viewer-measurement-line.d.ts +0 -11
- package/dist/components/vertex-viewer-measurement-line.js +0 -11
- package/dist/components/vertex-viewer-measurement-line.js.map +0 -1
- package/dist/components/vertex-viewer-measurement-overlays.d.ts +0 -11
- package/dist/components/vertex-viewer-measurement-overlays.js +0 -11
- package/dist/components/vertex-viewer-measurement-overlays.js.map +0 -1
- package/dist/components/vertex-viewer-measurement-precise.d.ts +0 -11
- package/dist/components/vertex-viewer-measurement-precise.js +0 -362
- package/dist/components/vertex-viewer-measurement-precise.js.map +0 -1
- package/dist/components/vertex-viewer-pin-group.d.ts +0 -11
- package/dist/components/vertex-viewer-pin-group.js +0 -11
- package/dist/components/vertex-viewer-pin-group.js.map +0 -1
- package/dist/components/vertex-viewer-pin-label-line.d.ts +0 -11
- package/dist/components/vertex-viewer-pin-label-line.js +0 -11
- package/dist/components/vertex-viewer-pin-label-line.js.map +0 -1
- package/dist/components/vertex-viewer-pin-label.d.ts +0 -11
- package/dist/components/vertex-viewer-pin-label.js +0 -11
- package/dist/components/vertex-viewer-pin-label.js.map +0 -1
- package/dist/components/vertex-viewer-pin-tool.d.ts +0 -11
- package/dist/components/vertex-viewer-pin-tool.js +0 -430
- package/dist/components/vertex-viewer-pin-tool.js.map +0 -1
- package/dist/components/vertex-viewer-spinner.d.ts +0 -11
- package/dist/components/vertex-viewer-spinner.js +0 -11
- package/dist/components/vertex-viewer-spinner.js.map +0 -1
- package/dist/components/vertex-viewer-toolbar-group.d.ts +0 -11
- package/dist/components/vertex-viewer-toolbar-group.js +0 -11
- package/dist/components/vertex-viewer-toolbar-group.js.map +0 -1
- package/dist/components/vertex-viewer-toolbar.d.ts +0 -11
- package/dist/components/vertex-viewer-toolbar.js +0 -11
- package/dist/components/vertex-viewer-toolbar.js.map +0 -1
- package/dist/components/vertex-viewer-transform-widget.d.ts +0 -11
- package/dist/components/vertex-viewer-transform-widget.js +0 -838
- package/dist/components/vertex-viewer-transform-widget.js.map +0 -1
- package/dist/components/vertex-viewer-view-cube.d.ts +0 -11
- package/dist/components/vertex-viewer-view-cube.js +0 -270
- package/dist/components/vertex-viewer-view-cube.js.map +0 -1
- package/dist/components/vertex-viewer.d.ts +0 -11
- package/dist/components/vertex-viewer.js +0 -3543
- package/dist/components/vertex-viewer.js.map +0 -1
- package/dist/components/viewer-button.js +0 -35
- package/dist/components/viewer-button.js.map +0 -1
- package/dist/components/viewer-dom-element.js +0 -250
- package/dist/components/viewer-dom-element.js.map +0 -1
- package/dist/components/viewer-dom-group.js +0 -214
- package/dist/components/viewer-dom-group.js.map +0 -1
- package/dist/components/viewer-dom-renderer.js +0 -295
- package/dist/components/viewer-dom-renderer.js.map +0 -1
- package/dist/components/viewer-icon.js +0 -87
- package/dist/components/viewer-icon.js.map +0 -1
- package/dist/components/viewer-layer.js +0 -46
- package/dist/components/viewer-layer.js.map +0 -1
- package/dist/components/viewer-markup-arrow.js +0 -235
- package/dist/components/viewer-markup-arrow.js.map +0 -1
- package/dist/components/viewer-markup-circle-components.js +0 -42
- package/dist/components/viewer-markup-circle-components.js.map +0 -1
- package/dist/components/viewer-markup-circle.js +0 -201
- package/dist/components/viewer-markup-circle.js.map +0 -1
- package/dist/components/viewer-markup-freeform.js +0 -251
- package/dist/components/viewer-markup-freeform.js.map +0 -1
- package/dist/components/viewer-measurement-line.js +0 -77
- package/dist/components/viewer-measurement-line.js.map +0 -1
- package/dist/components/viewer-measurement-overlays.js +0 -184
- package/dist/components/viewer-measurement-overlays.js.map +0 -1
- package/dist/components/viewer-pin-group.js +0 -207
- package/dist/components/viewer-pin-group.js.map +0 -1
- package/dist/components/viewer-pin-label-line.js +0 -43
- package/dist/components/viewer-pin-label-line.js.map +0 -1
- package/dist/components/viewer-pin-label.js +0 -427
- package/dist/components/viewer-pin-label.js.map +0 -1
- package/dist/components/viewer-spinner.js +0 -53
- package/dist/components/viewer-spinner.js.map +0 -1
- package/dist/components/viewer-toolbar-group.js +0 -42
- package/dist/components/viewer-toolbar-group.js.map +0 -1
- package/dist/components/viewer-toolbar.js +0 -61
- package/dist/components/viewer-toolbar.js.map +0 -1
- package/dist/components/viewport.js +0 -188
- package/dist/components/viewport.js.map +0 -1
- package/dist/components/wrappers_pb.js +0 -1926
- package/dist/components/wrappers_pb.js.map +0 -1
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
5
|
-
import { d as defineCustomElement$6 } from './viewer-button.js';
|
|
6
|
-
import { d as defineCustomElement$5 } from './viewer-icon.js';
|
|
7
|
-
import { d as defineCustomElement$4 } from './viewer-layer.js';
|
|
8
|
-
import { d as defineCustomElement$3 } from './viewer-toolbar.js';
|
|
9
|
-
import { d as defineCustomElement$2 } from './viewer-toolbar-group.js';
|
|
10
|
-
|
|
11
|
-
const viewerDefaultToolbarCss = ":host{--viewer-toolbar-group-gap:0.5rem;--viewer-toolbar-group-background:rgba(245, 245, 245, 0.95);--viewer-toolbar-group-border-radius:0.25rem;--viewer-toolbar-group-box-shadow:-1px 0 2px rgba(0, 0, 0, 0.12),\n 1px 0 2px rgba(0, 0, 0, 0.13);--viewer-toolbar-group-padding:0.25rem;--viewer-toolbar-group-item-gap:0.25rem}.group{background:var(--viewer-toolbar-group-background);border-radius:var(--viewer-toolbar-group-border-radius);box-shadow:var(--viewer-toolbar-group-box-shadow);padding:var(--viewer-toolbar-group-padding)}.group[data-direction='horizontal']:not(:first-child){margin-left:var(--viewer-toolbar-group-gap)}.group[data-direction='horizontal'] .group-item:not(:first-child){margin-left:var(--viewer-toolbar-group-item-gap)}.group[data-direction='vertical']:not(:first-child){margin-top:var(--viewer-toolbar-group-gap)}.group[data-direction='vertical'] .group-item:not(:first-child){margin-top:var(--viewer-toolbar-group-item-gap)}.btn{color:var(--neutral-800);padding:0.125rem;border-radius:0.125rem}.btn:hover{background:var(--neutral-300)}";
|
|
12
|
-
|
|
13
|
-
const ViewerDefaultToolbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
this.__registerHost();
|
|
17
|
-
this.__attachShadow();
|
|
18
|
-
/**
|
|
19
|
-
* Specifies where the toolbar is positioned.
|
|
20
|
-
*/
|
|
21
|
-
this.placement = 'bottom-center';
|
|
22
|
-
/**
|
|
23
|
-
* Specifies the direction that UI elements are placed.
|
|
24
|
-
*/
|
|
25
|
-
this.direction = 'horizontal';
|
|
26
|
-
/**
|
|
27
|
-
* Indicates whether animations will be used when performing camera
|
|
28
|
-
* operations. Defaults to `true`.
|
|
29
|
-
*/
|
|
30
|
-
this.animationsDisabled = false;
|
|
31
|
-
/**
|
|
32
|
-
* The duration of animations, in milliseconds. Defaults to `1000`.
|
|
33
|
-
*/
|
|
34
|
-
this.animationMs = 1000;
|
|
35
|
-
}
|
|
36
|
-
render() {
|
|
37
|
-
return (h("vertex-viewer-toolbar", { placement: this.placement, direction: this.direction }, h("vertex-viewer-toolbar-group", { class: "group", direction: this.direction, "data-direction": this.direction }, h("vertex-viewer-button", { class: "group-item btn", "data-test-id": "fit-all-btn", onClick: () => this.viewAll() }, h("vertex-viewer-icon", { class: "icon", name: "fit-all", size: "md" })))));
|
|
38
|
-
}
|
|
39
|
-
async viewAll() {
|
|
40
|
-
var _a;
|
|
41
|
-
const scene = await ((_a = this.viewer) === null || _a === void 0 ? void 0 : _a.scene());
|
|
42
|
-
const animation = this.animationsDisabled
|
|
43
|
-
? undefined
|
|
44
|
-
: { milliseconds: this.animationMs };
|
|
45
|
-
scene === null || scene === void 0 ? void 0 : scene.camera().viewAll().render({ animation });
|
|
46
|
-
}
|
|
47
|
-
static get style() { return viewerDefaultToolbarCss; }
|
|
48
|
-
}, [1, "vertex-viewer-default-toolbar", {
|
|
49
|
-
"viewer": [16],
|
|
50
|
-
"placement": [1],
|
|
51
|
-
"direction": [1],
|
|
52
|
-
"animationsDisabled": [4, "animations-disabled"],
|
|
53
|
-
"animationMs": [2, "animation-ms"]
|
|
54
|
-
}]);
|
|
55
|
-
function defineCustomElement$1() {
|
|
56
|
-
if (typeof customElements === "undefined") {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const components = ["vertex-viewer-default-toolbar", "vertex-viewer-button", "vertex-viewer-icon", "vertex-viewer-layer", "vertex-viewer-toolbar", "vertex-viewer-toolbar-group"];
|
|
60
|
-
components.forEach(tagName => { switch (tagName) {
|
|
61
|
-
case "vertex-viewer-default-toolbar":
|
|
62
|
-
if (!customElements.get(tagName)) {
|
|
63
|
-
customElements.define(tagName, ViewerDefaultToolbar);
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
case "vertex-viewer-button":
|
|
67
|
-
if (!customElements.get(tagName)) {
|
|
68
|
-
defineCustomElement$6();
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
case "vertex-viewer-icon":
|
|
72
|
-
if (!customElements.get(tagName)) {
|
|
73
|
-
defineCustomElement$5();
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
case "vertex-viewer-layer":
|
|
77
|
-
if (!customElements.get(tagName)) {
|
|
78
|
-
defineCustomElement$4();
|
|
79
|
-
}
|
|
80
|
-
break;
|
|
81
|
-
case "vertex-viewer-toolbar":
|
|
82
|
-
if (!customElements.get(tagName)) {
|
|
83
|
-
defineCustomElement$3();
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
case "vertex-viewer-toolbar-group":
|
|
87
|
-
if (!customElements.get(tagName)) {
|
|
88
|
-
defineCustomElement$2();
|
|
89
|
-
}
|
|
90
|
-
break;
|
|
91
|
-
} });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const VertexViewerDefaultToolbar = ViewerDefaultToolbar;
|
|
95
|
-
const defineCustomElement = defineCustomElement$1;
|
|
96
|
-
|
|
97
|
-
export { VertexViewerDefaultToolbar, defineCustomElement };
|
|
98
|
-
|
|
99
|
-
//# sourceMappingURL=vertex-viewer-default-toolbar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"vertex-viewer-default-toolbar.js","mappings":";;;;;;;;;;AAAA,MAAM,uBAAuB,GAAG,yiCAAyiC;;MCU5jC,oBAAoB;EALjC;;;;;;;IAkBS,cAAS,GAA2B,eAAe,CAAC;;;;IAMpD,cAAS,GAAgC,YAAY,CAAC;;;;;IAOtD,uBAAkB,GAAG,KAAK,CAAC;;;;IAM3B,gBAAW,GAAG,IAAI,CAAC;GAgC3B;EA9BQ,MAAM;IACX,QACE,6BACE,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,IAAI,CAAC,SAAS,IAEzB,mCACE,KAAK,EAAC,OAAO,EACb,SAAS,EAAE,IAAI,CAAC,SAAS,oBACT,IAAI,CAAC,SAAS,IAE9B,4BACE,KAAK,EAAC,gBAAgB,kBACT,aAAa,EAC1B,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,IAE7B,0BAAoB,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,GAAG,CACvC,CACK,CACR,EACxB;GACH;EAEO,MAAM,OAAO;;IACnB,MAAM,KAAK,GAAG,OAAM,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,EAAE,CAAA,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB;QACrC,SAAS;QACT,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;IACvC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;GACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/viewer-default-toolbar/viewer-default-toolbar.css?tag=vertex-viewer-default-toolbar&encapsulation=shadow","./src/components/viewer-default-toolbar/viewer-default-toolbar.tsx"],"sourcesContent":[":host {\n /**\n * @prop --viewer-toolbar-group-gap: The spacing between each toolbar group.\n * Defaults to `0.5rem`.\n */\n --viewer-toolbar-group-gap: 0.5rem;\n\n /**\n * @prop --viewer-toolbar-group-background: The background to apply to each\n * group in the toolbar. Defaults to `rgba(245, 245, 245, 0.95)`\n */\n --viewer-toolbar-group-background: rgba(245, 245, 245, 0.95);\n\n /**\n * @prop --viewer-toolbar-group-border-radius: The corner radius to apply to\n * each group in the toolbar. Defaults to `0.25rem`.\n */\n --viewer-toolbar-group-border-radius: 0.25rem;\n\n /**\n * @prop --viewer-toolbar-group-box-shadow: The shadow to apply to each group\n * in the toolbar. Defaults to `-1px 0 2px rgba(0, 0, 0, 0.12), 1px 0 2px rgba(0, 0, 0, 0.13)`.\n */\n --viewer-toolbar-group-box-shadow: -1px 0 2px rgba(0, 0, 0, 0.12),\n 1px 0 2px rgba(0, 0, 0, 0.13);\n\n /**\n * @prop --viewer-toolbar-group-padding: The padding to apply to each group in\n * the toolbar. Defaults to `0.25rem`.\n */\n --viewer-toolbar-group-padding: 0.25rem;\n\n /**\n * @prop --viewer-toolbar-group-item-gap: The spacing between each item within\n * a toolbar group. Defaults to `0.25rem`.\n */\n --viewer-toolbar-group-item-gap: 0.25rem;\n}\n\n.group {\n background: var(--viewer-toolbar-group-background);\n border-radius: var(--viewer-toolbar-group-border-radius);\n box-shadow: var(--viewer-toolbar-group-box-shadow);\n padding: var(--viewer-toolbar-group-padding);\n}\n\n.group[data-direction='horizontal']:not(:first-child) {\n margin-left: var(--viewer-toolbar-group-gap);\n}\n\n.group[data-direction='horizontal'] .group-item:not(:first-child) {\n margin-left: var(--viewer-toolbar-group-item-gap);\n}\n\n.group[data-direction='vertical']:not(:first-child) {\n margin-top: var(--viewer-toolbar-group-gap);\n}\n\n.group[data-direction='vertical'] .group-item:not(:first-child) {\n margin-top: var(--viewer-toolbar-group-item-gap);\n}\n\n.btn {\n color: var(--neutral-800);\n padding: 0.125rem;\n border-radius: 0.125rem;\n}\n\n.btn:hover {\n background: var(--neutral-300);\n}\n","import { Component, h, Prop } from '@stencil/core';\n\nimport { ViewerToolbarPlacement } from '../viewer-toolbar/types';\nimport { ViewerToolbarGroupDirection } from '../viewer-toolbar-group/types';\n\n@Component({\n tag: 'vertex-viewer-default-toolbar',\n styleUrl: 'viewer-default-toolbar.css',\n shadow: true,\n})\nexport class ViewerDefaultToolbar {\n /**\n * An instance of the viewer that operations will be performed on. If\n * contained within a `<vertex-viewer>` element, this property will\n * automatically be wired.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * Specifies where the toolbar is positioned.\n */\n @Prop()\n public placement: ViewerToolbarPlacement = 'bottom-center';\n\n /**\n * Specifies the direction that UI elements are placed.\n */\n @Prop()\n public direction: ViewerToolbarGroupDirection = 'horizontal';\n\n /**\n * Indicates whether animations will be used when performing camera\n * operations. Defaults to `true`.\n */\n @Prop()\n public animationsDisabled = false;\n\n /**\n * The duration of animations, in milliseconds. Defaults to `1000`.\n */\n @Prop()\n public animationMs = 1000;\n\n public render(): h.JSX.IntrinsicElements {\n return (\n <vertex-viewer-toolbar\n placement={this.placement}\n direction={this.direction}\n >\n <vertex-viewer-toolbar-group\n class=\"group\"\n direction={this.direction}\n data-direction={this.direction}\n >\n <vertex-viewer-button\n class=\"group-item btn\"\n data-test-id=\"fit-all-btn\"\n onClick={() => this.viewAll()}\n >\n <vertex-viewer-icon class=\"icon\" name=\"fit-all\" size=\"md\" />\n </vertex-viewer-button>\n </vertex-viewer-toolbar-group>\n </vertex-viewer-toolbar>\n );\n }\n\n private async viewAll(): Promise<void> {\n const scene = await this.viewer?.scene();\n const animation = this.animationsDisabled\n ? undefined\n : { milliseconds: this.animationMs };\n scene?.camera().viewAll().render({ animation });\n }\n}\n"],"version":3}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/regl-shape";
|
|
2
|
-
|
|
3
|
-
interface VertexViewerDomElement extends Components.VertexViewerDomElement, HTMLElement {}
|
|
4
|
-
export const VertexViewerDomElement: {
|
|
5
|
-
prototype: VertexViewerDomElement;
|
|
6
|
-
new (): VertexViewerDomElement;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { V as ViewerDomElement, d as defineCustomElement$1 } from './viewer-dom-element.js';
|
|
5
|
-
|
|
6
|
-
const VertexViewerDomElement = ViewerDomElement;
|
|
7
|
-
const defineCustomElement = defineCustomElement$1;
|
|
8
|
-
|
|
9
|
-
export { VertexViewerDomElement, defineCustomElement };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=vertex-viewer-dom-element.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"vertex-viewer-dom-element.js","mappings":";;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/regl-shape";
|
|
2
|
-
|
|
3
|
-
interface VertexViewerDomGroup extends Components.VertexViewerDomGroup, HTMLElement {}
|
|
4
|
-
export const VertexViewerDomGroup: {
|
|
5
|
-
prototype: VertexViewerDomGroup;
|
|
6
|
-
new (): VertexViewerDomGroup;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { V as ViewerDomGroup, d as defineCustomElement$1 } from './viewer-dom-group.js';
|
|
5
|
-
|
|
6
|
-
const VertexViewerDomGroup = ViewerDomGroup;
|
|
7
|
-
const defineCustomElement = defineCustomElement$1;
|
|
8
|
-
|
|
9
|
-
export { VertexViewerDomGroup, defineCustomElement };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=vertex-viewer-dom-group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"vertex-viewer-dom-group.js","mappings":";;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/regl-shape";
|
|
2
|
-
|
|
3
|
-
interface VertexViewerDomRenderer extends Components.VertexViewerDomRenderer, HTMLElement {}
|
|
4
|
-
export const VertexViewerDomRenderer: {
|
|
5
|
-
prototype: VertexViewerDomRenderer;
|
|
6
|
-
new (): VertexViewerDomRenderer;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { V as ViewerDomRenderer, d as defineCustomElement$1 } from './viewer-dom-renderer.js';
|
|
5
|
-
|
|
6
|
-
const VertexViewerDomRenderer = ViewerDomRenderer;
|
|
7
|
-
const defineCustomElement = defineCustomElement$1;
|
|
8
|
-
|
|
9
|
-
export { VertexViewerDomRenderer, defineCustomElement };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=vertex-viewer-dom-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"vertex-viewer-dom-renderer.js","mappings":";;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/regl-shape";
|
|
2
|
-
|
|
3
|
-
interface VertexViewerHitResultIndicator extends Components.VertexViewerHitResultIndicator, HTMLElement {}
|
|
4
|
-
export const VertexViewerHitResultIndicator: {
|
|
5
|
-
prototype: VertexViewerHitResultIndicator;
|
|
6
|
-
new (): VertexViewerHitResultIndicator;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { v as vector3, m as matrix4, q as quaternion, r as ray, c as angle } from './bundle.esm.js';
|
|
6
|
-
import { w as writeDOM, r as readDOM } from './stencil.js';
|
|
7
|
-
import { M as MeshPoints, R as ReglComponent, r as regl, s as shapeBuilder, T as TriangleMesh, c as computeArrowNdcValues, a as Mesh, A as AxisLine, b as axisPositions } from './regl-component.js';
|
|
8
|
-
|
|
9
|
-
function parseCssColorValue(styles, property) {
|
|
10
|
-
return styles.getPropertyValue(property).trim().replace(/["']*/g, '');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function computePlaneNdcValues(transform, camera, direction, planeSize) {
|
|
14
|
-
const transformedDirection = vector3.transformMatrix(direction, matrix4.makeRotation(quaternion.fromMatrixRotation(transform)));
|
|
15
|
-
const position = vector3.fromMatrixPosition(transform);
|
|
16
|
-
const worldX = Math.abs(vector3.dot(transformedDirection, vector3.up())) === 1
|
|
17
|
-
? vector3.left()
|
|
18
|
-
: vector3.normalize(vector3.cross(transformedDirection, vector3.up()));
|
|
19
|
-
const worldY = vector3.normalize(vector3.cross(worldX, transformedDirection));
|
|
20
|
-
const xRay = ray.create({
|
|
21
|
-
origin: position,
|
|
22
|
-
direction: worldX,
|
|
23
|
-
});
|
|
24
|
-
const yRay = ray.create({
|
|
25
|
-
origin: position,
|
|
26
|
-
direction: worldY,
|
|
27
|
-
});
|
|
28
|
-
const bottomLeft = vector3.rotateAboutAxis(angle.toRadians(45), ray.at(xRay, -planeSize), transformedDirection, position);
|
|
29
|
-
const topLeft = vector3.rotateAboutAxis(angle.toRadians(45), ray.at(yRay, -planeSize), transformedDirection, position);
|
|
30
|
-
const bottomRight = vector3.rotateAboutAxis(angle.toRadians(45), ray.at(yRay, planeSize), transformedDirection, position);
|
|
31
|
-
const topRight = vector3.rotateAboutAxis(angle.toRadians(45), ray.at(xRay, planeSize), transformedDirection, position);
|
|
32
|
-
const world = [bottomLeft, topLeft, topRight, bottomRight];
|
|
33
|
-
return new MeshPoints(!isNaN(worldX.x), [bottomLeft, topLeft, topRight, bottomRight], world.map((v) => vector3.transformMatrix(v, camera.projectionViewMatrix)), (vector) => vector3.distance(position, vector));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function computePointNdcValues(transform, camera, direction, rectangleSize) {
|
|
37
|
-
const transformedDirection = vector3.transformMatrix(direction, matrix4.makeRotation(quaternion.fromMatrixRotation(transform)));
|
|
38
|
-
const position = vector3.fromMatrixPosition(transform);
|
|
39
|
-
const worldX = vector3.normalize(vector3.cross(transformedDirection, vector3.normalize(camera.viewVector)));
|
|
40
|
-
const worldY = vector3.normalize(vector3.cross(transformedDirection, worldX));
|
|
41
|
-
const xRay = ray.create({
|
|
42
|
-
origin: position,
|
|
43
|
-
direction: worldX,
|
|
44
|
-
});
|
|
45
|
-
const yRay = ray.create({
|
|
46
|
-
origin: position,
|
|
47
|
-
direction: worldY,
|
|
48
|
-
});
|
|
49
|
-
const bottomLeft = ray.at(xRay, -rectangleSize);
|
|
50
|
-
const topLeft = ray.at(yRay, -rectangleSize);
|
|
51
|
-
const bottomRight = ray.at(yRay, rectangleSize);
|
|
52
|
-
const topRight = ray.at(xRay, rectangleSize);
|
|
53
|
-
const bottomLeftRotated = vector3.rotateAboutAxis(angle.toRadians(45), bottomLeft, transformedDirection, position);
|
|
54
|
-
const topLeftRotated = vector3.rotateAboutAxis(angle.toRadians(45), topLeft, transformedDirection, position);
|
|
55
|
-
const bottomRightRotated = vector3.rotateAboutAxis(angle.toRadians(45), bottomRight, transformedDirection, position);
|
|
56
|
-
const topRightRotated = vector3.rotateAboutAxis(angle.toRadians(45), topRight, transformedDirection, position);
|
|
57
|
-
const world = [
|
|
58
|
-
bottomLeft,
|
|
59
|
-
bottomLeftRotated,
|
|
60
|
-
topLeft,
|
|
61
|
-
topLeftRotated,
|
|
62
|
-
topRight,
|
|
63
|
-
topRightRotated,
|
|
64
|
-
bottomRight,
|
|
65
|
-
bottomRightRotated,
|
|
66
|
-
];
|
|
67
|
-
return new MeshPoints(!isNaN(worldX.x), world, world.map((v) => vector3.transformMatrix(v, camera.projectionViewMatrix)), (vector) => vector3.distance(position, vector));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// The default amount to scale the computed `triangleSize` by when
|
|
71
|
-
// computing the points for the hit position indicator.
|
|
72
|
-
const DEFAULT_POINT_SIZE_SCALAR = 0.4;
|
|
73
|
-
// The default amount to scale the computed `triangleSize` by when
|
|
74
|
-
// computing the points for the hit plane indicator.
|
|
75
|
-
const DEFAULT_PLANE_SIZE_SCALAR = 5;
|
|
76
|
-
const DEFAULT_PLANE_OPACITY = 0.75;
|
|
77
|
-
class HitIndicator extends ReglComponent {
|
|
78
|
-
constructor(canvasElement, colors = {}, opacities = {}) {
|
|
79
|
-
super(canvasElement);
|
|
80
|
-
this.arrowFillColor = colors.arrow;
|
|
81
|
-
this.planeFillColor = colors.plane;
|
|
82
|
-
this.outlineColor = colors.outline;
|
|
83
|
-
this.planeOpacity = opacities.plane;
|
|
84
|
-
}
|
|
85
|
-
updateTransformAndNormal(transform, normal) {
|
|
86
|
-
var _a;
|
|
87
|
-
this.transform = transform;
|
|
88
|
-
this.normal = normal;
|
|
89
|
-
if (transform != null && normal != null && this.frame != null) {
|
|
90
|
-
this.updateAndDraw();
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
this.clear();
|
|
94
|
-
(_a = this.reglFrameDisposable) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
95
|
-
this.reglFrameDisposable = undefined;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
updateColors(colors) {
|
|
99
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
100
|
-
this.arrowFillColor = (_a = colors.arrow) !== null && _a !== void 0 ? _a : this.arrowFillColor;
|
|
101
|
-
this.planeFillColor = (_b = colors.plane) !== null && _b !== void 0 ? _b : this.planeFillColor;
|
|
102
|
-
this.outlineColor = (_c = colors.outline) !== null && _c !== void 0 ? _c : this.outlineColor;
|
|
103
|
-
(_d = this.arrow) === null || _d === void 0 ? void 0 : _d.updateFillColor(this.arrowFillColor);
|
|
104
|
-
(_e = this.plane) === null || _e === void 0 ? void 0 : _e.updateFillColor(this.planeFillColor);
|
|
105
|
-
(_f = this.arrow) === null || _f === void 0 ? void 0 : _f.updateOutlineColor(this.outlineColor);
|
|
106
|
-
(_g = this.plane) === null || _g === void 0 ? void 0 : _g.updateOutlineColor(this.outlineColor);
|
|
107
|
-
(_h = this.point) === null || _h === void 0 ? void 0 : _h.updateOutlineColor(this.outlineColor);
|
|
108
|
-
(_j = this.axis) === null || _j === void 0 ? void 0 : _j.updateOutlineColor(this.outlineColor);
|
|
109
|
-
}
|
|
110
|
-
updateOpacities(opacities) {
|
|
111
|
-
this.planeOpacity = opacities.plane;
|
|
112
|
-
}
|
|
113
|
-
hasData() {
|
|
114
|
-
return this.transform != null && this.normal != null;
|
|
115
|
-
}
|
|
116
|
-
createOrUpdateElements() {
|
|
117
|
-
if (this.transform != null && this.normal != null && this.frame != null) {
|
|
118
|
-
if (this.arrow == null) {
|
|
119
|
-
this.createElements(this.transform, this.normal, this.frame);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
this.updateElements(this.transform, this.normal, this.frame);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
createElements(transform, normal, frame) {
|
|
127
|
-
this.reglCommand = regl({
|
|
128
|
-
canvas: this.canvasElement,
|
|
129
|
-
extensions: 'angle_instanced_arrays',
|
|
130
|
-
});
|
|
131
|
-
const { createShape } = shapeBuilder(this.reglCommand);
|
|
132
|
-
const triangleSize = this.computeTriangleSize(vector3.fromMatrixPosition(transform), frame);
|
|
133
|
-
this.arrow = new TriangleMesh(createShape, 'hit-normal-arrow', computeArrowNdcValues(transform, frame.scene.camera, normal, triangleSize), this.outlineColor, this.arrowFillColor);
|
|
134
|
-
this.plane = new Mesh(createShape, 'hit-plane', computePlaneNdcValues(transform, frame.scene.camera, normal, triangleSize * DEFAULT_PLANE_SIZE_SCALAR), this.outlineColor, this.planeFillColor, {
|
|
135
|
-
opacity: this.getPlaneOpacity(),
|
|
136
|
-
depth: 0.5,
|
|
137
|
-
});
|
|
138
|
-
this.point = new Mesh(createShape, 'hit-position', computePointNdcValues(transform, frame.scene.camera, normal, triangleSize * DEFAULT_POINT_SIZE_SCALAR), this.outlineColor, this.outlineColor, {
|
|
139
|
-
join: 'round',
|
|
140
|
-
depth: 1,
|
|
141
|
-
});
|
|
142
|
-
this.axis = new AxisLine(createShape, 'hit-normal-axis', axisPositions(transform, frame.scene.camera, this.arrow), this.outlineColor, this.arrowFillColor);
|
|
143
|
-
this.availableElements = [this.arrow, this.point, this.plane, this.axis];
|
|
144
|
-
}
|
|
145
|
-
updateElements(transform, normal, frame) {
|
|
146
|
-
var _a;
|
|
147
|
-
const triangleSize = this.computeTriangleSize(vector3.fromMatrixPosition(transform), frame);
|
|
148
|
-
if (this.arrow != null) {
|
|
149
|
-
this.arrow.updatePoints(computeArrowNdcValues(transform, frame.scene.camera, normal, triangleSize));
|
|
150
|
-
(_a = this.axis) === null || _a === void 0 ? void 0 : _a.updatePoints(axisPositions(transform, frame.scene.camera, this.arrow));
|
|
151
|
-
}
|
|
152
|
-
if (this.plane != null) {
|
|
153
|
-
this.plane.updatePoints(computePlaneNdcValues(transform, frame.scene.camera, normal, triangleSize * DEFAULT_PLANE_SIZE_SCALAR));
|
|
154
|
-
}
|
|
155
|
-
if (this.point != null) {
|
|
156
|
-
this.point.updatePoints(computePointNdcValues(transform, frame.scene.camera, normal, triangleSize * DEFAULT_POINT_SIZE_SCALAR));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
getPlaneOpacity() {
|
|
160
|
-
if (this.planeOpacity != null) {
|
|
161
|
-
return typeof this.planeOpacity === 'string'
|
|
162
|
-
? parseFloat(this.planeOpacity)
|
|
163
|
-
: this.planeOpacity;
|
|
164
|
-
}
|
|
165
|
-
return DEFAULT_PLANE_OPACITY;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const viewerHitResultIndicatorCss = ":host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-hit-result-indicator-arrow-color:#0099cc;--viewer-hit-result-indicator-plane-color:#0099cc;--viewer-hit-result-indicator-outline-color:#000000;--viewer-hit-result-indicator-plane-opacity:0.75}.indicator{position:absolute;top:0;left:0}";
|
|
170
|
-
|
|
171
|
-
const ViewerHitResultIndicator = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
172
|
-
constructor() {
|
|
173
|
-
super();
|
|
174
|
-
this.__registerHost();
|
|
175
|
-
this.__attachShadow();
|
|
176
|
-
this.arrowColor = '#0099cc';
|
|
177
|
-
this.planeColor = '#0099cc';
|
|
178
|
-
this.outlineColor = '#000000';
|
|
179
|
-
this.planeOpacity = DEFAULT_PLANE_OPACITY;
|
|
180
|
-
this.handleViewerFrameDrawn = () => {
|
|
181
|
-
this.updatePropsFromViewer();
|
|
182
|
-
};
|
|
183
|
-
this.handleViewerDimensionsChange = () => {
|
|
184
|
-
writeDOM(() => {
|
|
185
|
-
if (this.viewer != null && this.canvasRef != null) {
|
|
186
|
-
this.canvasRef.width = this.viewer.viewport.width;
|
|
187
|
-
this.canvasRef.height = this.viewer.viewport.height;
|
|
188
|
-
this.updateAndRedrawIndicator();
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
this.handleResize = () => {
|
|
193
|
-
if (this.canvasRef != null) {
|
|
194
|
-
this.updateAndRedrawIndicator();
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
this.updatePropsFromViewer = () => {
|
|
198
|
-
const { frame } = this.viewer || {};
|
|
199
|
-
if (frame != null) {
|
|
200
|
-
const widget = this.getIndicator();
|
|
201
|
-
widget.updateFrame(frame);
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
this.setupIndicator = (canvasRef) => {
|
|
205
|
-
var _a, _b;
|
|
206
|
-
console.debug(`Initializing hit indicator. [initial-position=${JSON.stringify(this.position)}, initial-normal=${JSON.stringify(this.normal)} has-initial-frame=${((_a = this.viewer) === null || _a === void 0 ? void 0 : _a.frame) != null}]`);
|
|
207
|
-
this.indicator = new HitIndicator(canvasRef, {
|
|
208
|
-
arrow: this.arrowColor,
|
|
209
|
-
plane: this.planeColor,
|
|
210
|
-
}, {
|
|
211
|
-
plane: this.planeOpacity,
|
|
212
|
-
});
|
|
213
|
-
this.transform = this.createTransform();
|
|
214
|
-
this.indicator.updateTransformAndNormal(this.transform, this.normal);
|
|
215
|
-
if (((_b = this.viewer) === null || _b === void 0 ? void 0 : _b.frame) != null) {
|
|
216
|
-
this.indicator.updateFrame(this.viewer.frame);
|
|
217
|
-
}
|
|
218
|
-
return this.indicator;
|
|
219
|
-
};
|
|
220
|
-
this.updateAndRedrawIndicator = () => {
|
|
221
|
-
readDOM(() => {
|
|
222
|
-
this.getIndicator().updateAndDraw();
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
this.createTransform = () => {
|
|
226
|
-
if (this.position != null) {
|
|
227
|
-
return matrix4.makeTranslation(this.position);
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
this.getIndicator = () => {
|
|
231
|
-
if (this.indicator == null && this.canvasRef != null) {
|
|
232
|
-
return this.setupIndicator(this.canvasRef);
|
|
233
|
-
}
|
|
234
|
-
else if (this.indicator != null) {
|
|
235
|
-
return this.indicator;
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
throw new Error('Hit indicator was not initialized. The canvas element may not have been initialized.');
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
componentDidLoad() {
|
|
243
|
-
this.handleViewerChanged(this.viewer, undefined);
|
|
244
|
-
this.canvasResizeObserver = new ResizeObserver(this.handleResize);
|
|
245
|
-
if (this.canvasRef != null) {
|
|
246
|
-
this.canvasResizeObserver.observe(this.canvasRef);
|
|
247
|
-
this.setupIndicator(this.canvasRef);
|
|
248
|
-
}
|
|
249
|
-
readDOM(() => {
|
|
250
|
-
var _a, _b;
|
|
251
|
-
const hostStyles = window.getComputedStyle(this.hostEl);
|
|
252
|
-
this.arrowColor = parseCssColorValue(hostStyles, '--viewer-hit-result-indicator-arrow-color');
|
|
253
|
-
this.planeColor = parseCssColorValue(hostStyles, '--viewer-hit-result-indicator-plane-color');
|
|
254
|
-
this.outlineColor = parseCssColorValue(hostStyles, '--viewer-hit-result-indicator-outline-color');
|
|
255
|
-
this.planeOpacity = hostStyles
|
|
256
|
-
.getPropertyValue('--viewer-hit-result-indicator-plane-opacity')
|
|
257
|
-
.trim();
|
|
258
|
-
(_a = this.indicator) === null || _a === void 0 ? void 0 : _a.updateColors({
|
|
259
|
-
arrow: this.arrowColor,
|
|
260
|
-
plane: this.planeColor,
|
|
261
|
-
outline: this.outlineColor,
|
|
262
|
-
});
|
|
263
|
-
(_b = this.indicator) === null || _b === void 0 ? void 0 : _b.updateOpacities({
|
|
264
|
-
plane: this.planeOpacity,
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
disconnectedCallback() {
|
|
269
|
-
var _a, _b;
|
|
270
|
-
(_a = this.canvasResizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
271
|
-
(_b = this.indicator) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* @ignore
|
|
275
|
-
*/
|
|
276
|
-
handleViewerChanged(newViewer, oldViewer) {
|
|
277
|
-
oldViewer === null || oldViewer === void 0 ? void 0 : oldViewer.removeEventListener('frameDrawn', this.handleViewerFrameDrawn);
|
|
278
|
-
oldViewer === null || oldViewer === void 0 ? void 0 : oldViewer.removeEventListener('dimensionschange', this.handleViewerDimensionsChange);
|
|
279
|
-
newViewer === null || newViewer === void 0 ? void 0 : newViewer.addEventListener('frameDrawn', this.handleViewerFrameDrawn);
|
|
280
|
-
newViewer === null || newViewer === void 0 ? void 0 : newViewer.addEventListener('dimensionschange', this.handleViewerDimensionsChange);
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* @ignore
|
|
284
|
-
*/
|
|
285
|
-
handlePositionChanged(newPosition, oldPosition) {
|
|
286
|
-
var _a;
|
|
287
|
-
this.transform = this.createTransform();
|
|
288
|
-
console.debug(`Updating indicator position [previous=${JSON.stringify(oldPosition)}, current=${JSON.stringify(newPosition)}]`);
|
|
289
|
-
(_a = this.indicator) === null || _a === void 0 ? void 0 : _a.updateTransformAndNormal(this.transform, this.normal);
|
|
290
|
-
}
|
|
291
|
-
handleNormalChanged(newNormal, oldNormal) {
|
|
292
|
-
var _a;
|
|
293
|
-
console.debug(`Updating indicator normal [previous=${JSON.stringify(oldNormal)}, current=${JSON.stringify(newNormal)}]`);
|
|
294
|
-
if (newNormal) {
|
|
295
|
-
(_a = this.indicator) === null || _a === void 0 ? void 0 : _a.updateTransformAndNormal(this.transform, this.normal);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
render() {
|
|
299
|
-
var _a, _b;
|
|
300
|
-
return (h(Host, null, h("canvas", { ref: (el) => {
|
|
301
|
-
this.canvasRef = el;
|
|
302
|
-
}, class: "indicator", width: (_a = this.viewer) === null || _a === void 0 ? void 0 : _a.viewport.width, height: (_b = this.viewer) === null || _b === void 0 ? void 0 : _b.viewport.height })));
|
|
303
|
-
}
|
|
304
|
-
get hostEl() { return this; }
|
|
305
|
-
static get watchers() { return {
|
|
306
|
-
"viewer": ["handleViewerChanged"],
|
|
307
|
-
"position": ["handlePositionChanged"],
|
|
308
|
-
"normal": ["handleNormalChanged"]
|
|
309
|
-
}; }
|
|
310
|
-
static get style() { return viewerHitResultIndicatorCss; }
|
|
311
|
-
}, [1, "vertex-viewer-hit-result-indicator", {
|
|
312
|
-
"viewer": [16],
|
|
313
|
-
"position": [1040],
|
|
314
|
-
"normal": [1040]
|
|
315
|
-
}]);
|
|
316
|
-
function defineCustomElement$1() {
|
|
317
|
-
if (typeof customElements === "undefined") {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
const components = ["vertex-viewer-hit-result-indicator"];
|
|
321
|
-
components.forEach(tagName => { switch (tagName) {
|
|
322
|
-
case "vertex-viewer-hit-result-indicator":
|
|
323
|
-
if (!customElements.get(tagName)) {
|
|
324
|
-
customElements.define(tagName, ViewerHitResultIndicator);
|
|
325
|
-
}
|
|
326
|
-
break;
|
|
327
|
-
} });
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const VertexViewerHitResultIndicator = ViewerHitResultIndicator;
|
|
331
|
-
const defineCustomElement = defineCustomElement$1;
|
|
332
|
-
|
|
333
|
-
export { VertexViewerHitResultIndicator, defineCustomElement };
|
|
334
|
-
|
|
335
|
-
//# sourceMappingURL=vertex-viewer-hit-result-indicator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"vertex-viewer-hit-result-indicator.js","mappings":";;;;;;;;SAAgB,kBAAkB,CAChC,MAA2B,EAC3B,QAAgB;EAEhB,OAAO,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACxE;;SCAgB,qBAAqB,CACnC,SAA0B,EAC1B,MAAuB,EACvB,SAA0B,EAC1B,SAAiB;EAEjB,MAAM,oBAAoB,GAAGA,OAAO,CAAC,eAAe,CAClD,SAAS,EACTC,OAAO,CAAC,YAAY,CAACC,UAAU,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAC/D,CAAC;EAEF,MAAM,QAAQ,GAAGF,OAAO,CAA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Aa,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAC3C,CAAC;IAEF,IAAI,SAAS,EAAE;MACb,MAAA,IAAI,CAAC,SAAS,0CAAE,wBAAwB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;KACvE;GACF;EAEM,MAAM;;IACX,QACE,EAAC,IAAI,QACH,cACE,GAAG,EAAE,CAAC,EAAE;QACN,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;OACrB,EACD,KAAK,EAAC,WAAW,EACjB,KAAK,EAAE,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ,CAAC,KAAK,EAClC,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ,CAAC,MAAM,GACpC,CACG,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Vector3","Matrix4","Quaternion","Ray","Angle"],"sources":["./src/components/viewer-hit-result-indicator/lib/dom.ts","./src/components/viewer-hit-result-indicator/lib/plane.ts","./src/components/viewer-hit-result-indicator/lib/point.ts","./src/components/viewer-hit-result-indicator/lib/indicator.ts","./src/components/viewer-hit-result-indicator/viewer-hit-result-indicator.css?tag=vertex-viewer-hit-result-indicator&encapsulation=shadow","./src/components/viewer-hit-result-indicator/viewer-hit-result-indicator.tsx"],"sourcesContent":["export function parseCssColorValue(\n styles: CSSStyleDeclaration,\n property: string\n): string {\n return styles.getPropertyValue(property).trim().replace(/[\"']*/g, '');\n}\n","import { Angle, Matrix4, Quaternion, Ray, Vector3 } from '@vertexvis/geometry';\n\nimport { MeshPoints } from '../../../lib/transforms/mesh';\nimport { FrameCameraBase } from '../../../lib/types';\n\nexport function computePlaneNdcValues(\n transform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n direction: Vector3.Vector3,\n planeSize: number\n): MeshPoints {\n const transformedDirection = Vector3.transformMatrix(\n direction,\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(transform))\n );\n\n const position = Vector3.fromMatrixPosition(transform);\n\n const worldX =\n Math.abs(Vector3.dot(transformedDirection, Vector3.up())) === 1\n ? Vector3.left()\n : Vector3.normalize(Vector3.cross(transformedDirection, Vector3.up()));\n const worldY = Vector3.normalize(Vector3.cross(worldX, transformedDirection));\n const xRay = Ray.create({\n origin: position,\n direction: worldX,\n });\n const yRay = Ray.create({\n origin: position,\n direction: worldY,\n });\n\n const bottomLeft = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(xRay, -planeSize),\n transformedDirection,\n position\n );\n const topLeft = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(yRay, -planeSize),\n transformedDirection,\n position\n );\n const bottomRight = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(yRay, planeSize),\n transformedDirection,\n position\n );\n const topRight = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(xRay, planeSize),\n transformedDirection,\n position\n );\n\n const world = [bottomLeft, topLeft, topRight, bottomRight];\n\n return new MeshPoints(\n !isNaN(worldX.x),\n [bottomLeft, topLeft, topRight, bottomRight],\n world.map((v) => Vector3.transformMatrix(v, camera.projectionViewMatrix)),\n (vector) => Vector3.distance(position, vector)\n );\n}\n","import { Angle, Matrix4, Quaternion, Ray, Vector3 } from '@vertexvis/geometry';\n\nimport { MeshPoints } from '../../../lib/transforms/mesh';\nimport { FrameCameraBase } from '../../../lib/types';\n\nexport function computePointNdcValues(\n transform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n direction: Vector3.Vector3,\n rectangleSize: number\n): MeshPoints {\n const transformedDirection = Vector3.transformMatrix(\n direction,\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(transform))\n );\n\n const position = Vector3.fromMatrixPosition(transform);\n\n const worldX = Vector3.normalize(\n Vector3.cross(transformedDirection, Vector3.normalize(camera.viewVector))\n );\n const worldY = Vector3.normalize(Vector3.cross(transformedDirection, worldX));\n const xRay = Ray.create({\n origin: position,\n direction: worldX,\n });\n const yRay = Ray.create({\n origin: position,\n direction: worldY,\n });\n\n const bottomLeft = Ray.at(xRay, -rectangleSize);\n const topLeft = Ray.at(yRay, -rectangleSize);\n const bottomRight = Ray.at(yRay, rectangleSize);\n const topRight = Ray.at(xRay, rectangleSize);\n\n const bottomLeftRotated = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n bottomLeft,\n transformedDirection,\n position\n );\n const topLeftRotated = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n topLeft,\n transformedDirection,\n position\n );\n const bottomRightRotated = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n bottomRight,\n transformedDirection,\n position\n );\n const topRightRotated = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n topRight,\n transformedDirection,\n position\n );\n\n const world = [\n bottomLeft,\n bottomLeftRotated,\n topLeft,\n topLeftRotated,\n topRight,\n topRightRotated,\n bottomRight,\n bottomRightRotated,\n ];\n\n return new MeshPoints(\n !isNaN(worldX.x),\n world,\n world.map((v) => Vector3.transformMatrix(v, camera.projectionViewMatrix)),\n (vector) => Vector3.distance(position, vector)\n );\n}\n","import { Matrix4 } from '@vertexvis/geometry';\nimport { Vector3 } from '@vertexvis/geometry';\nimport { Color } from '@vertexvis/utils';\nimport regl from 'regl';\nimport shapeBuilder, { JoinStyle } from 'regl-shape';\n\nimport { axisPositions } from '../../../lib/transforms/axis-lines';\nimport { computeArrowNdcValues } from '../../../lib/transforms/axis-translation';\nimport { AxisLine } from '../../../lib/transforms/line';\nimport { Mesh, TriangleMesh } from '../../../lib/transforms/mesh';\nimport { Frame } from '../../../lib/types';\nimport { ReglComponent } from '../../../lib/webgl/regl-component';\nimport { computePlaneNdcValues } from './plane';\nimport { computePointNdcValues } from './point';\n\nexport interface DrawableElementColors {\n arrow?: Color.Color | string;\n plane?: Color.Color | string;\n outline?: Color.Color | string;\n}\n\nexport interface DrawableElementOpacities {\n plane?: string | number;\n}\n\n// The default amount to scale the computed `triangleSize` by when\n// computing the points for the hit position indicator.\nexport const DEFAULT_POINT_SIZE_SCALAR = 0.4;\n\n// The default amount to scale the computed `triangleSize` by when\n// computing the points for the hit plane indicator.\nexport const DEFAULT_PLANE_SIZE_SCALAR = 5;\n\nexport const DEFAULT_PLANE_OPACITY = 0.75;\n\nexport class HitIndicator extends ReglComponent {\n private axis?: AxisLine;\n private arrow?: TriangleMesh;\n private point?: Mesh;\n private plane?: Mesh;\n\n private transform?: Matrix4.Matrix4;\n private normal?: Vector3.Vector3;\n\n private arrowFillColor?: Color.Color | string;\n private planeFillColor?: Color.Color | string;\n private outlineColor?: Color.Color | string;\n\n private planeOpacity?: string | number;\n\n public constructor(\n canvasElement: HTMLCanvasElement,\n colors: DrawableElementColors = {},\n opacities: DrawableElementOpacities = {}\n ) {\n super(canvasElement);\n\n this.arrowFillColor = colors.arrow;\n this.planeFillColor = colors.plane;\n this.outlineColor = colors.outline;\n this.planeOpacity = opacities.plane;\n }\n\n public updateTransformAndNormal(\n transform?: Matrix4.Matrix4,\n normal?: Vector3.Vector3\n ): void {\n this.transform = transform;\n this.normal = normal;\n\n if (transform != null && normal != null && this.frame != null) {\n this.updateAndDraw();\n } else {\n this.clear();\n this.reglFrameDisposable?.cancel();\n this.reglFrameDisposable = undefined;\n }\n }\n\n public updateColors(colors: DrawableElementColors): void {\n this.arrowFillColor = colors.arrow ?? this.arrowFillColor;\n this.planeFillColor = colors.plane ?? this.planeFillColor;\n this.outlineColor = colors.outline ?? this.outlineColor;\n this.arrow?.updateFillColor(this.arrowFillColor);\n this.plane?.updateFillColor(this.planeFillColor);\n this.arrow?.updateOutlineColor(this.outlineColor);\n this.plane?.updateOutlineColor(this.outlineColor);\n this.point?.updateOutlineColor(this.outlineColor);\n this.axis?.updateOutlineColor(this.outlineColor);\n }\n\n public updateOpacities(opacities: DrawableElementOpacities): void {\n this.planeOpacity = opacities.plane;\n }\n\n protected hasData(): boolean {\n return this.transform != null && this.normal != null;\n }\n\n protected createOrUpdateElements(): void {\n if (this.transform != null && this.normal != null && this.frame != null) {\n if (this.arrow == null) {\n this.createElements(this.transform, this.normal, this.frame);\n } else {\n this.updateElements(this.transform, this.normal, this.frame);\n }\n }\n }\n\n private createElements(\n transform: Matrix4.Matrix4,\n normal: Vector3.Vector3,\n frame: Frame\n ): void {\n this.reglCommand = regl({\n canvas: this.canvasElement,\n extensions: 'angle_instanced_arrays',\n });\n const { createShape } = shapeBuilder(this.reglCommand);\n\n const triangleSize = this.computeTriangleSize(\n Vector3.fromMatrixPosition(transform),\n frame\n );\n\n this.arrow = new TriangleMesh(\n createShape,\n 'hit-normal-arrow',\n computeArrowNdcValues(\n transform,\n frame.scene.camera,\n normal,\n triangleSize\n ),\n this.outlineColor,\n this.arrowFillColor\n );\n this.plane = new Mesh(\n createShape,\n 'hit-plane',\n computePlaneNdcValues(\n transform,\n frame.scene.camera,\n normal,\n triangleSize * DEFAULT_PLANE_SIZE_SCALAR\n ),\n this.outlineColor,\n this.planeFillColor,\n {\n opacity: this.getPlaneOpacity(),\n depth: 0.5,\n }\n );\n this.point = new Mesh(\n createShape,\n 'hit-position',\n computePointNdcValues(\n transform,\n frame.scene.camera,\n normal,\n triangleSize * DEFAULT_POINT_SIZE_SCALAR\n ),\n this.outlineColor,\n this.outlineColor,\n {\n join: 'round' as JoinStyle,\n depth: 1,\n }\n );\n this.axis = new AxisLine(\n createShape,\n 'hit-normal-axis',\n axisPositions(transform, frame.scene.camera, this.arrow),\n this.outlineColor,\n this.arrowFillColor\n );\n\n this.availableElements = [this.arrow, this.point, this.plane, this.axis];\n }\n\n private updateElements(\n transform: Matrix4.Matrix4,\n normal: Vector3.Vector3,\n frame: Frame\n ): void {\n const triangleSize = this.computeTriangleSize(\n Vector3.fromMatrixPosition(transform),\n frame\n );\n\n if (this.arrow != null) {\n this.arrow.updatePoints(\n computeArrowNdcValues(\n transform,\n frame.scene.camera,\n normal,\n triangleSize\n )\n );\n this.axis?.updatePoints(\n axisPositions(transform, frame.scene.camera, this.arrow)\n );\n }\n if (this.plane != null) {\n this.plane.updatePoints(\n computePlaneNdcValues(\n transform,\n frame.scene.camera,\n normal,\n triangleSize * DEFAULT_PLANE_SIZE_SCALAR\n )\n );\n }\n if (this.point != null) {\n this.point.updatePoints(\n computePointNdcValues(\n transform,\n frame.scene.camera,\n normal,\n triangleSize * DEFAULT_POINT_SIZE_SCALAR\n )\n );\n }\n }\n\n private getPlaneOpacity(): number {\n if (this.planeOpacity != null) {\n return typeof this.planeOpacity === 'string'\n ? parseFloat(this.planeOpacity)\n : this.planeOpacity;\n }\n return DEFAULT_PLANE_OPACITY;\n }\n}\n",":host {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n /**\n * @prop --viewer-hit-result-indicator-arrow-color: A CSS color for the arrow\n * representing the normal for this hit indicator. Defaults to `#0099cc`.\n */\n --viewer-hit-result-indicator-arrow-color: #0099cc;\n\n /**\n * @prop --viewer-hit-result-indicator-plane-color: A CSS color for the plane\n * for this hit indicator. Defaults to `#0099cc`.\n */\n --viewer-hit-result-indicator-plane-color: #0099cc;\n\n /**\n * @prop --viewer-hit-result-indicator-outline-color: A CSS color for the outline\n * of the plane and arrow. Defaults to `#000000`.\n */\n --viewer-hit-result-indicator-outline-color: #000000;\n\n /**\n * @prop --viewer-hit-result-indicator-plane-opacity: A CSS number for the opacity\n * of the plane for this hit indicator. Defaults to `0.75`.\n */\n --viewer-hit-result-indicator-plane-opacity: 0.75;\n}\n\n.indicator {\n position: absolute;\n top: 0;\n left: 0;\n}\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { Matrix4, Vector3 } from '@vertexvis/geometry';\nimport { Color } from '@vertexvis/utils';\n\nimport { readDOM, writeDOM } from '../../lib/stencil';\nimport { parseCssColorValue } from './lib/dom';\nimport { DEFAULT_PLANE_OPACITY, HitIndicator } from './lib/indicator';\n\n@Component({\n tag: 'vertex-viewer-hit-result-indicator',\n styleUrl: 'viewer-hit-result-indicator.css',\n shadow: true,\n})\nexport class ViewerHitResultIndicator {\n /**\n * The viewer to connect to this indicator. If nested within a <vertex-viewer>,\n * this property will be populated automatically.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The position of this indicator. A point will be displayed at this position,\n * and it will be used alongside the provided `normal` to display a plane and\n * normal arrow centered at the position.\n */\n @Prop({ mutable: true })\n public position?: Vector3.Vector3;\n\n /**\n * The normal of this indicator. This value will be represented as an arrow,\n * and will be used alongside the provided `position` to display a plane.\n */\n @Prop({ mutable: true })\n public normal?: Vector3.Vector3;\n\n @Element()\n private hostEl!: HTMLElement;\n\n private transform?: Matrix4.Matrix4;\n\n private arrowColor: Color.Color | string = '#0099cc';\n private planeColor: Color.Color | string = '#0099cc';\n private outlineColor: Color.Color | string = '#000000';\n private planeOpacity: number | string = DEFAULT_PLANE_OPACITY;\n\n private indicator?: HitIndicator;\n\n private canvasResizeObserver?: ResizeObserver;\n private canvasRef?: HTMLCanvasElement;\n\n protected componentDidLoad(): void {\n this.handleViewerChanged(this.viewer, undefined);\n\n this.canvasResizeObserver = new ResizeObserver(this.handleResize);\n\n if (this.canvasRef != null) {\n this.canvasResizeObserver.observe(this.canvasRef);\n\n this.setupIndicator(this.canvasRef);\n }\n\n readDOM(() => {\n const hostStyles = window.getComputedStyle(this.hostEl);\n\n this.arrowColor = parseCssColorValue(\n hostStyles,\n '--viewer-hit-result-indicator-arrow-color'\n );\n this.planeColor = parseCssColorValue(\n hostStyles,\n '--viewer-hit-result-indicator-plane-color'\n );\n this.outlineColor = parseCssColorValue(\n hostStyles,\n '--viewer-hit-result-indicator-outline-color'\n );\n this.planeOpacity = hostStyles\n .getPropertyValue('--viewer-hit-result-indicator-plane-opacity')\n .trim();\n\n this.indicator?.updateColors({\n arrow: this.arrowColor,\n plane: this.planeColor,\n outline: this.outlineColor,\n });\n this.indicator?.updateOpacities({\n plane: this.planeOpacity,\n });\n });\n }\n\n protected disconnectedCallback(): void {\n this.canvasResizeObserver?.disconnect();\n\n this.indicator?.dispose();\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(\n newViewer?: HTMLVertexViewerElement,\n oldViewer?: HTMLVertexViewerElement\n ): void {\n oldViewer?.removeEventListener('frameDrawn', this.handleViewerFrameDrawn);\n oldViewer?.removeEventListener(\n 'dimensionschange',\n this.handleViewerDimensionsChange\n );\n newViewer?.addEventListener('frameDrawn', this.handleViewerFrameDrawn);\n newViewer?.addEventListener(\n 'dimensionschange',\n this.handleViewerDimensionsChange\n );\n }\n\n /**\n * @ignore\n */\n @Watch('position')\n protected handlePositionChanged(\n newPosition?: Vector3.Vector3,\n oldPosition?: Vector3.Vector3\n ): void {\n this.transform = this.createTransform();\n\n console.debug(\n `Updating indicator position [previous=${JSON.stringify(\n oldPosition\n )}, current=${JSON.stringify(newPosition)}]`\n );\n\n this.indicator?.updateTransformAndNormal(this.transform, this.normal);\n }\n\n @Watch('normal')\n protected handleNormalChanged(\n newNormal?: Vector3.Vector3,\n oldNormal?: Vector3.Vector3\n ): void {\n console.debug(\n `Updating indicator normal [previous=${JSON.stringify(\n oldNormal\n )}, current=${JSON.stringify(newNormal)}]`\n );\n\n if (newNormal) {\n this.indicator?.updateTransformAndNormal(this.transform, this.normal);\n }\n }\n\n public render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <canvas\n ref={(el) => {\n this.canvasRef = el;\n }}\n class=\"indicator\"\n width={this.viewer?.viewport.width}\n height={this.viewer?.viewport.height}\n />\n </Host>\n );\n }\n\n private handleViewerFrameDrawn = (): void => {\n this.updatePropsFromViewer();\n };\n\n private handleViewerDimensionsChange = (): void => {\n writeDOM(() => {\n if (this.viewer != null && this.canvasRef != null) {\n this.canvasRef.width = this.viewer.viewport.width;\n this.canvasRef.height = this.viewer.viewport.height;\n\n this.updateAndRedrawIndicator();\n }\n });\n };\n\n private handleResize = (): void => {\n if (this.canvasRef != null) {\n this.updateAndRedrawIndicator();\n }\n };\n\n private updatePropsFromViewer = (): void => {\n const { frame } = this.viewer || {};\n\n if (frame != null) {\n const widget = this.getIndicator();\n\n widget.updateFrame(frame);\n }\n };\n\n private setupIndicator = (canvasRef: HTMLCanvasElement): HitIndicator => {\n console.debug(\n `Initializing hit indicator. [initial-position=${JSON.stringify(\n this.position\n )}, initial-normal=${JSON.stringify(this.normal)} has-initial-frame=${\n this.viewer?.frame != null\n }]`\n );\n\n this.indicator = new HitIndicator(\n canvasRef,\n {\n arrow: this.arrowColor,\n plane: this.planeColor,\n },\n {\n plane: this.planeOpacity,\n }\n );\n\n this.transform = this.createTransform();\n this.indicator.updateTransformAndNormal(this.transform, this.normal);\n if (this.viewer?.frame != null) {\n this.indicator.updateFrame(this.viewer.frame);\n }\n\n return this.indicator;\n };\n\n private updateAndRedrawIndicator = (): void => {\n readDOM(() => {\n this.getIndicator().updateAndDraw();\n });\n };\n\n private createTransform = (): Matrix4.Matrix4 | undefined => {\n if (this.position != null) {\n return Matrix4.makeTranslation(this.position);\n }\n };\n\n private getIndicator = (): HitIndicator => {\n if (this.indicator == null && this.canvasRef != null) {\n return this.setupIndicator(this.canvasRef);\n } else if (this.indicator != null) {\n return this.indicator;\n } else {\n throw new Error(\n 'Hit indicator was not initialized. The canvas element may not have been initialized.'\n );\n }\n };\n}\n"],"version":3}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/regl-shape";
|
|
2
|
-
|
|
3
|
-
interface VertexViewerIcon extends Components.VertexViewerIcon, HTMLElement {}
|
|
4
|
-
export const VertexViewerIcon: {
|
|
5
|
-
prototype: VertexViewerIcon;
|
|
6
|
-
new (): VertexViewerIcon;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { V as ViewerIcon, d as defineCustomElement$1 } from './viewer-icon.js';
|
|
5
|
-
|
|
6
|
-
const VertexViewerIcon = ViewerIcon;
|
|
7
|
-
const defineCustomElement = defineCustomElement$1;
|
|
8
|
-
|
|
9
|
-
export { VertexViewerIcon, defineCustomElement };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=vertex-viewer-icon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"vertex-viewer-icon.js","mappings":";;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|