@vertexvis/viewer 0.12.0 → 0.13.0-canary.0
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/{config-acd7cea9.js → config-90ee43d5.js} +1 -1
- package/dist/cjs/{cursors-399a9648.js → cursors-ad2fd395.js} +7 -0
- package/dist/cjs/{controller-8cbcdd8d.js → entities-aa59890e.js} +57 -22
- package/dist/cjs/{index-cc65325e.js → index-e100709a.js} +64 -3
- package/dist/cjs/index.cjs.js +21 -11
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{model-18ef3363.js → mapper-f6e6cafe.js} +37 -191
- package/dist/cjs/model-4ec0c36e.js +134 -0
- package/dist/cjs/overlays-8a582edf.js +76 -0
- package/dist/cjs/results-bc325974.js +24 -0
- package/dist/cjs/{scene-ffee07ee.js → scene-f4040800.js} +1 -1
- package/dist/cjs/{stencil-bd453a38.js → stencil-a664cd10.js} +1 -1
- package/dist/cjs/{streamAttributes-9d6226ac.js → streamAttributes-d6236448.js} +87 -30
- package/dist/cjs/vertex-scene-tree-search_3.cjs.entry.js +2 -2
- 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 +3 -3
- 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_3.cjs.entry.js +4 -4
- 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 +221 -75
- package/dist/cjs/{vertex-viewer-measurement-distance_2.cjs.entry.js → vertex-viewer-measurement-distance.cjs.entry.js} +30 -69
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +170 -0
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +163 -55
- package/dist/cjs/vertex-viewer-measurement-tool.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurements.cjs.entry.js +33 -4
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer.cjs.entry.js +58 -10
- package/dist/cjs/viewer.cjs.js +2 -2
- package/dist/cjs/{viewport-51aa05ab.js → viewport-8c39089f.js} +11 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/viewer/viewer.js +2 -2
- package/dist/collection/components/viewer-dom-renderer/viewer-dom-renderer.js +2 -2
- package/dist/collection/components/viewer-measurement-details/viewer-measurement-details-entry.js +14 -0
- package/dist/collection/components/viewer-measurement-details/viewer-measurement-details-results.js +22 -0
- package/dist/collection/components/viewer-measurement-details/viewer-measurement-details.css +3 -10
- package/dist/collection/components/viewer-measurement-details/viewer-measurement-details.js +125 -188
- package/dist/collection/components/viewer-measurement-distance/interactions.js +3 -14
- package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance.js +41 -1
- package/dist/collection/components/viewer-measurement-overlays/viewer-measurement-overlays-components.js +30 -0
- package/dist/collection/components/viewer-measurement-overlays/viewer-measurement-overlays.css +51 -0
- package/dist/collection/components/viewer-measurement-overlays/viewer-measurement-overlays.js +149 -0
- package/dist/collection/components/viewer-measurement-precise/viewer-measurement-precise.js +118 -26
- package/dist/collection/components/viewer-measurements/viewer-measurements.js +67 -2
- package/dist/collection/components/viewer-view-cube/viewer-view-cube.css +21 -3
- package/dist/collection/index.js +2 -2
- package/dist/collection/lib/cursors.js +7 -1
- package/dist/collection/lib/elementRectObserver.js +19 -0
- package/dist/collection/lib/interactions/interactionApi.js +53 -4
- package/dist/collection/lib/mappers/frameStreaming.js +2 -4
- package/dist/collection/lib/measurement/controller.js +21 -17
- package/dist/collection/lib/measurement/entities.js +34 -0
- package/dist/collection/lib/measurement/index.js +4 -2
- package/dist/collection/lib/measurement/interactions.js +74 -28
- package/dist/collection/lib/measurement/mapper.js +5 -5
- package/dist/collection/lib/measurement/model.js +24 -85
- package/dist/collection/lib/measurement/outcomes.js +2 -0
- package/dist/collection/lib/measurement/overlays.js +69 -0
- package/dist/collection/lib/measurement/results.js +17 -0
- package/dist/collection/lib/types/entities.js +5 -1
- package/dist/collection/lib/types/featureMap.js +14 -5
- package/dist/collection/lib/types/frame.js +3 -3
- package/dist/collection/lib/types/measurementUnits.js +7 -7
- package/dist/collection/lib/types/viewport.js +12 -1
- package/dist/collection/testing/eventually.js +30 -0
- package/dist/collection/testing/fixtures.js +11 -4
- package/dist/collection/testing/index.js +2 -1
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +851 -287
- package/dist/esm/{browser.esm-e6827921.js → browser.esm-59e914f6.js} +1 -1
- package/dist/esm/{bundle.esm-8f14ac60.js → bundle.esm-d899b2d5.js} +1 -1
- package/dist/esm/{config-a200c227.js → config-604c644e.js} +2 -2
- package/dist/esm/{cursors-5157d29d.js → cursors-a7ec4adb.js} +8 -2
- package/dist/esm/{dom-2d6a1e1e.js → dom-780d25be.js} +1 -1
- package/dist/esm/{controller-a756cf9c.js → entities-759d97cd.js} +52 -18
- package/dist/esm/{index-f0053642.js → index-10c1495a.js} +64 -3
- package/dist/esm/index.js +13 -11
- package/dist/esm/index.mjs +13 -11
- package/dist/esm/loader.js +2 -2
- package/dist/esm/loader.mjs +2 -2
- package/dist/esm/{model-f711a825.js → mapper-4b815e31.js} +37 -190
- package/dist/esm/{markup-e46623b3.js → markup-1d177b4a.js} +2 -2
- package/dist/esm/{measurement-702d6b8c.js → measurement-12cdbf5c.js} +2 -2
- package/dist/esm/model-e5a4f00f.js +132 -0
- package/dist/esm/overlays-dbe5d652.js +74 -0
- package/dist/esm/{png-decoder-59a0e9c2.js → png-decoder-3f1fa486.js} +1 -1
- package/dist/esm/results-994bdb50.js +22 -0
- package/dist/esm/{scene-16490983.js → scene-9ac8a484.js} +3 -3
- package/dist/esm/{stencil-7d04d41a.js → stencil-9bf7fb9e.js} +1 -1
- package/dist/esm/{streamAttributes-7aa486b2.js → streamAttributes-d623bb60.js} +77 -20
- package/dist/esm/{utils-8070900a.js → utils-01e4f587.js} +1 -1
- package/dist/esm/{utils-953a1619.js → utils-5e57bf24.js} +1 -1
- package/dist/esm/vertex-scene-tree-search_3.entry.js +3 -3
- 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 +5 -5
- 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_3.entry.js +6 -6
- 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 +4 -4
- package/dist/esm/vertex-viewer-markup-tool.entry.js +5 -5
- package/dist/esm/vertex-viewer-markup.entry.js +5 -5
- package/dist/esm/vertex-viewer-measurement-details.entry.js +221 -75
- package/dist/esm/{vertex-viewer-measurement-distance_2.entry.js → vertex-viewer-measurement-distance.entry.js} +35 -73
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +165 -0
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +160 -52
- package/dist/esm/vertex-viewer-measurement-tool.entry.js +6 -6
- package/dist/esm/vertex-viewer-measurements.entry.js +36 -7
- package/dist/esm/vertex-viewer-view-cube.entry.js +6 -6
- package/dist/esm/vertex-viewer.entry.js +61 -13
- package/dist/esm/viewer.js +2 -2
- package/dist/esm/{viewport-bb7c46d9.js → viewport-01c886ea.js} +12 -1
- package/dist/types/components/viewer-dom-renderer/viewer-dom-renderer.d.ts +1 -1
- package/dist/types/components/viewer-measurement-details/viewer-measurement-details-entry.d.ts +8 -0
- package/dist/types/components/viewer-measurement-details/viewer-measurement-details-results.d.ts +15 -0
- package/dist/types/components/viewer-measurement-details/viewer-measurement-details.d.ts +44 -42
- package/dist/types/components/viewer-measurement-distance/interactions.d.ts +23 -1
- package/dist/types/components/viewer-measurement-distance/viewer-measurement-distance.d.ts +8 -0
- package/dist/types/components/viewer-measurement-overlays/viewer-measurement-overlays-components.d.ts +10 -0
- package/dist/types/components/viewer-measurement-overlays/viewer-measurement-overlays.d.ts +41 -0
- package/dist/types/components/viewer-measurement-precise/viewer-measurement-precise.d.ts +62 -6
- package/dist/types/components/viewer-measurements/viewer-measurements.d.ts +12 -0
- package/dist/types/components.d.ts +103 -40
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/cursors.d.ts +5 -0
- package/dist/types/lib/elementRectObserver.d.ts +8 -0
- package/dist/types/lib/interactions/interactionApi.d.ts +32 -5
- package/dist/types/lib/measurement/controller.d.ts +8 -7
- package/dist/types/lib/measurement/entities.d.ts +10 -0
- package/dist/types/lib/measurement/index.d.ts +3 -1
- package/dist/types/lib/measurement/interactions.d.ts +19 -5
- package/dist/types/lib/measurement/mapper.d.ts +1 -1
- package/dist/types/lib/measurement/model.d.ts +18 -153
- package/dist/types/lib/measurement/outcomes.d.ts +8 -0
- package/dist/types/lib/measurement/overlays.d.ts +38 -0
- package/dist/types/lib/measurement/results.d.ts +90 -0
- package/dist/types/lib/types/entities.d.ts +5 -1
- package/dist/types/lib/types/featureMap.d.ts +2 -2
- package/dist/types/lib/types/measurementUnits.d.ts +1 -1
- package/dist/types/lib/types/viewport.d.ts +9 -1
- package/dist/types/testing/eventually.d.ts +15 -0
- package/dist/types/testing/fixtures.d.ts +2 -2
- package/dist/types/testing/index.d.ts +1 -0
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/p-081e6873.js +4 -0
- package/dist/viewer/{p-5d82c131.entry.js → p-099fe6ca.entry.js} +1 -1
- package/dist/viewer/{p-784914e4.js → p-0aba71fd.js} +1 -1
- package/dist/viewer/p-0aeab3fc.js +4 -0
- package/dist/viewer/p-0eb195dd.entry.js +4 -0
- package/dist/viewer/p-1a7df99a.entry.js +4 -0
- package/dist/viewer/{p-f70d8def.js → p-301660cf.js} +1 -1
- package/dist/viewer/{p-a0e49d10.entry.js → p-31658489.entry.js} +1 -1
- package/dist/viewer/{p-95f3a81c.entry.js → p-353cfc7a.entry.js} +1 -1
- package/dist/viewer/p-364ce21c.js +4 -0
- package/dist/viewer/{p-a5a0bf86.js → p-3f6ac74f.js} +1 -1
- package/dist/viewer/p-423410be.js +4 -0
- package/dist/viewer/{p-6f71f0f2.js → p-439220c6.js} +1 -1
- package/dist/viewer/{p-e84ed098.entry.js → p-46459921.entry.js} +1 -1
- package/dist/viewer/{p-c23a8b34.entry.js → p-4717c98e.entry.js} +1 -1
- package/dist/viewer/p-4985fad5.js +4 -0
- package/dist/viewer/{p-ba393340.entry.js → p-61b1097b.entry.js} +1 -1
- package/dist/viewer/{p-011eecd5.entry.js → p-6370098c.entry.js} +1 -1
- package/dist/viewer/p-67446e35.js +4 -0
- package/dist/viewer/p-7006fd4e.entry.js +4 -0
- package/dist/viewer/{p-a20e4ea1.entry.js → p-70ca1ea7.entry.js} +1 -1
- package/dist/viewer/p-76ec0245.js +4 -0
- package/dist/viewer/p-7cad9bf4.js +4 -0
- package/dist/viewer/p-7f25dcb5.entry.js +4 -0
- package/dist/viewer/{p-ca6bbe53.entry.js → p-8decee06.entry.js} +1 -1
- package/dist/viewer/{p-b7ffa306.entry.js → p-915d95ad.entry.js} +1 -1
- package/dist/viewer/{p-4485ac6d.js → p-a0df0e0c.js} +1 -1
- package/dist/viewer/{p-cc9888be.entry.js → p-a455ae02.entry.js} +1 -1
- package/dist/viewer/{p-a6a8026f.js → p-acf22d3e.js} +1 -1
- package/dist/viewer/{p-653aca1b.entry.js → p-b2b48a42.entry.js} +1 -1
- package/dist/viewer/p-bc9b1e67.entry.js +4 -0
- package/dist/viewer/p-c458f191.entry.js +32 -0
- package/dist/viewer/p-cafa57a6.js +4 -0
- package/dist/viewer/p-d00e9203.js +4 -0
- package/dist/viewer/{p-3e96bd62.entry.js → p-d2bcf788.entry.js} +1 -1
- package/dist/viewer/p-d90f2f6d.entry.js +4 -0
- package/dist/viewer/p-da2f4a56.js +4 -0
- package/dist/viewer/{p-5a2e34e1.entry.js → p-e07377fa.entry.js} +1 -1
- package/dist/viewer/{p-40800e8d.entry.js → p-f755af5a.entry.js} +1 -1
- package/dist/viewer/p-f7cb7e59.js +4 -0
- package/dist/viewer/p-fad9693e.js +4 -0
- package/dist/viewer/p-fe11d694.js +4 -0
- package/dist/viewer/{p-b92a3ac2.entry.js → p-fec1a8d0.entry.js} +1 -1
- package/dist/viewer/viewer.css +1 -1
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +11 -10
- package/dist/cjs/summary-7bbdb4c9.js +0 -45
- package/dist/collection/lib/measurement/summary.js +0 -38
- package/dist/esm/summary-0a3d0bf9.js +0 -43
- package/dist/types/lib/measurement/summary.d.ts +0 -11
- package/dist/viewer/p-03e482ff.js +0 -4
- package/dist/viewer/p-0c052bc8.entry.js +0 -4
- package/dist/viewer/p-148cd792.js +0 -4
- package/dist/viewer/p-26d99e2d.entry.js +0 -4
- package/dist/viewer/p-38eeacc5.js +0 -4
- package/dist/viewer/p-39d1720c.js +0 -4
- package/dist/viewer/p-5dc17b8b.js +0 -4
- package/dist/viewer/p-5fea3491.js +0 -4
- package/dist/viewer/p-6b700561.entry.js +0 -4
- package/dist/viewer/p-6cd7a6e0.js +0 -4
- package/dist/viewer/p-75337d0b.js +0 -4
- package/dist/viewer/p-b83cc8a9.js +0 -4
- package/dist/viewer/p-d2a9e047.js +0 -4
- package/dist/viewer/p-d40bd835.entry.js +0 -4
- package/dist/viewer/p-e10b1526.js +0 -4
- package/dist/viewer/p-ec8a1a68.entry.js +0 -4
- package/dist/viewer/p-f4a8c901.js +0 -4
- package/dist/viewer/p-f77dde26.entry.js +0 -4
|
@@ -1,128 +1,7 @@
|
|
|
1
|
-
import { vertexvis } from '@vertexvis/frame-streaming-protos';
|
|
2
|
-
import { Plane, Vector3 } from '@vertexvis/geometry';
|
|
3
|
-
import { MeasureEntity } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';
|
|
4
1
|
import { Disposable, Listener } from '@vertexvis/utils';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface MinimumDistanceMeasurementResult {
|
|
9
|
-
/**
|
|
10
|
-
* The type.
|
|
11
|
-
*/
|
|
12
|
-
type: 'minimum-distance';
|
|
13
|
-
/**
|
|
14
|
-
* The distance between two points.
|
|
15
|
-
*/
|
|
16
|
-
distance: number;
|
|
17
|
-
/**
|
|
18
|
-
* The closest point of the first entity, in world coordinates.
|
|
19
|
-
*/
|
|
20
|
-
closestPoint1: Vector3.Vector3;
|
|
21
|
-
/**
|
|
22
|
-
* The closest point of the second entity, in world coordinates.
|
|
23
|
-
*/
|
|
24
|
-
closestPoint2: Vector3.Vector3;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* A measurement result that represents the angle between two planar surfaces.
|
|
28
|
-
*/
|
|
29
|
-
export interface PlanarAngleMeasurementResult {
|
|
30
|
-
/**
|
|
31
|
-
* The type.
|
|
32
|
-
*/
|
|
33
|
-
type: 'planar-angle';
|
|
34
|
-
/**
|
|
35
|
-
* The angle between two planes, in radians.
|
|
36
|
-
*/
|
|
37
|
-
angle: number;
|
|
38
|
-
/**
|
|
39
|
-
* The plane of the first entity.
|
|
40
|
-
*/
|
|
41
|
-
plane1: Plane.Plane;
|
|
42
|
-
/**
|
|
43
|
-
* The plane of the second entity.
|
|
44
|
-
*/
|
|
45
|
-
plane2: Plane.Plane;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A measurement result that represents the distance between two planar
|
|
49
|
-
* surfaces.
|
|
50
|
-
*/
|
|
51
|
-
export interface PlanarDistanceMeasurementResult {
|
|
52
|
-
/**
|
|
53
|
-
* The type.
|
|
54
|
-
*/
|
|
55
|
-
type: 'planar-distance';
|
|
56
|
-
/**
|
|
57
|
-
* The distance between the two planes.
|
|
58
|
-
*/
|
|
59
|
-
distance: number;
|
|
60
|
-
/**
|
|
61
|
-
* The plane of the first entity.
|
|
62
|
-
*/
|
|
63
|
-
plane1: Plane.Plane;
|
|
64
|
-
/**
|
|
65
|
-
* The plane of the second entity.
|
|
66
|
-
*/
|
|
67
|
-
plane2: Plane.Plane;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* A measurement result that represents the distance between two points.
|
|
71
|
-
*/
|
|
72
|
-
export interface PointToPointMeasurementResult {
|
|
73
|
-
/**
|
|
74
|
-
* The type.
|
|
75
|
-
*/
|
|
76
|
-
type: 'point-to-point';
|
|
77
|
-
/**
|
|
78
|
-
* The distance, in world units, between two points. This value is only
|
|
79
|
-
* populated if the result is valid.
|
|
80
|
-
*/
|
|
81
|
-
distance?: number;
|
|
82
|
-
/**
|
|
83
|
-
* The first point, in world units.
|
|
84
|
-
*/
|
|
85
|
-
start: Vector3.Vector3;
|
|
86
|
-
/**
|
|
87
|
-
* The second point, in world units.
|
|
88
|
-
*/
|
|
89
|
-
end: Vector3.Vector3;
|
|
90
|
-
/**
|
|
91
|
-
* Indicates if this result is valid. A value of `false` indicates that one of
|
|
92
|
-
* the points does not touch any geometry.
|
|
93
|
-
*/
|
|
94
|
-
valid: boolean;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* A measurement result that represents the surface area of one or more faces.
|
|
98
|
-
*/
|
|
99
|
-
export interface SurfaceAreaMeasurementResult {
|
|
100
|
-
/**
|
|
101
|
-
* The type.
|
|
102
|
-
*/
|
|
103
|
-
type: 'surface-area';
|
|
104
|
-
/**
|
|
105
|
-
* The total area of selected face or faces.
|
|
106
|
-
*/
|
|
107
|
-
area: number;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* A type representing the possible measurement results.
|
|
111
|
-
*/
|
|
112
|
-
export declare type MeasurementResult = MinimumDistanceMeasurementResult | PlanarAngleMeasurementResult | PlanarDistanceMeasurementResult | SurfaceAreaMeasurementResult;
|
|
113
|
-
/**
|
|
114
|
-
* An outcome containing the results of the measurement.
|
|
115
|
-
*/
|
|
116
|
-
export interface MeasurementOutcome {
|
|
117
|
-
results: MeasurementResult[];
|
|
118
|
-
}
|
|
119
|
-
export declare class MeasurementEntity {
|
|
120
|
-
readonly point: Vector3.Vector3;
|
|
121
|
-
readonly modelEntity: Uint8Array;
|
|
122
|
-
constructor(point: Vector3.Vector3, modelEntity: Uint8Array);
|
|
123
|
-
static fromHit(hit: vertexvis.protobuf.stream.IHit): MeasurementEntity;
|
|
124
|
-
toProto(): MeasureEntity;
|
|
125
|
-
}
|
|
2
|
+
import { MeasurementEntity } from './entities';
|
|
3
|
+
import { MeasurementOutcome } from './outcomes';
|
|
4
|
+
import { MeasurementResult } from './results';
|
|
126
5
|
/**
|
|
127
6
|
* A model representing the state of measurement.
|
|
128
7
|
*
|
|
@@ -135,9 +14,10 @@ export declare class MeasurementEntity {
|
|
|
135
14
|
*/
|
|
136
15
|
export declare class MeasurementModel {
|
|
137
16
|
private entities;
|
|
17
|
+
private outcome?;
|
|
138
18
|
private results;
|
|
139
|
-
private resultsChanged;
|
|
140
19
|
private entitiesChanged;
|
|
20
|
+
private outcomeChanged;
|
|
141
21
|
/**
|
|
142
22
|
* Registers an entity to be measured with the model.
|
|
143
23
|
*
|
|
@@ -145,37 +25,30 @@ export declare class MeasurementModel {
|
|
|
145
25
|
* @returns `true` if the entity has been added.
|
|
146
26
|
*/
|
|
147
27
|
addEntity(entity: MeasurementEntity): boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Adds a measurement result to the model.
|
|
150
|
-
*
|
|
151
|
-
* Emits a _result changed_ event.
|
|
152
|
-
*
|
|
153
|
-
* @param result A result to add.
|
|
154
|
-
* @returns `true` if the result has been added.
|
|
155
|
-
*/
|
|
156
|
-
addResult(result: MeasurementResult): boolean;
|
|
157
28
|
/**
|
|
158
29
|
* Clears all registered entities from the model.
|
|
159
30
|
*/
|
|
160
31
|
clearEntities(): void;
|
|
161
32
|
/**
|
|
162
|
-
* Clears
|
|
163
|
-
*
|
|
164
|
-
* Emits a _result changed_ event.
|
|
33
|
+
* Clears the outcome containing the results of a measurement.
|
|
165
34
|
*/
|
|
166
|
-
|
|
35
|
+
clearOutcome(): void;
|
|
167
36
|
/**
|
|
168
|
-
*
|
|
37
|
+
* Sets the outcome containing the results of a measurement.
|
|
169
38
|
*
|
|
170
|
-
* Emits a
|
|
39
|
+
* Emits a _outcome changed_ event.
|
|
171
40
|
*
|
|
172
|
-
* @param outcome The outcome
|
|
41
|
+
* @param outcome The outcome containing results.
|
|
173
42
|
*/
|
|
174
|
-
|
|
43
|
+
setOutcome(outcome: MeasurementOutcome | undefined): void;
|
|
175
44
|
/**
|
|
176
45
|
* Returns all the entities registered with the model.
|
|
177
46
|
*/
|
|
178
47
|
getEntities(): MeasurementEntity[];
|
|
48
|
+
/**
|
|
49
|
+
* Returns the outcome that contains the results of a measurement.
|
|
50
|
+
*/
|
|
51
|
+
getOutcome(): MeasurementOutcome | undefined;
|
|
179
52
|
/**
|
|
180
53
|
* Returns all the measurement results of the model.
|
|
181
54
|
*/
|
|
@@ -187,14 +60,6 @@ export declare class MeasurementModel {
|
|
|
187
60
|
* @returns `true` if the entity was removed.
|
|
188
61
|
*/
|
|
189
62
|
removeEntity(entity: MeasurementEntity): boolean;
|
|
190
|
-
/**
|
|
191
|
-
* Removes a measurement result from the model.
|
|
192
|
-
*
|
|
193
|
-
* Emits a _result changed_ event.
|
|
194
|
-
*
|
|
195
|
-
* @param result The result to remove.
|
|
196
|
-
*/
|
|
197
|
-
removeResult(result: MeasurementResult): boolean;
|
|
198
63
|
/**
|
|
199
64
|
* Sets the set of entities to be measured with the model.
|
|
200
65
|
*
|
|
@@ -203,13 +68,13 @@ export declare class MeasurementModel {
|
|
|
203
68
|
*/
|
|
204
69
|
setEntities(entities: Set<MeasurementEntity>): boolean;
|
|
205
70
|
/**
|
|
206
|
-
* Registers an event listener that will be invoked when the model's
|
|
207
|
-
*
|
|
71
|
+
* Registers an event listener that will be invoked when the model's outcome
|
|
72
|
+
* changes.
|
|
208
73
|
*
|
|
209
74
|
* @param listener The listener to add.
|
|
210
75
|
* @returns A disposable that can be used to remove the listener.
|
|
211
76
|
*/
|
|
212
|
-
|
|
77
|
+
onOutcomeChanged(listener: Listener<MeasurementOutcome | undefined>): Disposable;
|
|
213
78
|
/**
|
|
214
79
|
* Registers an event listener that will be invoked when the model's
|
|
215
80
|
* measurement entities change.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Vector3 } from '@vertexvis/geometry';
|
|
2
|
+
import { Disposable, Listener } from '@vertexvis/utils';
|
|
3
|
+
import { MinimumDistanceMeasurementResult } from './results';
|
|
4
|
+
export interface LineOverlay extends Disposable {
|
|
5
|
+
type: 'line';
|
|
6
|
+
id: string;
|
|
7
|
+
start: Vector3.Vector3;
|
|
8
|
+
end: Vector3.Vector3;
|
|
9
|
+
}
|
|
10
|
+
export interface DistanceVectorOverlay extends Disposable {
|
|
11
|
+
type: 'distance-vector';
|
|
12
|
+
id: string;
|
|
13
|
+
x: {
|
|
14
|
+
start: Vector3.Vector3;
|
|
15
|
+
end: Vector3.Vector3;
|
|
16
|
+
};
|
|
17
|
+
y: {
|
|
18
|
+
start: Vector3.Vector3;
|
|
19
|
+
end: Vector3.Vector3;
|
|
20
|
+
};
|
|
21
|
+
z: {
|
|
22
|
+
start: Vector3.Vector3;
|
|
23
|
+
end: Vector3.Vector3;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare type MeasurementOverlay = LineOverlay | DistanceVectorOverlay;
|
|
27
|
+
export declare class MeasurementOverlayManager {
|
|
28
|
+
private overlays;
|
|
29
|
+
private overlaysChanged;
|
|
30
|
+
addLineFromResult(result: MinimumDistanceMeasurementResult): LineOverlay;
|
|
31
|
+
addLine(start: Vector3.Vector3, end: Vector3.Vector3): LineOverlay;
|
|
32
|
+
addDistanceVectorFromResult(result: MinimumDistanceMeasurementResult): DistanceVectorOverlay;
|
|
33
|
+
addDistanceVector(start: Vector3.Vector3, end: Vector3.Vector3): DistanceVectorOverlay;
|
|
34
|
+
private addOverlay;
|
|
35
|
+
getOverlays(): MeasurementOverlay[];
|
|
36
|
+
private remove;
|
|
37
|
+
onOverlaysChanged(listener: Listener<MeasurementOverlay[]>): Disposable;
|
|
38
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Plane, Vector3 } from '@vertexvis/geometry';
|
|
2
|
+
/**
|
|
3
|
+
* A measurement result that represents the closets point between two entities.
|
|
4
|
+
*/
|
|
5
|
+
export interface MinimumDistanceMeasurementResult {
|
|
6
|
+
/**
|
|
7
|
+
* The type.
|
|
8
|
+
*/
|
|
9
|
+
type: 'minimum-distance';
|
|
10
|
+
/**
|
|
11
|
+
* The distance between two points.
|
|
12
|
+
*/
|
|
13
|
+
distance: number;
|
|
14
|
+
/**
|
|
15
|
+
* The closest point of the first entity, in world coordinates.
|
|
16
|
+
*/
|
|
17
|
+
point1: Vector3.Vector3;
|
|
18
|
+
/**
|
|
19
|
+
* The closest point of the second entity, in world coordinates.
|
|
20
|
+
*/
|
|
21
|
+
point2: Vector3.Vector3;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A measurement result that represents the angle between two planar surfaces.
|
|
25
|
+
*/
|
|
26
|
+
export interface PlanarAngleMeasurementResult {
|
|
27
|
+
/**
|
|
28
|
+
* The type.
|
|
29
|
+
*/
|
|
30
|
+
type: 'planar-angle';
|
|
31
|
+
/**
|
|
32
|
+
* The angle between two planes, in radians.
|
|
33
|
+
*/
|
|
34
|
+
angle: number;
|
|
35
|
+
/**
|
|
36
|
+
* The plane of the first entity.
|
|
37
|
+
*/
|
|
38
|
+
plane1: Plane.Plane;
|
|
39
|
+
/**
|
|
40
|
+
* The plane of the second entity.
|
|
41
|
+
*/
|
|
42
|
+
plane2: Plane.Plane;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A measurement result that represents the distance between two planar
|
|
46
|
+
* surfaces.
|
|
47
|
+
*/
|
|
48
|
+
export interface PlanarDistanceMeasurementResult {
|
|
49
|
+
/**
|
|
50
|
+
* The type.
|
|
51
|
+
*/
|
|
52
|
+
type: 'planar-distance';
|
|
53
|
+
/**
|
|
54
|
+
* The distance between the two planes.
|
|
55
|
+
*/
|
|
56
|
+
distance: number;
|
|
57
|
+
/**
|
|
58
|
+
* The plane of the first entity.
|
|
59
|
+
*/
|
|
60
|
+
plane1: Plane.Plane;
|
|
61
|
+
/**
|
|
62
|
+
* The plane of the second entity.
|
|
63
|
+
*/
|
|
64
|
+
plane2: Plane.Plane;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A measurement result that represents the surface area of one or more faces.
|
|
68
|
+
*/
|
|
69
|
+
export interface SurfaceAreaMeasurementResult {
|
|
70
|
+
/**
|
|
71
|
+
* The type.
|
|
72
|
+
*/
|
|
73
|
+
type: 'surface-area';
|
|
74
|
+
/**
|
|
75
|
+
* The total area of selected face or faces.
|
|
76
|
+
*/
|
|
77
|
+
area: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A type representing the possible measurement results.
|
|
81
|
+
*/
|
|
82
|
+
export declare type MeasurementResult = MinimumDistanceMeasurementResult | PlanarAngleMeasurementResult | PlanarDistanceMeasurementResult | SurfaceAreaMeasurementResult;
|
|
83
|
+
/**
|
|
84
|
+
* Constructs a new measurement result from the given points.
|
|
85
|
+
*
|
|
86
|
+
* @param point1 A starting point.
|
|
87
|
+
* @param point2 An ending point.
|
|
88
|
+
* @returns A new measurement result.
|
|
89
|
+
*/
|
|
90
|
+
export declare function makeMinimumDistanceResult(point1: Vector3.Vector3, point2: Vector3.Vector3): MinimumDistanceMeasurementResult;
|
|
@@ -24,7 +24,7 @@ export declare class FeatureMap implements FrameImageLike {
|
|
|
24
24
|
* @param imageAttr The image attributes of the frame.
|
|
25
25
|
* @returns A new feature map.
|
|
26
26
|
*/
|
|
27
|
-
static fromPng(png: Pick<DecodedPng, 'data'>, imageAttr: ImageAttributesLike): FeatureMap;
|
|
27
|
+
static fromPng(png: Pick<DecodedPng, 'data' | 'width' | 'height' | 'channels'>, imageAttr: ImageAttributesLike): FeatureMap;
|
|
28
28
|
/**
|
|
29
29
|
* Returns the type of entity at the given frame location. If no entity is
|
|
30
30
|
* found, then `undefined` is returned.
|
|
@@ -33,6 +33,6 @@ export declare class FeatureMap implements FrameImageLike {
|
|
|
33
33
|
* @returns The type of entity at the given location, or `undefined` if no
|
|
34
34
|
* entity exists.
|
|
35
35
|
*/
|
|
36
|
-
getEntityType(point: Point.Point): EntityType
|
|
36
|
+
getEntityType(point: Point.Point): EntityType;
|
|
37
37
|
private getColor;
|
|
38
38
|
}
|
|
@@ -4,7 +4,7 @@ import { Vector3 } from '@vertexvis/geometry';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare type DistanceUnitType = 'millimeters' | 'centimeters' | 'meters' | 'inches' | 'feet' | 'yards';
|
|
6
6
|
export declare type AngleUnitType = 'degrees' | 'radians';
|
|
7
|
-
interface Unit {
|
|
7
|
+
export interface Unit {
|
|
8
8
|
name: string;
|
|
9
9
|
abbreviatedName: string;
|
|
10
10
|
converter: UnitConverter<number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dimensions, Point, Ray, Rectangle, Vector3 } from '@vertexvis/geometry';
|
|
1
|
+
import { Dimensions, Matrix4, Point, Ray, Rectangle, Vector3 } from '@vertexvis/geometry';
|
|
2
2
|
import { DepthBuffer } from './depthBuffer';
|
|
3
3
|
import type { FrameImageLike } from './frame';
|
|
4
4
|
import { FramePerspectiveCamera } from './frame';
|
|
@@ -48,6 +48,14 @@ export declare class Viewport implements Dimensions.Dimensions {
|
|
|
48
48
|
* @returns A 2D point in the coordinate space of the viewport.
|
|
49
49
|
*/
|
|
50
50
|
transformVectorToViewport(ndc: Vector3.Vector3): Point.Point;
|
|
51
|
+
/**
|
|
52
|
+
* Transforms a world point to 2D point in viewport space.
|
|
53
|
+
*
|
|
54
|
+
* @param worldPt The world point to transform.
|
|
55
|
+
* @param projectionViewMatrix The projection matrix to transform a 3D point to 2D point.
|
|
56
|
+
* @returns A point in viewport space.
|
|
57
|
+
*/
|
|
58
|
+
transformWorldToViewport(worldPt: Vector3.Vector3, projectionViewMatrix: Matrix4.Matrix4): Point.Point;
|
|
51
59
|
transformPointToViewport(pt: Point.Point, image: FrameImageLike): Point.Point;
|
|
52
60
|
/**
|
|
53
61
|
* Transforms a point in viewport coordinate space to a point in a frame's
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs a function that contains assertions until they pass, or until the number
|
|
3
|
+
* of attempts are exhausted. This helper is handy for async operations where
|
|
4
|
+
* you are not able to know if they've completed or not.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* test('it works', async () => {
|
|
9
|
+
* await eventually(() => expect(1 + 1).toEqual(2));
|
|
10
|
+
* })
|
|
11
|
+
*/
|
|
12
|
+
export declare function eventually(assertions: () => void | Promise<void>, { attempts, delay }?: {
|
|
13
|
+
attempts?: number;
|
|
14
|
+
delay?: number;
|
|
15
|
+
}): Promise<void>;
|
|
@@ -4,9 +4,9 @@ import { Color } from '@vertexvis/utils';
|
|
|
4
4
|
import { PointToPointHitTester } from '../components/viewer-measurement-distance/hitTest';
|
|
5
5
|
import { PointToPointHitProvider } from '../components/viewer-measurement-distance/interactions';
|
|
6
6
|
import { RaycasterLike } from '../lib/scenes/raycaster';
|
|
7
|
-
import { DepthBuffer, FeatureMap, ImageAttributesLike, StencilBuffer, Viewport } from '../lib/types';
|
|
7
|
+
import { DepthBuffer, FeatureMap, Frame, ImageAttributesLike, StencilBuffer, Viewport } from '../lib/types';
|
|
8
8
|
export declare const drawFramePayload: DrawFramePayload;
|
|
9
|
-
export declare
|
|
9
|
+
export declare function makeFrame(): Frame;
|
|
10
10
|
export declare function makeImagePng(width: number, height: number): Uint8Array;
|
|
11
11
|
export declare function makeDepthImagePng(width: number, height: number, value?: number): Uint8Array;
|
|
12
12
|
export declare function makeDepthImageBytes(width: number, height: number, value?: number): Uint16Array;
|
package/dist/viewer/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**!
|
|
2
2
|
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
export{c as ColorMaterial,l as LoadableResource,S as Scene,a as SynchronizedClock}from"./p-
|
|
4
|
+
export{c as ColorMaterial,l as LoadableResource,S as Scene,a as SynchronizedClock}from"./p-acf22d3e.js";export{C as CursorManager,m as measurementCursor,a as measurementWithArrowCursor}from"./p-d00e9203.js";export{M as MeasurementController,a as MeasurementEntity}from"./p-364ce21c.js";export{M as MeasurementModel}from"./p-da2f4a56.js";export{M as MeasurementOverlayManager}from"./p-76ec0245.js";export{m as makeMinimumDistanceResult}from"./p-67446e35.js";export{A as AngleUnits,d as AreaUnits,D as DistanceUnits,E as EntityType,F as ReceivedFrame,a as ReceivedFrameImage,b as ReceivedFrameScene,c as ReceivedPerspectiveCamera}from"./p-fe11d694.js";export{A as ArrowMarkup,C as CircleMarkup,F as FreeformMarkup}from"./p-081e6873.js";export{V as Viewport}from"./p-4985fad5.js";import"./p-301660cf.js";import"./p-0aba71fd.js";import"./p-f7cb7e59.js";import"./p-112455b1.js";import"./p-3a20a038.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{p as s,g as r}from"./p-0aba71fd.js";import{b as o}from"./p-301660cf.js";class l{constructor(r){var l,i,a;this.start=null!==(l=r.start)&&void 0!==l?l:s.create(),this.end=null!==(i=r.end)&&void 0!==i?i:s.create(),this.id=null!==(a=r.id)&&void 0!==a?a:`arrow-markup--${o.create()}`}}class i{constructor(s){var l,i;this.bounds=null!==(l=s.bounds)&&void 0!==l?l:r.create(0,0,0,0),this.id=null!==(i=s.id)&&void 0!==i?i:`circle-markup--${o.create()}`}}class a{constructor(s){var l,i,a;this.bounds=null!==(l=s.bounds)&&void 0!==l?l:r.create(0,0,0,0),this.points=null!==(i=s.points)&&void 0!==i?i:[],this.id=null!==(a=s.id)&&void 0!==a?a:`freeform-markup--${o.create()}`}}export{l as A,i as C,a as F}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**!
|
|
2
2
|
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as t,H as r}from"./p-
|
|
4
|
+
import{r as e,h as t,H as r}from"./p-cafa57a6.js";let o=class{constructor(t){e(this,t)}render(){return t(r,null,t("slot",null))}};o.style=":host{--scene-tree-toolbar-group-item-gap:calc(\n var(--scene-tree-toolbar-content-gap) / 2\n );display:flex}::slotted(:not(:first-child)){margin-left:var(--scene-tree-toolbar-group-item-gap)}";export{o as vertex_scene_tree_toolbar_group}
|
|
@@ -15,4 +15,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
15
15
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
16
|
PERFORMANCE OF THIS SOFTWARE.
|
|
17
17
|
***************************************************************************** */
|
|
18
|
-
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function u(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(u.prototype=r.prototype,new u)}var r=function(){return(r=Object.assign||function(n){for(var t,r=1,u=arguments.length;r<u;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)};function u(n,t){var r={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&t.indexOf(u)<0&&(r[u]=n[u]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(u=Object.getOwnPropertySymbols(n);o<u.length;o++)t.indexOf(u[o])<0&&Object.prototype.propertyIsEnumerable.call(n,u[o])&&(r[u[o]]=n[u[o]])}return r}function o(n,t,r,u){return new(r||(r=Promise))((function(o,e){function i(n){try{c(u.next(n))}catch(n){e(n)}}function a(n){try{c(u.throw(n))}catch(n){e(n)}}function c(n){var t;n.done?o(n.value):(t=n.value,t instanceof r?t:new r((function(n){n(t)}))).then(i,a)}c((u=u.apply(n,t||[])).next())}))}function e(n,t){var r,u,o,e,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function a(e){return function(a){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,u&&(o=2&e[0]?u.return:e[0]?u.throw||((o=u.return)&&o.call(u),0):u.next)&&!(o=o.call(u,e[1])).done)return o;switch(u=0,o&&(e=[2&e[0],o.value]),e[0]){case 0:case 1:o=e;break;case 4:return i.label++,{value:e[1],done:!1};case 5:i.label++,u=e[1],e=[0];continue;case 7:e=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==e[0]&&2!==e[0])){i=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3])){i.label=e[1];break}if(6===e[0]&&i.label<o[1]){i.label=o[1],o=e;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(e);break}o[2]&&i.ops.pop(),i.trys.pop();continue}e=t.call(n,i)}catch(n){e=[6,n],u=0}finally{r=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,a])}}}function i(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var u,o,e=r.call(n),i=[];try{for(;(void 0===t||t-- >0)&&!(u=e.next()).done;)i.push(u.value)}catch(n){o={error:n}}finally{try{u&&!u.done&&(r=e.return)&&r.call(e)}finally{if(o)throw o.error}}return i}function a(n,t,r){if(r||2===arguments.length)for(var u,o=0,e=t.length;o<e;o++)!u&&o in t||(u||(u=Array.prototype.slice.call(t,0,o)),u[o]=t[o]);return n.concat(u||Array.prototype.slice.call(t))}function c(n,t,r){return Math.max(t,Math.min(r,n))}function f(n,t,r){return(r=c(r,0,1))*(t-n)+n}function h(n,t){return void 0===n&&(n=0),void 0===t&&(t=0),{x:n,y:t}}function l(n,t){return{x:n.x-t.x,y:n.y-t.y}}function v(n,t){return{x:n.x+t.x,y:n.y+t.y}}function s(n,t){return n.x===t.x&&n.y===t.y}var d=Object.freeze({__proto__:null,create:h,polar:function(n,t){return h(Math.cos(t)*n,Math.sin(t)*n)},distance:function(n,t){var r=l(n,t);return Math.sqrt(r.x*r.x+r.y*r.y)},subtract:l,add:v,isEqual:s,lerp:function(n,t,r){return{x:f(n.x,t.x,r),y:f(n.y,t.y,r)}},negate:function(n){return h(-n.x,-n.y)},scale:function(n,t,r){return{x:n.x*t,y:n.y*r}},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?h(t[0],t[1]):h(t.x,t.y)}});function M(n){return(n+3600)%360}function y(n){return n*(180/Math.PI)}function m(n){return n*(Math.PI/180)}var x=Object.freeze({__proto__:null,fromPoints:function(n,t){var r=l(t,n);return Math.atan2(r.y,r.x)},fromPointsInDegrees:function(n,t){var r=l(t,n);return M(y(Math.atan2(r.y,r.x))-270)},normalize:M,toDegrees:y,toRadians:m});function _(n,t,r,u,o,e,i,a,c,f,h,l,v,s,d,M){return[n,o,c,v,t,e,f,s,r,i,h,d,u,a,l,M]}function z(n){return[1,0,0,0,0,1,0,0,0,0,1,0,n.x,n.y,n.z,1]}function b(n){var t=n.x,r=n.y,u=n.z,o=n.w,e=t+t,i=r+r,a=u+u,c=t*e,f=t*i,h=t*a,l=r*i,v=r*a,s=u*a,d=o*e,M=o*i,y=o*a;return[1-(l+s),f+y,h-M,0,f-y,1-(c+s),v+d,0,h+M,v-d,1-(c+l),0,0,0,0,1]}function p(n){return[n.x,0,0,0,0,n.y,0,0,0,0,n.z,0,0,0,0,1]}function w(n,t,r,u,o,e){return[2*o/(t-n),0,0,0,0,2*o/(r-u),0,0,(t+n)/(t-n),(r+u)/(r-u),-(e+o)/(e-o),-1,0,0,-2*e*o/(e-o),0]}function O(n,t){var r=n[0],u=n[4],o=n[8],e=n[12],i=n[1],a=n[5],c=n[9],f=n[13],h=n[2],l=n[6],v=n[10],s=n[14],d=n[3],M=n[7],y=n[11],m=n[15],x=t[0],_=t[4],z=t[8],b=t[12],p=t[1],w=t[5],O=t[9],j=t[13],g=t[2],k=t[6],A=t[10],S=t[14],P=t[3],T=t[7],q=t[11],J=t[15],R=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return R[0]=r*x+u*p+o*g+e*P,R[4]=r*_+u*w+o*k+e*T,R[8]=r*z+u*O+o*A+e*q,R[12]=r*b+u*j+o*S+e*J,R[1]=i*x+a*p+c*g+f*P,R[5]=i*_+a*w+c*k+f*T,R[9]=i*z+a*O+c*A+f*q,R[13]=i*b+a*j+c*S+f*J,R[2]=h*x+l*p+v*g+s*P,R[6]=h*_+l*w+v*k+s*T,R[10]=h*z+l*O+v*A+s*q,R[14]=h*b+l*j+v*S+s*J,R[3]=d*x+M*p+y*g+m*P,R[7]=d*_+M*w+y*k+m*T,R[11]=d*z+M*O+y*A+m*q,R[15]=d*b+M*j+y*S+m*J,R}function j(n){return{m11:n[0],m12:n[4],m13:n[8],m14:n[12],m21:n[1],m22:n[5],m23:n[9],m24:n[13],m31:n[2],m32:n[6],m33:n[10],m34:n[14],m41:n[3],m42:n[7],m43:n[11],m44:n[15]}}var g=Object.freeze({__proto__:null,fromValues:_,fromObject:function(n){return _(n.m11,n.m12,n.m13,n.m14,n.m21,n.m22,n.m23,n.m24,n.m31,n.m32,n.m33,n.m34,n.m41,n.m42,n.m43,n.m44)},makeIdentity:function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},makeZero:function(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},makeTranslation:z,makeRotation:b,makeScale:p,makeTRS:function(n,t,r){var u=z(n),o=b(t),e=p(r);return O(O(u,o),e)},makeBasis:function(n,t,r){return[n.x,n.y,n.z,0,t.x,t.y,t.z,0,r.x,r.y,r.z,0,0,0,0,1]},makeRotationAxis:function(n,t){var r=Math.cos(t),u=Math.sin(t),o=1-r,e=n.x,i=n.y,a=n.z,c=o*e,f=o*i;return[c*e+r,c*i+u*a,c*a-u*i,0,c*i-u*a,f*i+r,f*a+u*e,0,c*a+u*i,f*a-u*e,o*a*a+r,0,0,0,0,1]},makeFrustum:w,makePerspective:function(n,t,r,u){var o=n*Math.tan(m(r/2)),e=o*u;return w(-e,e,o,-o,n,t)},makeLookAtView:function(n,t,r){var u=T(F(n,t)),o=T(R(r,u)),e=R(u,o),i=-D(o,n),a=-D(e,n),c=-D(u,n);return[o.x,e.x,u.x,0,o.y,e.y,u.y,0,o.z,e.z,u.z,0,i,a,c,1]},makeLookAt:function(n,t,r){var u=T(F(n,t)),o=T(R(r,u)),e=R(u,o);return[o.x,o.y,o.z,0,e.x,e.y,e.z,0,u.x,u.y,u.z,0,n.x,n.y,n.z,1]},invert:function(n){var t=n[0],r=n[1],u=n[2],o=n[3],e=n[4],i=n[5],a=n[6],c=n[7],f=n[8],h=n[9],l=n[10],v=n[11],s=n[12],d=n[13],M=n[14],y=n[15],m=t*i-r*e,x=t*a-u*e,_=t*c-o*e,z=r*a-u*i,b=r*c-o*i,p=u*c-o*a,w=f*d-h*s,O=f*M-l*s,j=f*y-v*s,g=h*M-l*d,k=h*y-v*d,A=l*y-v*M,S=m*A-x*k+_*g+z*j-b*O+p*w;return S?[(i*A-a*k+c*g)*(S=1/S),(u*k-r*A-o*g)*S,(d*p-M*b+y*z)*S,(l*b-h*p-v*z)*S,(a*j-e*A-c*O)*S,(t*A-u*j+o*O)*S,(M*_-s*p-y*x)*S,(f*p-l*_+v*x)*S,(e*k-i*j+c*w)*S,(r*j-t*k-o*w)*S,(s*b-d*_+y*m)*S,(h*_-f*b-v*m)*S,(i*O-e*g-a*w)*S,(t*g-r*O+u*w)*S,(d*x-s*z-M*m)*S,(f*z-h*x+l*m)*S]:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},lookAt:function(n,t,u,o){var e=F(t,u);0===J(e)&&(e=r(r({},e),{z:1}));var i=R(o,e=T(e));0===J(i)&&(i=R(o,e=T(e=1===Math.abs(o.z)?r(r({},e),{x:e.x+1e-4}):r(r({},e),{z:e.z+1e-4}))));var c=R(e,i=T(i)),f=a([],n,!0);return f[0]=i.x,f[4]=c.x,f[8]=e.x,f[1]=i.y,f[5]=c.y,f[9]=e.y,f[2]=i.z,f[6]=c.z,f[10]=e.z,f},multiply:O,transpose:function(n){return[n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15]]},scale:function(n,t){var r=t.x,u=t.y,o=t.z,e=a([],n,!0);return e[0]*=r,e[4]*=u,e[8]*=o,e[1]*=r,e[5]*=u,e[9]*=o,e[2]*=r,e[6]*=u,e[10]*=o,e[3]*=r,e[7]*=u,e[11]*=o,e},position:function(n,t){var r=a([],n,!0);return r[12]=t[12],r[13]=t[13],r[14]=t[14],r},toObject:j,isType:function(n){return Array.isArray(n)&&16===n.length}});function k(){for(var n,t,r,u,o,e,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return 1===i.length?{x:null!==(n=i[0].x)&&void 0!==n?n:0,y:null!==(t=i[0].y)&&void 0!==t?t:0,z:null!==(r=i[0].z)&&void 0!==r?r:0}:3===i.length?{x:null!==(u=i[0])&&void 0!==u?u:0,y:null!==(o=i[1])&&void 0!==o?o:0,z:null!==(e=i[2])&&void 0!==e?e:0}:{x:0,y:0,z:0}}function A(n){var t=j(n);return{x:Math.hypot(t.m11,t.m21,t.m31),y:Math.hypot(t.m12,t.m22,t.m32),z:Math.hypot(t.m13,t.m23,t.m33)}}function S(){return k(0,0,-1)}function P(){return k(0,0,0)}function T(n){var t=q(n);return{x:n.x/t,y:n.y/t,z:n.z/t}}function q(n){return Math.sqrt(J(n))}function J(n){return n.x*n.x+n.y*n.y+n.z*n.z}function R(n,t){return{x:n.y*t.z-n.z*t.y,y:n.z*t.x-n.x*t.z,z:n.x*t.y-n.y*t.x}}function N(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(n,t){return{x:n.x+t.x,y:n.y+t.y,z:n.z+t.z}}),n)}function F(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(n,t){return{x:n.x-t.x,y:n.y-t.y,z:n.z-t.z}}),n)}function E(n,t){return{x:t.x*n,y:t.y*n,z:t.z*n}}function D(n,t){return n.x*t.x+n.y*t.y+n.z*t.z}function L(n,t){var r=n.x,u=n.y,o=n.z,e=1/(t[3]*r+t[7]*u+t[11]*o+t[15]);return{x:(t[0]*r+t[4]*u+t[8]*o+t[12])*e,y:(t[1]*r+t[5]*u+t[9]*o+t[13])*e,z:(t[2]*r+t[6]*u+t[10]*o+t[14])*e}}function V(n,t){return Math.sqrt(C(n,t))}function C(n,t){var r=F(n,t),u=r.x,o=r.y,e=r.z;return u*u+o*o+e*e}function I(n,t){return k(Math.max(n.x,t.x),Math.max(n.y,t.y),Math.max(n.z,t.z))}function B(n,t){return k(Math.min(n.x,t.x),Math.min(n.y,t.y),Math.min(n.z,t.z))}function G(n,t,r){return{x:f(n.x,t.x,r),y:f(n.y,t.y,r),z:f(n.z,t.z,r)}}var W=Object.freeze({__proto__:null,create:k,isValid:function(n){return[n.x,n.y,n.z].every((function(n){return isFinite(n)&&!isNaN(n)}))},fromMatrixScale:A,fromMatrixPosition:function(n){var t=j(n);return{x:t.m14,y:t.m24,z:t.m34}},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?k(t[0],t[1],t[2]):k(t.x,t.y,t.z)},fromArray:function(n,t){return void 0===t&&(t=0),k(n[t],n[t+1],n[t+2])},toArray:function(n){return[n.x,n.y,n.z]},right:function(){return k(1,0,0)},up:function(){return k(0,1,0)},forward:S,left:function(){return k(-1,0,0)},down:function(){return k(0,-1,0)},back:function(){return k(0,0,1)},origin:P,normalize:T,magnitude:q,magnitudeSquared:J,cross:R,add:N,subtract:F,multiply:function(n,t){return{x:n.x*t.x,y:n.y*t.y,z:n.z*t.z}},scale:E,dot:D,angleTo:function(n,t){var r=D(n,t)/(q(n)*q(t));return Math.acos(r)},project:function(n,t){return E(D(t,n)/q(t),t)},rotateAboutAxis:function(n,t,r,u){if(0!==n){var o=t.x,e=t.y,i=t.z,a=u.x,c=u.y,f=u.z,h=r.x,l=r.y,v=r.z;return{x:(a*(l*l+v*v)-h*(c*l+f*v-h*o-l*e-v*i))*(1-Math.cos(n))+o*Math.cos(n)+(-f*l+c*v-v*e+l*i)*Math.sin(n),y:(c*(h*h+v*v)-l*(a*h+f*v-h*o-l*e-v*i))*(1-Math.cos(n))+e*Math.cos(n)+(f*h-a*v+v*o-h*i)*Math.sin(n),z:(f*(h*h+l*l)-v*(a*h+c*l-h*o-l*e-v*i))*(1-Math.cos(n))+i*Math.cos(n)+(-c*h+a*l-l*o+h*e)*Math.sin(n)}}return t},transformMatrix:L,distance:V,distanceSquared:C,isEqual:function(n,t){return n.x===t.x&&n.y===t.y&&n.z===t.z},max:I,min:B,negate:function(n){return{x:-n.x,y:-n.y,z:-n.z}},lerp:G,transformNdcToWorldSpace:function(n,t,r){return L(L(n,r),t)}}),Z=function(n,t){return{min:n,max:t}};function H(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var u=a([n],t,!0);return u.reduce((function(n,t){return Z(B(n.min,t.min),I(n.max,t.max))}))}var K=Object.freeze({__proto__:null,create:Z,fromVectors:function(n){return H.apply(void 0,n.map((function(n){return Z(n,n)})))},center:function(n){return E(.5,N(n.min,n.max))},union:H});function Q(n,t,r,u){return{x:n,y:t,width:r,height:u}}function U(n,t){return Q(n.x,n.y,t.width,t.height)}function X(n,t){var r=Math.min(n.width/t.width,n.height/t.height),u=cn(r,t);return U(l(tn(n),hn(u)),u)}function Y(n,t){var r=Math.max(n.width/t.width,n.height/t.height),u=cn(r,t);return U(l(tn(n),hn(u)),u)}function $(n,t){var r=Math.min(Math.sqrt(n/nn(t)),1),u=fn(cn(r,t));return U(l(tn(t),hn(u)),u)}function nn(n){return n.width*n.height}function tn(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function rn(n){return h(n.x,n.y)}var un=Object.freeze({__proto__:null,create:Q,fromDimensions:function(n){return Q(0,0,n.width,n.height)},fromPointAndDimensions:U,fromPoints:function(n,t){var r=Math.min(n.x,t.x),u=Math.min(n.y,t.y);return Q(r,u,Math.max(n.x,t.x)-r,Math.max(n.y,t.y)-u)},containFit:X,cropFit:Y,scaleFit:$,scale:function n(t,r,u){return null==u?n(t,r,r):Q(t.x*r,t.y*u,t.width*r,t.height*u)},isEqual:function(n,t){return s(n,t)&&en(n,t)},offset:function(n,t){return U(v(rn(t),n),t)},area:nn,center:tn,topLeft:rn,bottomRight:function(n){return h(n.x+n.width,n.y+n.height)},isPortrait:function(n){return n.width<n.height},isLandscape:function(n){return n.width>n.height},isSquare:function(n){return n.width===n.height},pad:function(n,t){return Q(n.x-t,n.y-t,n.width+2*t,n.height+2*t)},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?Q(t[0],t[1],t[2],t[3]):Q(t.x,t.y,t.width,t.height)}}),on=function(n,t){return{width:n,height:t}},en=function(n,t){return n.width===t.width&&n.height===t.height},an=function(n,t,r){return{width:r.width*n,height:r.height*t}},cn=function(n,t){return an(n,n,t)},fn=function(n){return{width:Math.floor(n.width),height:Math.floor(n.height)}},hn=function(n){return{x:n.width/2,y:n.height/2}};function ln(n,t){return void 0===t&&(t=h()),U(t,n)}var vn=Object.freeze({__proto__:null,create:on,square:function(n){return on(n,n)},isEqual:en,scale:an,proportionalScale:cn,trim:function(n,t){return{width:Math.min(n.width,t.width),height:Math.min(n.height,t.height)}},containFit:function(n,t){var r=X(ln(n),ln(t));return{width:r.width,height:r.height}},cropFit:function(n,t){var r=Y(ln(n),ln(t));return{width:r.width,height:r.height}},scaleFit:function(n,t){var r=$(n,ln(t));return{width:r.width,height:r.height}},round:function(n){return{width:Math.round(n.width),height:Math.round(n.height)}},floor:fn,center:hn,aspectRatio:function(n){return n.width/n.height},area:function(n){return n.width*n.height},fitToRatio:function(n,t){return t.width>=t.height*n?on(t.height*n,t.height):on(t.width,t.width/n)},toRectangle:ln});function sn(n){var t,r,u,o;return void 0===n&&(n={}),{x:null!==(t=n.x)&&void 0!==t?t:0,y:null!==(r=n.y)&&void 0!==r?r:0,z:null!==(u=n.z)&&void 0!==u?u:0,order:null!==(o=n.order)&&void 0!==o?o:"xyz"}}var dn=Object.freeze({__proto__:null,create:sn,fromDegrees:function(n){void 0===n&&(n={});var t=n.x,r=n.y,u=void 0===r?0:r,o=n.z,e=void 0===o?0:o,i=n.order;return sn({x:m(void 0===t?0:t),y:m(u),z:m(e),order:i})},fromRotationMatrix:function(n,t){void 0===t&&(t="xyz");var r=j(n),u=0,o=0,e=0;return"xyz"===t?(o=Math.asin(c(r.m13,-1,1)),Math.abs(r.m13)<.9999999?(u=Math.atan2(-r.m23,r.m33),e=Math.atan2(-r.m12,r.m11)):(u=Math.atan2(r.m32,r.m22),e=0)):"yxz"===t?(u=Math.asin(-c(r.m23,-1,1)),Math.abs(r.m23)<.9999999?(o=Math.atan2(r.m13,r.m33),e=Math.atan2(r.m21,r.m22)):(o=Math.atan2(-r.m31,r.m11),e=0)):"zxy"===t?(u=Math.asin(c(r.m32,-1,1)),Math.abs(r.m32)<.9999999?(o=Math.atan2(-r.m31,r.m33),e=Math.atan2(-r.m12,r.m22)):(o=0,e=Math.atan2(r.m21,r.m11))):"zyx"===t?(o=Math.asin(-c(r.m31,-1,1)),Math.abs(r.m31)<.9999999?(u=Math.atan2(r.m32,r.m33),e=Math.atan2(r.m21,r.m11)):(u=0,e=Math.atan2(-r.m12,r.m22))):"yzx"===t?(e=Math.asin(c(r.m21,-1,1)),Math.abs(r.m21)<.9999999?(u=Math.atan2(-r.m23,r.m22),o=Math.atan2(-r.m31,r.m11)):(u=0,o=Math.atan2(r.m13,r.m33))):"xzy"===t&&(e=Math.asin(-c(r.m12,-1,1)),Math.abs(r.m12)<.9999999?(u=Math.atan2(r.m32,r.m22),o=Math.atan2(r.m13,r.m11)):(u=Math.atan2(-r.m23,r.m33),o=0)),{x:u,y:o,z:e,order:t}},fromJson:function(n){var t=JSON.parse(n);if(Array.isArray(t)){var r=t[3];return{x:t[0],y:t[1],z:t[2],order:void 0===r?"xyz":r}}var u=t.order;return{x:t.x,y:t.y,z:t.z,order:void 0===u?"xyz":u}},isType:function(n){var t=n;return null!=t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&t.hasOwnProperty("z")&&t.hasOwnProperty("order")}});function Mn(n){return F(n.end,n.start)}var yn=Object.freeze({__proto__:null,create:function(n){var t,r;return void 0===n&&(n={}),{start:null!==(t=n.start)&&void 0!==t?t:P(),end:null!==(r=n.end)&&void 0!==r?r:P()}},center:function(n){return G(n.start,n.end,.5)},transformMatrix:function(n,t){return{start:L(n.start,t),end:L(n.end,t)}},distance:function(n){return V(n.start,n.end)},distanceSquared:function(n){return C(n.start,n.end)},direction:Mn}),mn=function(n,t,r,u,o,e){return void 0===n&&(n=1),void 0===t&&(t=0),void 0===r&&(r=0),void 0===u&&(u=1),void 0===o&&(o=0),void 0===e&&(e=0),{a:n,b:t,c:r,d:u,tx:o,ty:e}},xn=function(){return mn()},_n=function(n,t){var r=m(n),u=Math.cos(r),o=Math.sin(r);return mn(t.a*u+t.c*o,t.b*u+t.d*o,t.a*-o+t.c*u,t.b*-o+t.d*u,t.tx,t.ty)},zn=function(n,t,r){return mn(r.a,r.b,r.c,r.d,r.a*n+r.c*t+r.tx,r.b*n+r.d*t+r.ty)},bn=Object.freeze({__proto__:null,create:mn,identity:xn,translation:function(n,t){return zn(n,t,xn())},rotation:function(n){return _n(n,xn())},rotate:_n,translate:zn,transformPoint:function(n,t){return h(n.a*t.x+n.c*t.y+n.tx,n.b*t.x+n.d*t.y+n.ty)}}),pn=Object.freeze({__proto__:null,create:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return 2===n.length?{a:n[0].x,b:n[0].y,c:n[1].x,d:n[1].y}:4===n.length?{a:n[0],b:n[1],c:n[2],d:n[3]}:{a:0,b:0,c:0,d:0}},determinant:function(n){return n.a*n.d-n.b*n.c},dot:function(n){return n.a*n.c+n.b*n.d}});function wn(n){return void 0===n&&(n={}),r({normal:P(),constant:0},n)}function On(n,t){return D(n.normal,t)+n.constant}var jn=Object.freeze({__proto__:null,create:wn,fromNormalAndCoplanarPoint:function(n,t){return wn({normal:n,constant:-D(t,n)})},distanceToPoint:On,intersectLine:function(n,t){var r=Mn(t),u=D(n.normal,r);if(0===u)return 0===On(n,t.start)?t.start:void 0;var o=-(D(t.start,n.normal)+n.constant)/u;return o<0||o>1?void 0:N(E(o,r),t.start)},projectPoint:function(n,t){return N(t,E(-On(n,t),n.normal))}});function gn(n){return void 0===n&&(n={}),r({x:0,y:0,z:0,w:1},n)}var kn=Object.freeze({__proto__:null,create:gn,fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?gn({x:t[0],y:t[1],z:t[2],w:t[3]}):gn(t)},fromAxisAngle:function(n,t){var r=t/2,u=Math.sin(r);return{x:n.x*u,y:n.y*u,z:n.z*u,w:Math.cos(r)}},fromMatrixRotation:function(n){var t,r=j(n),u=A(n),o=1/u.x,e=1/u.y,i=1/u.z,a=r.m11*o,c=r.m21*e,f=r.m31*i,h=r.m12*o,l=r.m22*e,v=r.m32*i,s=r.m13*o,d=r.m23*e,M=r.m33*i,y=a+l+M;return y>0?{x:(v-d)/(t=2*Math.sqrt(y+1)),y:(s-f)/t,z:(c-h)/t,w:.25*t}:a>l&&a>M?{x:.25*(t=2*Math.sqrt(1+a-l-M)),y:(c+h)/t,z:(s+f)/t,w:t}:l>M?{x:(c+h)/(t=2*Math.sqrt(1+l-a-M)),y:.25*t,z:(v+d)/t,w:(s-f)/t}:{x:(s+f)/(t=2*Math.sqrt(1+M-a-l)),y:(v+d)/t,z:.25*t,w:(c-h)/t}},fromEuler:function(n){var t=n.x,r=n.y,u=n.z,o=n.order,e=Math.cos(t/2),i=Math.cos(r/2),a=Math.cos(u/2),c=Math.sin(t/2),f=Math.sin(r/2),h=Math.sin(u/2),l=0,v=0,s=0,d=0;switch(o){case"xyz":l=c*i*a+e*f*h,v=e*f*a-c*i*h,s=e*i*h+c*f*a,d=e*i*a-c*f*h;break;case"yxz":l=c*i*a+e*f*h,v=e*f*a-c*i*h,s=e*i*h-c*f*a,d=e*i*a+c*f*h;break;case"zxy":l=c*i*a-e*f*h,v=e*f*a+c*i*h,s=e*i*h+c*f*a,d=e*i*a-c*f*h;break;case"zyx":l=c*i*a-e*f*h,v=e*f*a+c*i*h,s=e*i*h-c*f*a,d=e*i*a+c*f*h;break;case"yzx":l=c*i*a+e*f*h,v=e*f*a+c*i*h,s=e*i*h-c*f*a,d=e*i*a-c*f*h;break;case"xzy":l=c*i*a-e*f*h,v=e*f*a-c*i*h,s=e*i*h+c*f*a,d=e*i*a+c*f*h}return{x:l,y:v,z:s,w:d}},multiply:function(n,t){return{x:n.x*t.w+n.w*t.x+n.y*t.z-n.z*t.y,y:n.y*t.w+n.w*t.y+n.z*t.x-n.x*t.z,z:n.z*t.w+n.w*t.z+n.x*t.y-n.y*t.x,w:n.w*t.w-n.x*t.x-n.y*t.y-n.z*t.z}},isType:function(n){var t=n;return null!=t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&t.hasOwnProperty("z")&&t.hasOwnProperty("w")}});function An(n,t){return N(E(t,n.direction),n.origin)}function Sn(n,t){var r=D(t.normal,n.direction);if(0===r)return 0===On(t,n.origin)?0:void 0;var u=-(D(n.origin,t.normal)+t.constant)/r;return u>=0?u:void 0}var Pn=Object.freeze({__proto__:null,create:function(n){var t,r;return void 0===n&&(n={}),{origin:null!==(t=n.origin)&&void 0!==t?t:P(),direction:null!==(r=n.direction)&&void 0!==r?r:S()}},at:An,distanceToPlane:Sn,intersectPlane:function(n,t){var r=Sn(n,t);return null!=r?An(n,r):void 0}});export{t as _,o as a,K as b,e as c,vn as d,r as e,a as f,jn as g,x as h,un as i,c as j,i as k,yn as l,g as m,u as n,pn as o,d as p,bn as q,Pn as r,kn as s,dn as t,W as v}
|
|
18
|
+
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function u(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(u.prototype=r.prototype,new u)}var r=function(){return(r=Object.assign||function(n){for(var t,r=1,u=arguments.length;r<u;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)};function u(n,t){var r={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&t.indexOf(u)<0&&(r[u]=n[u]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(u=Object.getOwnPropertySymbols(n);o<u.length;o++)t.indexOf(u[o])<0&&Object.prototype.propertyIsEnumerable.call(n,u[o])&&(r[u[o]]=n[u[o]])}return r}function o(n,t,r,u){return new(r||(r=Promise))((function(o,e){function i(n){try{c(u.next(n))}catch(n){e(n)}}function a(n){try{c(u.throw(n))}catch(n){e(n)}}function c(n){var t;n.done?o(n.value):(t=n.value,t instanceof r?t:new r((function(n){n(t)}))).then(i,a)}c((u=u.apply(n,t||[])).next())}))}function e(n,t){var r,u,o,e,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function a(e){return function(a){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,u&&(o=2&e[0]?u.return:e[0]?u.throw||((o=u.return)&&o.call(u),0):u.next)&&!(o=o.call(u,e[1])).done)return o;switch(u=0,o&&(e=[2&e[0],o.value]),e[0]){case 0:case 1:o=e;break;case 4:return i.label++,{value:e[1],done:!1};case 5:i.label++,u=e[1],e=[0];continue;case 7:e=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==e[0]&&2!==e[0])){i=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3])){i.label=e[1];break}if(6===e[0]&&i.label<o[1]){i.label=o[1],o=e;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(e);break}o[2]&&i.ops.pop(),i.trys.pop();continue}e=t.call(n,i)}catch(n){e=[6,n],u=0}finally{r=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,a])}}}function i(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var u,o,e=r.call(n),i=[];try{for(;(void 0===t||t-- >0)&&!(u=e.next()).done;)i.push(u.value)}catch(n){o={error:n}}finally{try{u&&!u.done&&(r=e.return)&&r.call(e)}finally{if(o)throw o.error}}return i}function a(n,t,r){if(r||2===arguments.length)for(var u,o=0,e=t.length;o<e;o++)!u&&o in t||(u||(u=Array.prototype.slice.call(t,0,o)),u[o]=t[o]);return n.concat(u||Array.prototype.slice.call(t))}function c(n,t,r){return Math.max(t,Math.min(r,n))}function f(n,t,r){return(r=c(r,0,1))*(t-n)+n}function h(n,t){return void 0===n&&(n=0),void 0===t&&(t=0),{x:n,y:t}}function l(n,t){return{x:n.x-t.x,y:n.y-t.y}}function v(n,t){return{x:n.x+t.x,y:n.y+t.y}}function s(n,t){return n.x===t.x&&n.y===t.y}var d=Object.freeze({__proto__:null,create:h,polar:function(n,t){return h(Math.cos(t)*n,Math.sin(t)*n)},distance:function(n,t){var r=l(n,t);return Math.sqrt(r.x*r.x+r.y*r.y)},subtract:l,add:v,isEqual:s,lerp:function(n,t,r){return{x:f(n.x,t.x,r),y:f(n.y,t.y,r)}},negate:function(n){return h(-n.x,-n.y)},scale:function(n,t,r){return{x:n.x*t,y:n.y*r}},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?h(t[0],t[1]):h(t.x,t.y)}});function M(n){return(n+3600)%360}function y(n){return n*(180/Math.PI)}function m(n){return n*(Math.PI/180)}var x=Object.freeze({__proto__:null,fromPoints:function(n,t){var r=l(t,n);return Math.atan2(r.y,r.x)},fromPointsInDegrees:function(n,t){var r=l(t,n);return M(y(Math.atan2(r.y,r.x))-270)},normalize:M,toDegrees:y,toRadians:m});function _(n,t,r,u,o,e,i,a,c,f,h,l,v,s,d,M){return[n,o,c,v,t,e,f,s,r,i,h,d,u,a,l,M]}function z(n){return[1,0,0,0,0,1,0,0,0,0,1,0,n.x,n.y,n.z,1]}function b(n){var t=n.x,r=n.y,u=n.z,o=n.w,e=t+t,i=r+r,a=u+u,c=t*e,f=t*i,h=t*a,l=r*i,v=r*a,s=u*a,d=o*e,M=o*i,y=o*a;return[1-(l+s),f+y,h-M,0,f-y,1-(c+s),v+d,0,h+M,v-d,1-(c+l),0,0,0,0,1]}function p(n){return[n.x,0,0,0,0,n.y,0,0,0,0,n.z,0,0,0,0,1]}function w(n,t,r,u,o,e){return[2*o/(t-n),0,0,0,0,2*o/(r-u),0,0,(t+n)/(t-n),(r+u)/(r-u),-(e+o)/(e-o),-1,0,0,-2*e*o/(e-o),0]}function O(n,t){var r=n[0],u=n[4],o=n[8],e=n[12],i=n[1],a=n[5],c=n[9],f=n[13],h=n[2],l=n[6],v=n[10],s=n[14],d=n[3],M=n[7],y=n[11],m=n[15],x=t[0],_=t[4],z=t[8],b=t[12],p=t[1],w=t[5],O=t[9],j=t[13],g=t[2],k=t[6],A=t[10],S=t[14],P=t[3],T=t[7],q=t[11],J=t[15],R=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return R[0]=r*x+u*p+o*g+e*P,R[4]=r*_+u*w+o*k+e*T,R[8]=r*z+u*O+o*A+e*q,R[12]=r*b+u*j+o*S+e*J,R[1]=i*x+a*p+c*g+f*P,R[5]=i*_+a*w+c*k+f*T,R[9]=i*z+a*O+c*A+f*q,R[13]=i*b+a*j+c*S+f*J,R[2]=h*x+l*p+v*g+s*P,R[6]=h*_+l*w+v*k+s*T,R[10]=h*z+l*O+v*A+s*q,R[14]=h*b+l*j+v*S+s*J,R[3]=d*x+M*p+y*g+m*P,R[7]=d*_+M*w+y*k+m*T,R[11]=d*z+M*O+y*A+m*q,R[15]=d*b+M*j+y*S+m*J,R}function j(n){return{m11:n[0],m12:n[4],m13:n[8],m14:n[12],m21:n[1],m22:n[5],m23:n[9],m24:n[13],m31:n[2],m32:n[6],m33:n[10],m34:n[14],m41:n[3],m42:n[7],m43:n[11],m44:n[15]}}var g=Object.freeze({__proto__:null,fromValues:_,fromObject:function(n){return _(n.m11,n.m12,n.m13,n.m14,n.m21,n.m22,n.m23,n.m24,n.m31,n.m32,n.m33,n.m34,n.m41,n.m42,n.m43,n.m44)},makeIdentity:function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},makeZero:function(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},makeTranslation:z,makeRotation:b,makeScale:p,makeTRS:function(n,t,r){var u=z(n),o=b(t),e=p(r);return O(O(u,o),e)},makeBasis:function(n,t,r){return[n.x,n.y,n.z,0,t.x,t.y,t.z,0,r.x,r.y,r.z,0,0,0,0,1]},makeRotationAxis:function(n,t){var r=Math.cos(t),u=Math.sin(t),o=1-r,e=n.x,i=n.y,a=n.z,c=o*e,f=o*i;return[c*e+r,c*i+u*a,c*a-u*i,0,c*i-u*a,f*i+r,f*a+u*e,0,c*a+u*i,f*a-u*e,o*a*a+r,0,0,0,0,1]},makeFrustum:w,makePerspective:function(n,t,r,u){var o=n*Math.tan(m(r/2)),e=o*u;return w(-e,e,o,-o,n,t)},makeLookAtView:function(n,t,r){var u=T(F(n,t)),o=T(R(r,u)),e=R(u,o),i=-D(o,n),a=-D(e,n),c=-D(u,n);return[o.x,e.x,u.x,0,o.y,e.y,u.y,0,o.z,e.z,u.z,0,i,a,c,1]},makeLookAt:function(n,t,r){var u=T(F(n,t)),o=T(R(r,u)),e=R(u,o);return[o.x,o.y,o.z,0,e.x,e.y,e.z,0,u.x,u.y,u.z,0,n.x,n.y,n.z,1]},invert:function(n){var t=n[0],r=n[1],u=n[2],o=n[3],e=n[4],i=n[5],a=n[6],c=n[7],f=n[8],h=n[9],l=n[10],v=n[11],s=n[12],d=n[13],M=n[14],y=n[15],m=t*i-r*e,x=t*a-u*e,_=t*c-o*e,z=r*a-u*i,b=r*c-o*i,p=u*c-o*a,w=f*d-h*s,O=f*M-l*s,j=f*y-v*s,g=h*M-l*d,k=h*y-v*d,A=l*y-v*M,S=m*A-x*k+_*g+z*j-b*O+p*w;return S?[(i*A-a*k+c*g)*(S=1/S),(u*k-r*A-o*g)*S,(d*p-M*b+y*z)*S,(l*b-h*p-v*z)*S,(a*j-e*A-c*O)*S,(t*A-u*j+o*O)*S,(M*_-s*p-y*x)*S,(f*p-l*_+v*x)*S,(e*k-i*j+c*w)*S,(r*j-t*k-o*w)*S,(s*b-d*_+y*m)*S,(h*_-f*b-v*m)*S,(i*O-e*g-a*w)*S,(t*g-r*O+u*w)*S,(d*x-s*z-M*m)*S,(f*z-h*x+l*m)*S]:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},lookAt:function(n,t,u,o){var e=F(t,u);0===J(e)&&(e=r(r({},e),{z:1}));var i=R(o,e=T(e));0===J(i)&&(i=R(o,e=T(e=1===Math.abs(o.z)?r(r({},e),{x:e.x+1e-4}):r(r({},e),{z:e.z+1e-4}))));var c=R(e,i=T(i)),f=a([],n,!0);return f[0]=i.x,f[4]=c.x,f[8]=e.x,f[1]=i.y,f[5]=c.y,f[9]=e.y,f[2]=i.z,f[6]=c.z,f[10]=e.z,f},multiply:O,transpose:function(n){return[n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15]]},scale:function(n,t){var r=t.x,u=t.y,o=t.z,e=a([],n,!0);return e[0]*=r,e[4]*=u,e[8]*=o,e[1]*=r,e[5]*=u,e[9]*=o,e[2]*=r,e[6]*=u,e[10]*=o,e[3]*=r,e[7]*=u,e[11]*=o,e},position:function(n,t){var r=a([],n,!0);return r[12]=t[12],r[13]=t[13],r[14]=t[14],r},toObject:j,isType:function(n){return Array.isArray(n)&&16===n.length}});function k(){for(var n,t,r,u,o,e,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return 1===i.length?{x:null!==(n=i[0].x)&&void 0!==n?n:0,y:null!==(t=i[0].y)&&void 0!==t?t:0,z:null!==(r=i[0].z)&&void 0!==r?r:0}:3===i.length?{x:null!==(u=i[0])&&void 0!==u?u:0,y:null!==(o=i[1])&&void 0!==o?o:0,z:null!==(e=i[2])&&void 0!==e?e:0}:{x:0,y:0,z:0}}function A(n){var t=j(n);return{x:Math.hypot(t.m11,t.m21,t.m31),y:Math.hypot(t.m12,t.m22,t.m32),z:Math.hypot(t.m13,t.m23,t.m33)}}function S(){return k(0,0,-1)}function P(){return k(0,0,0)}function T(n){var t=q(n);return{x:n.x/t,y:n.y/t,z:n.z/t}}function q(n){return Math.sqrt(J(n))}function J(n){return n.x*n.x+n.y*n.y+n.z*n.z}function R(n,t){return{x:n.y*t.z-n.z*t.y,y:n.z*t.x-n.x*t.z,z:n.x*t.y-n.y*t.x}}function N(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(n,t){return{x:n.x+t.x,y:n.y+t.y,z:n.z+t.z}}),n)}function F(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(n,t){return{x:n.x-t.x,y:n.y-t.y,z:n.z-t.z}}),n)}function E(n,t){return{x:t.x*n,y:t.y*n,z:t.z*n}}function D(n,t){return n.x*t.x+n.y*t.y+n.z*t.z}function L(n,t){var r=n.x,u=n.y,o=n.z,e=1/(t[3]*r+t[7]*u+t[11]*o+t[15]);return{x:(t[0]*r+t[4]*u+t[8]*o+t[12])*e,y:(t[1]*r+t[5]*u+t[9]*o+t[13])*e,z:(t[2]*r+t[6]*u+t[10]*o+t[14])*e}}function V(n,t){return Math.sqrt(C(n,t))}function C(n,t){var r=F(n,t),u=r.x,o=r.y,e=r.z;return u*u+o*o+e*e}function I(n,t){return k(Math.max(n.x,t.x),Math.max(n.y,t.y),Math.max(n.z,t.z))}function B(n,t){return k(Math.min(n.x,t.x),Math.min(n.y,t.y),Math.min(n.z,t.z))}function G(n,t,r){return{x:f(n.x,t.x,r),y:f(n.y,t.y,r),z:f(n.z,t.z,r)}}var W=Object.freeze({__proto__:null,create:k,isValid:function(n){return[n.x,n.y,n.z].every((function(n){return isFinite(n)&&!isNaN(n)}))},fromMatrixScale:A,fromMatrixPosition:function(n){var t=j(n);return{x:t.m14,y:t.m24,z:t.m34}},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?k(t[0],t[1],t[2]):k(t.x,t.y,t.z)},fromArray:function(n,t){return void 0===t&&(t=0),k(n[t],n[t+1],n[t+2])},toArray:function(n){return[n.x,n.y,n.z]},right:function(){return k(1,0,0)},up:function(){return k(0,1,0)},forward:S,left:function(){return k(-1,0,0)},down:function(){return k(0,-1,0)},back:function(){return k(0,0,1)},origin:P,normalize:T,magnitude:q,magnitudeSquared:J,cross:R,add:N,subtract:F,multiply:function(n,t){return{x:n.x*t.x,y:n.y*t.y,z:n.z*t.z}},scale:E,dot:D,angleTo:function(n,t){var r=D(n,t)/(q(n)*q(t));return Math.acos(r)},project:function(n,t){return E(D(t,n)/q(t),t)},rotateAboutAxis:function(n,t,r,u){if(0!==n){var o=t.x,e=t.y,i=t.z,a=u.x,c=u.y,f=u.z,h=r.x,l=r.y,v=r.z;return{x:(a*(l*l+v*v)-h*(c*l+f*v-h*o-l*e-v*i))*(1-Math.cos(n))+o*Math.cos(n)+(-f*l+c*v-v*e+l*i)*Math.sin(n),y:(c*(h*h+v*v)-l*(a*h+f*v-h*o-l*e-v*i))*(1-Math.cos(n))+e*Math.cos(n)+(f*h-a*v+v*o-h*i)*Math.sin(n),z:(f*(h*h+l*l)-v*(a*h+c*l-h*o-l*e-v*i))*(1-Math.cos(n))+i*Math.cos(n)+(-c*h+a*l-l*o+h*e)*Math.sin(n)}}return t},transformMatrix:L,distance:V,distanceSquared:C,isEqual:function(n,t){return n.x===t.x&&n.y===t.y&&n.z===t.z},max:I,min:B,negate:function(n){return{x:-n.x,y:-n.y,z:-n.z}},lerp:G,transformNdcToWorldSpace:function(n,t,r){return L(L(n,r),t)}}),Z=function(n,t){return{min:n,max:t}};function H(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var u=a([n],t,!0);return u.reduce((function(n,t){return Z(B(n.min,t.min),I(n.max,t.max))}))}var K=Object.freeze({__proto__:null,create:Z,fromVectors:function(n){return H.apply(void 0,n.map((function(n){return Z(n,n)})))},center:function(n){return E(.5,N(n.min,n.max))},union:H});function Q(n,t,r,u){return{x:n,y:t,width:r,height:u}}function U(n,t){return Q(n.x,n.y,t.width,t.height)}function X(n,t){var r=Math.min(n.width/t.width,n.height/t.height),u=cn(r,t);return U(l(tn(n),hn(u)),u)}function Y(n,t){var r=Math.max(n.width/t.width,n.height/t.height),u=cn(r,t);return U(l(tn(n),hn(u)),u)}function $(n,t){var r=Math.min(Math.sqrt(n/nn(t)),1),u=fn(cn(r,t));return U(l(tn(t),hn(u)),u)}function nn(n){return n.width*n.height}function tn(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function rn(n){return h(n.x,n.y)}var un=Object.freeze({__proto__:null,create:Q,fromDimensions:function(n){return Q(0,0,n.width,n.height)},fromPointAndDimensions:U,fromPoints:function(n,t){var r=Math.min(n.x,t.x),u=Math.min(n.y,t.y);return Q(r,u,Math.max(n.x,t.x)-r,Math.max(n.y,t.y)-u)},containFit:X,cropFit:Y,scaleFit:$,scale:function n(t,r,u){return null==u?n(t,r,r):Q(t.x*r,t.y*u,t.width*r,t.height*u)},isEqual:function(n,t){return s(n,t)&&en(n,t)},offset:function(n,t){return U(v(rn(t),n),t)},area:nn,center:tn,topLeft:rn,bottomRight:function(n){return h(n.x+n.width,n.y+n.height)},isPortrait:function(n){return n.width<n.height},isLandscape:function(n){return n.width>n.height},isSquare:function(n){return n.width===n.height},pad:function(n,t){return Q(n.x-t,n.y-t,n.width+2*t,n.height+2*t)},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?Q(t[0],t[1],t[2],t[3]):Q(t.x,t.y,t.width,t.height)}}),on=function(n,t){return{width:n,height:t}},en=function(n,t){return n.width===t.width&&n.height===t.height},an=function(n,t,r){return{width:r.width*n,height:r.height*t}},cn=function(n,t){return an(n,n,t)},fn=function(n){return{width:Math.floor(n.width),height:Math.floor(n.height)}},hn=function(n){return{x:n.width/2,y:n.height/2}};function ln(n,t){return void 0===t&&(t=h()),U(t,n)}var vn=Object.freeze({__proto__:null,create:on,square:function(n){return on(n,n)},isEqual:en,scale:an,proportionalScale:cn,trim:function(n,t){return{width:Math.min(n.width,t.width),height:Math.min(n.height,t.height)}},containFit:function(n,t){var r=X(ln(n),ln(t));return{width:r.width,height:r.height}},cropFit:function(n,t){var r=Y(ln(n),ln(t));return{width:r.width,height:r.height}},scaleFit:function(n,t){var r=$(n,ln(t));return{width:r.width,height:r.height}},round:function(n){return{width:Math.round(n.width),height:Math.round(n.height)}},floor:fn,center:hn,aspectRatio:function(n){return n.width/n.height},area:function(n){return n.width*n.height},fitToRatio:function(n,t){return t.width>=t.height*n?on(t.height*n,t.height):on(t.width,t.width/n)},toRectangle:ln});function sn(n){var t,r,u,o;return void 0===n&&(n={}),{x:null!==(t=n.x)&&void 0!==t?t:0,y:null!==(r=n.y)&&void 0!==r?r:0,z:null!==(u=n.z)&&void 0!==u?u:0,order:null!==(o=n.order)&&void 0!==o?o:"xyz"}}var dn=Object.freeze({__proto__:null,create:sn,fromDegrees:function(n){void 0===n&&(n={});var t=n.x,r=n.y,u=void 0===r?0:r,o=n.z,e=void 0===o?0:o,i=n.order;return sn({x:m(void 0===t?0:t),y:m(u),z:m(e),order:i})},fromRotationMatrix:function(n,t){void 0===t&&(t="xyz");var r=j(n),u=0,o=0,e=0;return"xyz"===t?(o=Math.asin(c(r.m13,-1,1)),Math.abs(r.m13)<.9999999?(u=Math.atan2(-r.m23,r.m33),e=Math.atan2(-r.m12,r.m11)):(u=Math.atan2(r.m32,r.m22),e=0)):"yxz"===t?(u=Math.asin(-c(r.m23,-1,1)),Math.abs(r.m23)<.9999999?(o=Math.atan2(r.m13,r.m33),e=Math.atan2(r.m21,r.m22)):(o=Math.atan2(-r.m31,r.m11),e=0)):"zxy"===t?(u=Math.asin(c(r.m32,-1,1)),Math.abs(r.m32)<.9999999?(o=Math.atan2(-r.m31,r.m33),e=Math.atan2(-r.m12,r.m22)):(o=0,e=Math.atan2(r.m21,r.m11))):"zyx"===t?(o=Math.asin(-c(r.m31,-1,1)),Math.abs(r.m31)<.9999999?(u=Math.atan2(r.m32,r.m33),e=Math.atan2(r.m21,r.m11)):(u=0,e=Math.atan2(-r.m12,r.m22))):"yzx"===t?(e=Math.asin(c(r.m21,-1,1)),Math.abs(r.m21)<.9999999?(u=Math.atan2(-r.m23,r.m22),o=Math.atan2(-r.m31,r.m11)):(u=0,o=Math.atan2(r.m13,r.m33))):"xzy"===t&&(e=Math.asin(-c(r.m12,-1,1)),Math.abs(r.m12)<.9999999?(u=Math.atan2(r.m32,r.m22),o=Math.atan2(r.m13,r.m11)):(u=Math.atan2(-r.m23,r.m33),o=0)),{x:u,y:o,z:e,order:t}},fromJson:function(n){var t=JSON.parse(n);if(Array.isArray(t)){var r=t[3];return{x:t[0],y:t[1],z:t[2],order:void 0===r?"xyz":r}}var u=t.order;return{x:t.x,y:t.y,z:t.z,order:void 0===u?"xyz":u}},isType:function(n){var t=n;return null!=t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&t.hasOwnProperty("z")&&t.hasOwnProperty("order")}});function Mn(n){return F(n.end,n.start)}var yn=Object.freeze({__proto__:null,create:function(n){var t,r;return void 0===n&&(n={}),{start:null!==(t=n.start)&&void 0!==t?t:P(),end:null!==(r=n.end)&&void 0!==r?r:P()}},center:function(n){return G(n.start,n.end,.5)},transformMatrix:function(n,t){return{start:L(n.start,t),end:L(n.end,t)}},distance:function(n){return V(n.start,n.end)},distanceSquared:function(n){return C(n.start,n.end)},direction:Mn}),mn=function(n,t,r,u,o,e){return void 0===n&&(n=1),void 0===t&&(t=0),void 0===r&&(r=0),void 0===u&&(u=1),void 0===o&&(o=0),void 0===e&&(e=0),{a:n,b:t,c:r,d:u,tx:o,ty:e}},xn=function(){return mn()},_n=function(n,t){var r=m(n),u=Math.cos(r),o=Math.sin(r);return mn(t.a*u+t.c*o,t.b*u+t.d*o,t.a*-o+t.c*u,t.b*-o+t.d*u,t.tx,t.ty)},zn=function(n,t,r){return mn(r.a,r.b,r.c,r.d,r.a*n+r.c*t+r.tx,r.b*n+r.d*t+r.ty)},bn=Object.freeze({__proto__:null,create:mn,identity:xn,translation:function(n,t){return zn(n,t,xn())},rotation:function(n){return _n(n,xn())},rotate:_n,translate:zn,transformPoint:function(n,t){return h(n.a*t.x+n.c*t.y+n.tx,n.b*t.x+n.d*t.y+n.ty)}}),pn=Object.freeze({__proto__:null,create:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return 2===n.length?{a:n[0].x,b:n[0].y,c:n[1].x,d:n[1].y}:4===n.length?{a:n[0],b:n[1],c:n[2],d:n[3]}:{a:0,b:0,c:0,d:0}},determinant:function(n){return n.a*n.d-n.b*n.c},dot:function(n){return n.a*n.c+n.b*n.d}});function wn(n){return void 0===n&&(n={}),r({normal:P(),constant:0},n)}function On(n,t){return D(n.normal,t)+n.constant}var jn=Object.freeze({__proto__:null,create:wn,fromNormalAndCoplanarPoint:function(n,t){return wn({normal:n,constant:-D(t,n)})},distanceToPoint:On,intersectLine:function(n,t){var r=Mn(t),u=D(n.normal,r);if(0===u)return 0===On(n,t.start)?t.start:void 0;var o=-(D(t.start,n.normal)+n.constant)/u;return o<0||o>1?void 0:N(E(o,r),t.start)},projectPoint:function(n,t){return N(t,E(-On(n,t),n.normal))}});function gn(n){return void 0===n&&(n={}),r({x:0,y:0,z:0,w:1},n)}var kn=Object.freeze({__proto__:null,create:gn,fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?gn({x:t[0],y:t[1],z:t[2],w:t[3]}):gn(t)},fromAxisAngle:function(n,t){var r=t/2,u=Math.sin(r);return{x:n.x*u,y:n.y*u,z:n.z*u,w:Math.cos(r)}},fromMatrixRotation:function(n){var t,r=j(n),u=A(n),o=1/u.x,e=1/u.y,i=1/u.z,a=r.m11*o,c=r.m21*e,f=r.m31*i,h=r.m12*o,l=r.m22*e,v=r.m32*i,s=r.m13*o,d=r.m23*e,M=r.m33*i,y=a+l+M;return y>0?{x:(v-d)/(t=2*Math.sqrt(y+1)),y:(s-f)/t,z:(c-h)/t,w:.25*t}:a>l&&a>M?{x:.25*(t=2*Math.sqrt(1+a-l-M)),y:(c+h)/t,z:(s+f)/t,w:t}:l>M?{x:(c+h)/(t=2*Math.sqrt(1+l-a-M)),y:.25*t,z:(v+d)/t,w:(s-f)/t}:{x:(s+f)/(t=2*Math.sqrt(1+M-a-l)),y:(v+d)/t,z:.25*t,w:(c-h)/t}},fromEuler:function(n){var t=n.x,r=n.y,u=n.z,o=n.order,e=Math.cos(t/2),i=Math.cos(r/2),a=Math.cos(u/2),c=Math.sin(t/2),f=Math.sin(r/2),h=Math.sin(u/2),l=0,v=0,s=0,d=0;switch(o){case"xyz":l=c*i*a+e*f*h,v=e*f*a-c*i*h,s=e*i*h+c*f*a,d=e*i*a-c*f*h;break;case"yxz":l=c*i*a+e*f*h,v=e*f*a-c*i*h,s=e*i*h-c*f*a,d=e*i*a+c*f*h;break;case"zxy":l=c*i*a-e*f*h,v=e*f*a+c*i*h,s=e*i*h+c*f*a,d=e*i*a-c*f*h;break;case"zyx":l=c*i*a-e*f*h,v=e*f*a+c*i*h,s=e*i*h-c*f*a,d=e*i*a+c*f*h;break;case"yzx":l=c*i*a+e*f*h,v=e*f*a+c*i*h,s=e*i*h-c*f*a,d=e*i*a-c*f*h;break;case"xzy":l=c*i*a-e*f*h,v=e*f*a-c*i*h,s=e*i*h+c*f*a,d=e*i*a+c*f*h}return{x:l,y:v,z:s,w:d}},multiply:function(n,t){return{x:n.x*t.w+n.w*t.x+n.y*t.z-n.z*t.y,y:n.y*t.w+n.w*t.y+n.z*t.x-n.x*t.z,z:n.z*t.w+n.w*t.z+n.x*t.y-n.y*t.x,w:n.w*t.w-n.x*t.x-n.y*t.y-n.z*t.z}},isType:function(n){var t=n;return null!=t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&t.hasOwnProperty("z")&&t.hasOwnProperty("w")}});function An(n,t){return N(E(t,n.direction),n.origin)}function Sn(n,t){var r=D(t.normal,n.direction);if(0===r)return 0===On(t,n.origin)?0:void 0;var u=-(D(n.origin,t.normal)+t.constant)/r;return u>=0?u:void 0}var Pn=Object.freeze({__proto__:null,create:function(n){var t,r;return void 0===n&&(n={}),{origin:null!==(t=n.origin)&&void 0!==t?t:P(),direction:null!==(r=n.direction)&&void 0!==r?r:S()}},at:An,distanceToPlane:Sn,intersectPlane:function(n,t){var r=Sn(n,t);return null!=r?An(n,r):void 0}});export{t as _,o as a,K as b,e as c,vn as d,r as e,a as f,un as g,jn as h,x as i,c as j,i as k,yn as l,g as m,u as n,pn as o,d as p,bn as q,Pn as r,kn as s,dn as t,W as v}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{v as t,p as n,l as r}from"./p-0aba71fd.js";const e=16,a=10;function i(n,r,e){const a=t.transformMatrix(n,r);return e.transformVectorToViewport(a)}function s(t,e,a){const{start:s,end:o,hideStart:d,hideEnd:c}=function(t,n){const{camera:e,projectionViewMatrix:a,viewport:i}=n,s=e.isPointBehindNear(t.start),o=e.isPointBehindNear(t.end);if(s||o){const n=e.intersectLineWithNear(t),d=r.create({start:s&&null!=n?n:t.start,end:o&&null!=n?n:t.end}),c=r.transformMatrix(d,a);return{start:i.transformVectorToViewport(c.start),end:i.transformVectorToViewport(c.end),hideStart:s,hideEnd:o}}{const n=r.transformMatrix(t,a);return{start:i.transformVectorToViewport(n.start),end:i.transformVectorToViewport(n.end),hideStart:!1,hideEnd:!1}}}(t,a);return{startPt:s,endPt:o,labelPt:n.lerp(s,o,.5),indicatorPt:"none"!==e?function(t,n,r){return i("start"===n?t.start:t.end,r.projectionViewMatrix,r.viewport)}(t,e,a):void 0,hideStart:d,hideEnd:c}}function o(t){return t instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===t.nodeName}export{e as M,a,s as g,o as i,i as t}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{h as t,r as e,c as i,H as n,g as s}from"./p-cafa57a6.js";import{v as r,i as a,p as o,l as h}from"./p-0aba71fd.js";import{M as l,a as d,t as c,g as u}from"./p-0aeab3fc.js";import{m}from"./p-d00e9203.js";import{a as v,g as p}from"./p-439220c6.js";import"./p-f7cb7e59.js";import"./p-3a20a038.js";import{e as w,D as f}from"./p-fe11d694.js";import{M as b}from"./p-76ec0245.js";import{V as g}from"./p-4985fad5.js";import{E as y,m as P}from"./p-301660cf.js";import{c as E}from"./p-f482325b.js";import"./p-112455b1.js";class C{constructor(t,e,i){this.stencil=t,this.depthBuffer=e,this.viewport=i}hitTest(t){const e=this.viewport.transformPointToFrame(t,this.stencil),i=this.viewport.transformPointToFrame(t,this.depthBuffer);return this.stencil.hitTest(e)||this.depthBuffer.hitTest(i)}snapToNearestPixel(t,e){const i=this.viewport.transformPointToFrame(t,this.stencil),n=this.stencil.snapToNearestPixel(i,e);return this.viewport.transformPointToViewport(n,this.stencil)}transformPointToWorld(t,{ignoreHitTest:e=!1}={}){const i=this.pickDepthBuffer(t);return null!=i?this.viewport.transformPointToWorldSpace(t,i):e?this.viewport.transformPointToWorldSpace(t,this.depthBuffer):void 0}pickDepthBuffer(t){const e=this.viewport.transformPointToFrame(t,this.stencil);if(this.stencil.hitTest(e))return this.stencil.depthBuffer;const i=this.viewport.transformPointToFrame(t,this.depthBuffer);return this.depthBuffer.hitTest(i)?this.depthBuffer:void 0}}class M{constructor(t){this.model=t}newMeasurement(t,e){const i=e.hitTester().transformPointToWorld(t);return null!=i?new I(t,i,this.model):void 0}editMeasurement(t){const e=this.model.getMeasurement();if(null==e)throw new Error("Cannot edit measurement. Measurement is empty.");return"start"===t?new D(e,this.model):new j(e,this.model)}clearIndicator(){this.model.setIndicator(void 0)}moveIndicator(t,e){const i=e.hitTester().transformPointToWorld(t);return this.model.setIndicator(i),null!=i}}class x{constructor(){this.measurementChanged=new y,this.indicatorChanged=new y}static empty(){return new x}getMeasurement(){return this.measurement}setMeasurement(t){this.measurement!==t&&(this.measurement=t,this.measurementChanged.emit(t))}setMeasurementFromValues(t,e,i){if(null!=t&&null!=e){const n=i?S(t,e):k(t,e);this.setMeasurement(n)}else this.setMeasurement(void 0)}onMeasurementChanged(t){return this.measurementChanged.on(t)}getIndicator(){return this.indicator}setIndicator(t){this.indicator!==t&&(this.indicator=t,this.indicatorChanged.emit(t))}onIndicatorChanged(t){return this.indicatorChanged.on(t)}}class I{constructor(t,e,i){this.pt=t,this.world=e,this.model=i,this.hitWorldValid=!0}fetchStartIfMissing(t){null==this.pendingStart&&(this.pendingStart=this.fetchStart(t))}async fetchStart(t){const e=await t.raycaster(),i=await L(e,this.pt);if(null==i){const e=t.hitTester().transformPointToWorld(this.pt);this.hitWorld=e,this.hitWorldValid=!1}else this.hitWorld=i,this.hitWorldValid=!0}update(t,e){var i;this.fetchStartIfMissing(e);const n=e.hitTester().transformPointToWorld(t,{ignoreHitTest:!0}),s=e.hitTester().hitTest(t),r=null!==(i=this.hitWorld)&&void 0!==i?i:this.world;if(null==n)throw new Error("Cannot update new measurement interaction. End point is empty.");return this.hitWorldValid&&s?(this.model.setIndicator(n),this.setMeasurement(S(r,n))):(this.model.setIndicator(n),this.setMeasurement(k(r,n)))}async finish(t,e){var i;this.fetchStartIfMissing(e),await this.pendingStart;const n=await e.raycaster(),s=await L(n,t),r=null!==(i=this.hitWorld)&&void 0!==i?i:this.world;if(this.model.setIndicator(void 0),null==s){const i=e.hitTester().transformPointToWorld(t,{ignoreHitTest:!0});if(null==i)throw new Error("Cannot complete new measurement interaction. End point is empty.");return this.setMeasurement(k(r,i))}return this.setMeasurement(this.hitWorldValid?S(r,s):k(r,s))}setMeasurement(t){return this.model.setMeasurement(t),t}}class A{constructor(t,e){this.measurement=t,this.model=e}update(t,e){const i=e.hitTester().transformPointToWorld(t,{ignoreHitTest:!0}),n=e.hitTester().hitTest(t);if(null==i)throw new Error("Cannot update new measurement interaction. End point is empty.");return n?(this.model.setIndicator(i),this.setMeasurement(this.getValidMeasurement(i))):(this.model.setIndicator(i),this.setMeasurement(this.getInvalidMeasurement(i)))}async finish(t,e){const i=await e.raycaster(),n=await L(i,t);if(this.model.setIndicator(void 0),null==n){const i=e.hitTester().transformPointToWorld(t,{ignoreHitTest:!0});if(null==i)throw new Error("Cannot complete edit measurement interaction. End point is empty.");return this.setMeasurement(this.getInvalidMeasurement(i))}return this.setMeasurement(this.getValidMeasurement(n))}setMeasurement(t){return this.model.setMeasurement(t),t}}class D extends A{constructor(t,e){super(t,e)}getInvalidMeasurement(t){return k(t,this.measurement.end)}getValidMeasurement(t){return S(t,this.measurement.end)}}class j extends A{constructor(t,e){super(t,e)}getInvalidMeasurement(t){return k(this.measurement.start,t)}getValidMeasurement(t){return S(this.measurement.start,t)}}async function L(t,e){var i;const n=await t.hitItems(e),[s]=null!==(i=null==n?void 0:n.hits)&&void 0!==i?i:[];if(null!=(null==s?void 0:s.hitPoint)){const t=w(s.hitPoint);if(P.isInvalid(t))throw new Error(`Invalid hit response [${t.errors.join(",")}]`);return t}}function S(t,e){return{start:t,end:e,distance:r.distance(t,e),valid:!0}}function k(t,e){return{start:t,end:e,valid:!1}}const T=({startPt:e,endPt:i,centerPt:n,indicatorPt:s,distance:r,anchorLabelOffset:h,lineCapLength:l,linePointerEvents:d,hideStartAnchor:c,hideEndAnchor:u,onStartAnchorPointerDown:m,onEndAnchorPointerDown:p})=>{const w=null!=e&&null!=i?a.fromPoints(e,i):void 0,f=null!=w&&null!=e&&null!=h?o.add(e,o.polar(-h,w)):void 0,b=null!=w&&null!=i&&null!=h?o.add(i,o.polar(h,w)):void 0;return t("div",null,null!=e&&null!=i&&t("vertex-viewer-measurement-line",{class:E("line",{"hide-start-line-cap":c,"hide-end-line-cap":u}),start:e,end:i,capLength:l,pointerEvents:d}),!c&&null!=e&&t("div",{id:"start-anchor",class:"anchor anchor-start",style:{transform:v(e)},onPointerDown:m},t("slot",{name:"start-anchor"},t("div",{class:"anchor-placeholder"}))),!c&&f&&t("div",{class:"anchor-label anchor-label-start",style:{transform:v(f)}},t("slot",{name:"start-label"})),!u&&null!=i&&t("div",{id:"end-anchor",class:"anchor anchor-end",style:{transform:v(i)},onPointerDown:p},t("slot",{name:"end-anchor"},t("div",{class:"anchor-placeholder"}))),!u&&b&&t("div",{class:"anchor-label anchor-label-end",style:{transform:v(b)}},t("slot",{name:"end-label"})),null!=n&&t("div",{id:"label",class:"distance-label",style:{transform:v(n)}},r),null!=s&&t("div",{class:"indicator",style:{transform:v(s)}},t("slot",{name:"indicator"},t("div",{class:"indicator-placeholder"}))))};let H=class{constructor(t){e(this,t),this.editBegin=i(this,"editBegin",7),this.editEnd=i(this,"editEnd",7),this.showAxisReferenceLines=!1,this.snapDistance=l,this.units="millimeters",this.fractionalDigits=2,this.anchorLabelOffset=20,this.lineCapLength=d,this.mode="",this.interactingAnchor="none",this.invalid=!1,this.viewport=new g(0,0),this.interactionCount=0,this.invalidateStateCounter=0,this.stateMap={},this.model=x.empty(),this.controller=new M(this.model),this.overlays=new b,this.measurementUnits=new f(this.units),this.isUserInteractingWithModel=!1,this.handleFrameDrawn=()=>{this.invalidateState()},this.clearIndicator=()=>{this.controller.clearIndicator()},this.updateStartAnchor=async t=>{if(this.getStencilBuffer(),0===this.interactionCount){const e=p(t,this.elementBounds),i=this.snapPoint(e,t);this.updateIndicator(i)}},this.newMeasurement=t=>{if(0===this.interactionCount&&0===t.button){const e=t=>{const e=()=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointermove",n)},i=async()=>{e(),t()},n=t=>{t.buttons>0&&e()};window.addEventListener("pointermove",n),window.addEventListener("pointerup",i)},i=t=>{const e=()=>t(),i=()=>(window.removeEventListener("pointermove",e),void window.removeEventListener("pointerup",i)),n=()=>{window.addEventListener("pointermove",e),window.addEventListener("pointerup",i)};return window.addEventListener("pointerdown",n),{dispose:()=>window.removeEventListener("pointerdown",n)}},n=()=>{const t=i((()=>{var t;this.isUserInteractingWithModel=!0,null===(t=this.stateMap.hoverCursor)||void 0===t||t.dispose()})),e=this.createInteractionMoveHandler(),n=async i=>{var s;if(0===i.button)if(this.isUserInteractingWithModel)this.isUserInteractingWithModel=!1;else{const r=this.getHitProvider();if(null!=r){const a=p(i,this.elementBounds),o=this.snapPoint(a,i);await(null===(s=this.interaction)||void 0===s?void 0:s.finish(o,r)),window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),t.dispose(),this.updateMeasurementPropsFromModel(),this.endEditing()}}};this.beginEditing("end"),window.addEventListener("pointermove",e),window.addEventListener("pointerup",n)},s=this.getHitProvider();if(null!=s){const i=p(t,this.elementBounds),r=this.snapPoint(i,t);this.interaction=this.controller.newMeasurement(r,s),e(n)}}}}async computeElementMetrics(){var t,e,i;const n=null===(t=this.hostEl.shadowRoot)||void 0===t?void 0:t.getElementById("start-anchor"),s=null===(e=this.hostEl.shadowRoot)||void 0===e?void 0:e.getElementById("end-anchor"),r=null===(i=this.hostEl.shadowRoot)||void 0===i?void 0:i.getElementById("label");return null!=n&&null!=s&&null!=r?{startAnchor:n.getBoundingClientRect(),endAnchor:s.getBoundingClientRect(),label:r.getBoundingClientRect()}:void 0}componentWillLoad(){this.updatePropsFromJson(),this.model.setMeasurementFromValues(this.start,this.end,!this.invalid),this.getStencilBuffer(),this.updateViewport(),this.handleViewerChanged(this.viewer),this.handleModeChanged(),this.computePropsAndState(),this.model.onIndicatorChanged((t=>{this.indicatorPt=t}))}componentDidLoad(){new ResizeObserver((()=>this.updateViewport())).observe(this.hostEl)}componentWillUpdate(){this.computePropsAndState()}render(){const e=this.computeElementPositions(),{startPt:i,endPt:s,labelPt:r,indicatorPt:a,hideStart:o,hideEnd:h}=e,l=this.formatDistance(this.distance);return t(n,null,this.showAxisReferenceLines&&t("vertex-viewer-measurement-overlays",{measurementOverlays:this.overlays,viewer:this.viewer}),t("div",{class:"measurement"},t(T,"edit"===this.mode?{startPt:i,endPt:s,centerPt:r,indicatorPt:a,distance:l,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength,hideStartAnchor:o,hideEndAnchor:h,onStartAnchorPointerDown:this.handleEditAnchor("start"),onEndAnchorPointerDown:this.handleEditAnchor("end")}:"replace"===this.mode?{startPt:i,endPt:s,centerPt:r,indicatorPt:a,distance:l,hideStartAnchor:o,hideEndAnchor:h,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength}:{startPt:i,endPt:s,centerPt:r,indicatorPt:this.indicatorPt,distance:l,hideStartAnchor:o,hideEndAnchor:h,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength,linePointerEvents:"painted"})))}handleViewerChanged(t,e){null!=e&&(e.removeEventListener("frameDrawn",this.handleFrameDrawn),this.removeInteractionListeners(e)),null!=t&&(t.addEventListener("frameDrawn",this.handleFrameDrawn),this.addInteractionListeners(t))}handleUnitsChanged(){this.measurementUnits=new f(this.units)}handleCameraChanged(){this.updateCamera()}handleModeChanged(){this.warnIfDepthBuffersDisabled()}handleStartChanged(){this.updateInteractionModel()}handleEndChanged(){this.updateInteractionModel()}handleInvalidChanged(){this.updateInteractionModel()}computePropsAndState(){this.updateCamera(),this.updateDepthBuffer(),this.updateMeasurementPropsFromModel(),this.updateOverlays()}updateOverlays(){var t;null===(t=this.overlay)||void 0===t||t.dispose(),this.showAxisReferenceLines&&0===this.interactionCount&&!this.invalid&&null!=this.start&&null!=this.end&&(this.overlay=this.overlays.addDistanceVector(this.start,this.end))}async setCursor(t){var e,i;null===(e=this.stateMap.hoverCursor)||void 0===e||e.dispose(),this.isUserInteractingWithModel||(this.stateMap.hoverCursor=await(null===(i=this.viewer)||void 0===i?void 0:i.addCursor(t)))}computeElementPositions(){return"replace"===this.mode?this.computeReplaceElementPositions():this.computeEditOrViewElementPositions()}computeEditOrViewElementPositions(){const t=this.model.getMeasurement();return null!=this.internalCamera&&null!=t?this.computeLineElementPositions(this.internalCamera.projectionViewMatrix,h.create(t)):{}}computeReplaceElementPositions(){if(null!=this.internalCamera){const t=this.model.getMeasurement();if(null!=t)return this.computeLineElementPositions(this.internalCamera.projectionViewMatrix,h.create({start:t.start,end:t.end}));if(null!=this.indicatorPt)return{indicatorPt:c(this.indicatorPt,this.internalCamera.projectionViewMatrix,this.viewport)}}return{}}computeLineElementPositions(t,e){return null!=this.internalCamera?u(e,this.interactingAnchor,{projectionViewMatrix:t,viewport:this.viewport,camera:this.internalCamera}):{}}updateCamera(){var t,e;this.internalCamera=this.camera||(null===(e=null===(t=this.viewer)||void 0===t?void 0:t.frame)||void 0===e?void 0:e.scene.camera)}async updateDepthBuffer(){var t,e;this.stateMap.depthBuffer=await(null===(e=null===(t=this.viewer)||void 0===t?void 0:t.frame)||void 0===e?void 0:e.depthBuffer())}updateViewport(){const t=this.hostEl.getBoundingClientRect();this.viewport=new g(t.width,t.height),this.elementBounds=t}updatePropsFromJson(){var t,e;this.start=V(null!==(t=this.startJson)&&void 0!==t?t:this.start),this.end=V(null!==(e=this.endJson)&&void 0!==e?e:this.end)}updateInteractionModel(){this.model.setMeasurementFromValues(this.start,this.end,!this.invalid)}invalidateState(){this.invalidateStateCounter=this.invalidateStateCounter+1}async addInteractionListeners(t){const e=await t.getInteractionTarget();"replace"===this.mode&&(e.addEventListener("pointermove",this.updateStartAnchor),e.addEventListener("pointerdown",this.newMeasurement),e.addEventListener("pointerleave",this.clearIndicator))}async removeInteractionListeners(t){const e=await t.getInteractionTarget();e.removeEventListener("pointermove",this.updateStartAnchor),e.removeEventListener("pointerdown",this.newMeasurement),e.removeEventListener("pointerleave",this.clearIndicator)}handleEditAnchor(t){if("edit"===this.mode){const e=this.createInteractionMoveHandler(),i=async t=>{var n;const s=this.getHitProvider();if(null!=s){window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",i);const r=p(t,this.elementBounds),a=this.snapPoint(r,t);await(null===(n=this.interaction)||void 0===n?void 0:n.finish(a,s)),this.updateMeasurementPropsFromModel(),this.endEditing()}};return n=>{this.getStencilBuffer(),0===n.button&&(this.beginEditing(t),this.interaction=this.controller.editMeasurement(t),window.addEventListener("pointermove",e),window.addEventListener("pointerup",i))}}}createInteractionMoveHandler(){return t=>{var e;const i=this.getHitProvider();if(null!=this.elementBounds&&null!=i){t.preventDefault(),this.getStencilBuffer();const n=p(t,this.elementBounds),s=this.snapPoint(n,t);null===(e=this.interaction)||void 0===e||e.update(s,i),this.updateMeasurementPropsFromModel()}}}async getStencilBuffer(){var t;const e=await(null===(t=this.viewer)||void 0===t?void 0:t.stencilBuffer.latestAfterInteraction());this.stateMap.stencil=e}snapPoint(t,e){const i=this.getHitProvider();if(null!=i&&!e.shiftKey){const e=Math.max(0,this.snapDistance);return i.hitTester().snapToNearestPixel(t,e)}return t}formatDistance(t){const e=null!=t?this.measurementUnits.convertWorldValueToReal(t):void 0;if(null!=this.labelFormatter)return this.labelFormatter(e);{const t=this.measurementUnits.unit.abbreviatedName;return null==e?"---":`~${e.toFixed(this.fractionalDigits)} ${t}`}}beginEditing(t){0===this.interactionCount&&(this.interactingAnchor=t,this.editBegin.emit()),this.interactionCount=this.interactionCount+1}endEditing(){1===this.interactionCount&&(this.interactingAnchor="none",this.editEnd.emit()),this.interactionCount=this.interactionCount-1}getHitProvider(){if(null!=this.hitProvider)return this.hitProvider;{const t=this.getHitTester(),e=this.viewer;if(null!=e&&null!=t)return{hitTester:()=>t,raycaster:async()=>(await e.scene()).raycaster()}}}getHitTester(){const{stencil:t,depthBuffer:e}=this.stateMap;if(null!=t&&null!=e)return new C(t,e,this.viewport)}updateMeasurementPropsFromModel(){const t=this.model.getMeasurement();this.start=null==t?void 0:t.start,this.end=null==t?void 0:t.end,this.distance=null==t?void 0:t.distance,this.invalid=null!=t&&!t.valid}updateIndicator(t){var e;const i=this.getHitProvider();null!=i&&this.controller.moveIndicator(t,i)?this.setCursor(m):null===(e=this.stateMap.hoverCursor)||void 0===e||e.dispose()}warnIfDepthBuffersDisabled(){null!=this.viewer&&null==this.viewer.depthBuffers&&console.warn("Measurement editing is disabled. <vertex-viewer> must have its `depth-buffers` attribute set.")}get hostEl(){return s(this)}static get watchers(){return{viewer:["handleViewerChanged"],units:["handleUnitsChanged"],camera:["handleCameraChanged"],mode:["handleModeChanged"],start:["handleStartChanged"],end:["handleEndChanged"],invalid:["handleInvalidChanged"]}}};function V(t){return"string"==typeof t?r.fromJson(t):t}H.style=":host{--viewer-measurement-distance-accent-color:var(--neutral-900);--viewer-measurement-distance-contrast-color:var(--white);--viewer-measurement-distance-invalid-accent-color:var(--red-600);--viewer-measurement-distance-invalid-contrast-color:var(--white);--viewer-measurement-distance-line-stroke-width:1.25px;--viewer-measurement-distance-line-fill-width:2px;--viewer-measurement-distance-distance-border:1px solid\n var(--viewer-measurement-distance-accent-color);--viewer-measurement-distance-distance-border-radius:0.25rem;--viewer-measurement-distance-distance-padding:0.375rem 0.5rem;color:var(--viewer-measurement-distance-accent-color);font-size:0.75rem;position:absolute;width:100%;height:100%;overflow:hidden}:host([invalid]){--viewer-measurement-distance-accent-color:var(\n --viewer-measurement-distance-invalid-accent-color\n ) !important;--viewer-measurement-distance-contrast-color:var(\n --viewer-measurement-distance-invalid-contrast-color\n ) !important}.measurement{position:absolute;width:100%;height:100%;pointer-events:none}.line{--viewer-measurement-line-stroke:var(\n --viewer-measurement-distance-contrast-color\n );--viewer-measurement-line-stroke-opacity:0.75;--viewer-measurement-line-stroke-width:var(\n --viewer-measurement-distance-line-stroke-width\n );--viewer-measurement-line-fill:var(\n --viewer-measurement-distance-accent-color\n );--viewer-measurement-line-fill-width:var(\n --viewer-measurement-distance-line-fill-width\n );position:absolute;width:100%;height:100%}.anchor{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block}:host(:not([mode='replace'])) .anchor,:host(:not([mode='replace'])) .anchor-label,:host(:not([mode='replace'])) .distance-label{pointer-events:auto}:host([interacting-anchor='start']) .anchor-start,:host([interacting-anchor='start']) .anchor-label-start{visibility:hidden}.hide-start-line-cap,:host([interacting-anchor='start']) .line{--viewer-measurement-line-start-cap-visibility:hidden}:host([interacting-anchor='end']) .anchor-end,:host([interacting-anchor='end']) .anchor-label-end{visibility:hidden}.hide-end-line-cap,:host([interacting-anchor='end']) .line{--viewer-measurement-line-end-cap-visibility:hidden}.anchor-label{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block}:host([mode='edit']){cursor:inherit}:host([mode='edit']) .anchor{cursor:move}:host(:not([mode='edit'])) .anchor{visibility:hidden}.anchor-placeholder{background:var(--viewer-measurement-distance-contrast-color);width:12px;height:12px;border-radius:50%;box-sizing:border-box}:host([mode='edit']) .anchor-placeholder{border:2px solid var(--viewer-measurement-distance-accent-color);background:var(--viewer-measurement-distance-contrast-color)}:host([mode='']) .distance-label{color:var(--viewer-measurement-distance-contrast-color);background:var(--viewer-measurement-distance-accent-color)}.distance-label{position:absolute;background:var(--viewer-measurement-distance-contrast-color);border:var(--viewer-measurement-distance-distance-border);border-radius:var(--viewer-measurement-distance-distance-border-radius);padding:var(--viewer-measurement-distance-distance-padding)}.indicator{position:absolute}.indicator-placeholder{background:var(--viewer-measurement-distance-accent-color);border:1px solid var(--viewer-measurement-distance-contrast-color);width:6px;height:6px;border-radius:50%;box-sizing:border-box}";export{H as vertex_viewer_measurement_distance}
|