@vertexvis/viewer 0.22.0-canary.2 → 0.22.0-testing.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/index.cjs.js +4 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/multiElementInteractionHandler-93bd9593.js.map +1 -1
- package/dist/cjs/{queries-d9cd5ec1.js → queries-918bb133.js} +315 -41
- package/dist/cjs/queries-918bb133.js.map +1 -0
- package/dist/cjs/vertex-viewer.cjs.entry.js +3 -256
- package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/lib/interactions/baseInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/index.js +1 -0
- package/dist/collection/lib/interactions/index.js.map +1 -1
- package/dist/collection/lib/interactions/mouseInteractions.js +6 -0
- package/dist/collection/lib/interactions/mouseInteractions.js.map +1 -1
- package/dist/collection/lib/interactions/pointerInteractionHandler.js +6 -0
- package/dist/collection/lib/interactions/pointerInteractionHandler.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/multiElementInteractionHandler.js.map +1 -1
- package/dist/components/queries.js +269 -2
- package/dist/components/queries.js.map +1 -1
- package/dist/components/vertex-viewer.js +3 -256
- package/dist/components/vertex-viewer.js.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +3 -1
- package/dist/esm/multiElementInteractionHandler-8b48d16e.js.map +1 -1
- package/dist/esm/{queries-2834b01d.js → queries-e3684cb0.js} +270 -3
- package/dist/esm/queries-e3684cb0.js.map +1 -0
- package/dist/esm/vertex-viewer.entry.js +3 -256
- package/dist/esm/vertex-viewer.entry.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/interactions/baseInteractionHandler.d.ts +6 -6
- package/dist/types/lib/interactions/index.d.ts +1 -0
- package/dist/types/lib/interactions/mouseInteractions.d.ts +2 -0
- package/dist/types/lib/interactions/pointerInteractionHandler.d.ts +2 -0
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/index.esm.js.map +1 -1
- package/dist/viewer/p-0ab3b3cc.js +5 -0
- package/dist/viewer/p-0ab3b3cc.js.map +1 -0
- package/dist/viewer/p-8a56c008.entry.js +5 -0
- package/dist/viewer/p-8a56c008.entry.js.map +1 -0
- package/dist/viewer/p-bf67f570.js.map +1 -1
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/dist/cjs/queries-d9cd5ec1.js.map +0 -1
- package/dist/esm/queries-2834b01d.js.map +0 -1
- package/dist/viewer/p-339774b3.js +0 -5
- package/dist/viewer/p-339774b3.js.map +0 -1
- package/dist/viewer/p-b8dfa0c1.entry.js +0 -5
- package/dist/viewer/p-b8dfa0c1.entry.js.map +0 -1
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
+
const bundle_esm = require('./bundle.esm-b2145e44.js');
|
|
7
|
+
const dom = require('./dom-4344863c.js');
|
|
8
|
+
const multiElementInteractionHandler = require('./multiElementInteractionHandler-93bd9593.js');
|
|
6
9
|
const browser_esm = require('./browser.esm-13ce8652.js');
|
|
7
10
|
const errors = require('./errors-1c8307fa.js');
|
|
8
|
-
const bundle_esm$1 = require('./bundle.esm-b2145e44.js');
|
|
9
11
|
const streamAttributes = require('./streamAttributes-a383ddd7.js');
|
|
10
12
|
require('./entities-551add54.js');
|
|
11
13
|
const scene_view_api_pb = require('./scene_view_api_pb-ecc4b802.js');
|
|
12
|
-
const bundle_esm = require('./bundle.esm-013a8b84.js');
|
|
14
|
+
const bundle_esm$1 = require('./bundle.esm-013a8b84.js');
|
|
13
15
|
|
|
14
16
|
const defaultColor = {
|
|
15
17
|
opacity: 255,
|
|
@@ -69,6 +71,271 @@ const colorMaterial = /*#__PURE__*/Object.freeze({
|
|
|
69
71
|
fromHex: fromHex
|
|
70
72
|
});
|
|
71
73
|
|
|
74
|
+
class MouseInteraction {
|
|
75
|
+
setPosition(position) {
|
|
76
|
+
this.currentPosition = position;
|
|
77
|
+
}
|
|
78
|
+
getPosition() {
|
|
79
|
+
return this.currentPosition;
|
|
80
|
+
}
|
|
81
|
+
getType() {
|
|
82
|
+
return this.type;
|
|
83
|
+
}
|
|
84
|
+
beginDrag(event, canvasPosition, api, element) {
|
|
85
|
+
// noop
|
|
86
|
+
}
|
|
87
|
+
drag(event, api) {
|
|
88
|
+
// noop
|
|
89
|
+
}
|
|
90
|
+
endDrag(event, api) {
|
|
91
|
+
if (this.currentPosition != null) {
|
|
92
|
+
api.endInteraction();
|
|
93
|
+
this.currentPosition = undefined;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
zoom(delta, api) {
|
|
97
|
+
// noop
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
class RotateInteraction extends MouseInteraction {
|
|
101
|
+
constructor() {
|
|
102
|
+
super(...arguments);
|
|
103
|
+
this.type = 'rotate';
|
|
104
|
+
}
|
|
105
|
+
beginDrag(event, canvasPosition, api) {
|
|
106
|
+
if (this.currentPosition == null) {
|
|
107
|
+
this.currentPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
108
|
+
api.beginInteraction();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
drag(event, api) {
|
|
112
|
+
if (this.currentPosition != null) {
|
|
113
|
+
const position = bundle_esm.point.create(event.screenX, event.screenY);
|
|
114
|
+
const delta = bundle_esm.point.subtract(position, this.currentPosition);
|
|
115
|
+
api.rotateCamera(delta);
|
|
116
|
+
this.currentPosition = position;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
endDrag(event, api) {
|
|
120
|
+
super.endDrag(event, api);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
class RotatePointInteraction extends MouseInteraction {
|
|
124
|
+
constructor() {
|
|
125
|
+
super(...arguments);
|
|
126
|
+
this.type = 'rotate-point';
|
|
127
|
+
}
|
|
128
|
+
beginDrag(event, canvasPosition, api) {
|
|
129
|
+
if (this.currentPosition == null) {
|
|
130
|
+
this.currentPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
131
|
+
this.startingPosition = canvasPosition;
|
|
132
|
+
api.beginInteraction();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
drag(event, api) {
|
|
136
|
+
if (this.currentPosition != null && this.startingPosition != null) {
|
|
137
|
+
const position = bundle_esm.point.create(event.screenX, event.screenY);
|
|
138
|
+
const delta = bundle_esm.point.subtract(position, this.currentPosition);
|
|
139
|
+
api.rotateCameraAtPoint(delta, this.startingPosition);
|
|
140
|
+
this.currentPosition = position;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
endDrag(event, api) {
|
|
144
|
+
super.endDrag(event, api);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
class ZoomInteraction extends MouseInteraction {
|
|
148
|
+
constructor(interactionTimeout = 1000) {
|
|
149
|
+
super();
|
|
150
|
+
this.interactionTimeout = interactionTimeout;
|
|
151
|
+
this.type = 'zoom';
|
|
152
|
+
this.didTransformBegin = false;
|
|
153
|
+
}
|
|
154
|
+
beginDrag(event, canvasPosition, api, element) {
|
|
155
|
+
if (this.currentPosition == null) {
|
|
156
|
+
this.currentPosition = bundle_esm.point.create(event.clientX, event.clientY);
|
|
157
|
+
const rect = element.getBoundingClientRect();
|
|
158
|
+
const point = dom.getMouseClientPosition(event, rect);
|
|
159
|
+
this.startPt = point;
|
|
160
|
+
api.beginInteraction();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
drag(event, api) {
|
|
164
|
+
if (this.currentPosition != null) {
|
|
165
|
+
const position = bundle_esm.point.create(event.clientX, event.clientY);
|
|
166
|
+
const delta = bundle_esm.point.subtract(position, this.currentPosition);
|
|
167
|
+
if (this.startPt != null) {
|
|
168
|
+
api.zoomCameraToPoint(this.startPt, delta.y);
|
|
169
|
+
this.currentPosition = position;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
setInteractionTimeout(ms) {
|
|
174
|
+
this.interactionTimeout = ms;
|
|
175
|
+
}
|
|
176
|
+
getInteractionTimeout() {
|
|
177
|
+
return this.interactionTimeout;
|
|
178
|
+
}
|
|
179
|
+
endDrag(event, api) {
|
|
180
|
+
super.endDrag(event, api);
|
|
181
|
+
this.stopInteractionTimer();
|
|
182
|
+
this.didTransformBegin = false;
|
|
183
|
+
this.startPt = undefined;
|
|
184
|
+
}
|
|
185
|
+
zoom(delta, api) {
|
|
186
|
+
this.operateWithTimer(api, () => api.zoomCamera(delta));
|
|
187
|
+
}
|
|
188
|
+
zoomToPoint(pt, delta, api) {
|
|
189
|
+
this.operateWithTimer(api, () => api.zoomCameraToPoint(pt, delta));
|
|
190
|
+
}
|
|
191
|
+
beginInteraction(api) {
|
|
192
|
+
this.didTransformBegin = true;
|
|
193
|
+
api.beginInteraction();
|
|
194
|
+
}
|
|
195
|
+
endInteraction(api) {
|
|
196
|
+
this.didTransformBegin = false;
|
|
197
|
+
api.endInteraction();
|
|
198
|
+
}
|
|
199
|
+
resetInteractionTimer(api) {
|
|
200
|
+
this.stopInteractionTimer();
|
|
201
|
+
this.startInteractionTimer(api);
|
|
202
|
+
}
|
|
203
|
+
startInteractionTimer(api) {
|
|
204
|
+
this.interactionTimer = window.setTimeout(() => {
|
|
205
|
+
this.interactionTimer = undefined;
|
|
206
|
+
this.endInteraction(api);
|
|
207
|
+
}, this.interactionTimeout);
|
|
208
|
+
}
|
|
209
|
+
stopInteractionTimer() {
|
|
210
|
+
if (this.interactionTimer != null) {
|
|
211
|
+
window.clearTimeout(this.interactionTimer);
|
|
212
|
+
this.interactionTimer = undefined;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
operateWithTimer(api, f) {
|
|
216
|
+
if (!this.didTransformBegin) {
|
|
217
|
+
this.beginInteraction(api);
|
|
218
|
+
}
|
|
219
|
+
this.resetInteractionTimer(api);
|
|
220
|
+
f();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
class PanInteraction extends MouseInteraction {
|
|
224
|
+
constructor() {
|
|
225
|
+
super(...arguments);
|
|
226
|
+
this.type = 'pan';
|
|
227
|
+
}
|
|
228
|
+
beginDrag(event, canvasPosition, api, element) {
|
|
229
|
+
if (this.currentPosition == null) {
|
|
230
|
+
this.currentPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
231
|
+
this.canvasRect = element.getBoundingClientRect();
|
|
232
|
+
api.beginInteraction();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
drag(event, api) {
|
|
236
|
+
if (this.currentPosition != null && this.canvasRect != null) {
|
|
237
|
+
const position = dom.getMouseClientPosition(event, this.canvasRect);
|
|
238
|
+
api.panCameraToScreenPoint(position);
|
|
239
|
+
this.currentPosition = position;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
endDrag(event, api) {
|
|
243
|
+
super.endDrag(event, api);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
class TwistInteraction extends MouseInteraction {
|
|
247
|
+
constructor() {
|
|
248
|
+
super(...arguments);
|
|
249
|
+
this.type = 'twist';
|
|
250
|
+
}
|
|
251
|
+
beginDrag(event, canvasPosition, api, element) {
|
|
252
|
+
this.currentPosition = bundle_esm.point.create(event.offsetX, event.offsetY);
|
|
253
|
+
this.canvasRect = element.getBoundingClientRect();
|
|
254
|
+
api.beginInteraction();
|
|
255
|
+
}
|
|
256
|
+
drag(event, api) {
|
|
257
|
+
const position = dom.getMouseClientPosition(event, this.canvasRect);
|
|
258
|
+
this.currentPosition = position;
|
|
259
|
+
api.twistCamera(position);
|
|
260
|
+
}
|
|
261
|
+
endDrag(event, api) {
|
|
262
|
+
super.endDrag(event, api);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
class PivotInteraction extends MouseInteraction {
|
|
266
|
+
constructor() {
|
|
267
|
+
super(...arguments);
|
|
268
|
+
this.type = 'pivot';
|
|
269
|
+
}
|
|
270
|
+
beginDrag(event, canvasPosition, api) {
|
|
271
|
+
if (this.currentPosition == null) {
|
|
272
|
+
this.currentPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
273
|
+
api.beginInteraction();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
drag(event, api) {
|
|
277
|
+
if (this.currentPosition != null) {
|
|
278
|
+
const position = bundle_esm.point.create(event.screenX, event.screenY);
|
|
279
|
+
const delta = bundle_esm.point.subtract(position, this.currentPosition);
|
|
280
|
+
api.pivotCamera(-0.25 * delta.y, 0.25 * delta.x);
|
|
281
|
+
this.currentPosition = position;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
endDrag(event, api) {
|
|
285
|
+
super.endDrag(event, api);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
class PointerInteractionHandler extends multiElementInteractionHandler.MultiElementInteractionHandler {
|
|
290
|
+
constructor(getConfig, rotateInteraction = new RotateInteraction(), rotatePointInteraction = new RotatePointInteraction(), zoomInteraction = new ZoomInteraction(), panInteraction = new PanInteraction(), twistInteraction = new TwistInteraction(), pivotInteraction = new PivotInteraction()) {
|
|
291
|
+
super('pointerdown', 'pointerup', 'pointermove', rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig);
|
|
292
|
+
this.touchPoints = new Set();
|
|
293
|
+
this.handlePointerDown = this.handlePointerDown.bind(this);
|
|
294
|
+
this.handlePointerUp = this.handlePointerUp.bind(this);
|
|
295
|
+
}
|
|
296
|
+
initialize(element, api) {
|
|
297
|
+
super.initialize(element, api);
|
|
298
|
+
element.addEventListener('pointerdown', this.handlePointerDown);
|
|
299
|
+
}
|
|
300
|
+
setZoomInteractionTimeout(ms) {
|
|
301
|
+
this.zoomInteraction.setInteractionTimeout(ms);
|
|
302
|
+
}
|
|
303
|
+
getZoomInteractionTimeout() {
|
|
304
|
+
return this.zoomInteraction.getInteractionTimeout();
|
|
305
|
+
}
|
|
306
|
+
addEventListenersToElement(element) {
|
|
307
|
+
element.addEventListener(this.downEvent, this.handleDownEvent);
|
|
308
|
+
element.addEventListener('wheel', this.handleMouseWheel, {
|
|
309
|
+
passive: false,
|
|
310
|
+
});
|
|
311
|
+
return {
|
|
312
|
+
dispose: () => {
|
|
313
|
+
element.removeEventListener(this.downEvent, this.handleDownEvent);
|
|
314
|
+
element.removeEventListener('wheel', this.handleMouseWheel);
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
handlePointerDown(event) {
|
|
319
|
+
this.downPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
320
|
+
this.touchPoints.add(event.pointerId);
|
|
321
|
+
if (this.touchPoints.size === 1) {
|
|
322
|
+
window.addEventListener('pointerup', this.handlePointerUp);
|
|
323
|
+
}
|
|
324
|
+
if (this.touchPoints.size === 2) {
|
|
325
|
+
this.disableIndividualInteractions = true;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
handlePointerUp(event) {
|
|
329
|
+
this.touchPoints.delete(event.pointerId);
|
|
330
|
+
if (this.touchPoints.size < 2) {
|
|
331
|
+
this.disableIndividualInteractions = false;
|
|
332
|
+
}
|
|
333
|
+
if (this.touchPoints.size === 0) {
|
|
334
|
+
window.removeEventListener('pointerup', this.handlePointerUp);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
72
339
|
function fromUrn(urn) {
|
|
73
340
|
var _a;
|
|
74
341
|
const uri = browser_esm.uri.parse(urn);
|
|
@@ -460,7 +727,7 @@ function buildFlyToOperation(frameCorrelationId, options, animation, baseCamera)
|
|
|
460
727
|
},
|
|
461
728
|
animation: animation
|
|
462
729
|
? {
|
|
463
|
-
duration: bundle_esm.toProtoDuration(animation.milliseconds),
|
|
730
|
+
duration: bundle_esm$1.toProtoDuration(animation.milliseconds),
|
|
464
731
|
}
|
|
465
732
|
: undefined,
|
|
466
733
|
baseCamera: baseCamera != null ? streamAttributes.toProtobuf(baseCamera) : undefined,
|
|
@@ -687,9 +954,9 @@ class Camera {
|
|
|
687
954
|
*/
|
|
688
955
|
signedDistanceToBoundingBoxCenter(boundingBox) {
|
|
689
956
|
const { position, viewVector } = streamAttributes.withPositionAndViewVector(this.data);
|
|
690
|
-
const boundingBoxCenter = bundle_esm
|
|
691
|
-
const cameraToCenter = bundle_esm
|
|
692
|
-
return (bundle_esm
|
|
957
|
+
const boundingBoxCenter = bundle_esm.boundingBox.center(boundingBox !== null && boundingBox !== void 0 ? boundingBox : this.boundingBox);
|
|
958
|
+
const cameraToCenter = bundle_esm.vector3.subtract(boundingBoxCenter, position);
|
|
959
|
+
return (bundle_esm.vector3.dot(viewVector, cameraToCenter) / bundle_esm.vector3.magnitude(viewVector));
|
|
693
960
|
}
|
|
694
961
|
/**
|
|
695
962
|
* Specifies that the next render of the camera will be repositioned to one of
|
|
@@ -859,22 +1126,22 @@ class Camera {
|
|
|
859
1126
|
* @param normal The normal of the plane to align to.
|
|
860
1127
|
*/
|
|
861
1128
|
alignTo(position, normal) {
|
|
862
|
-
const worldX = bundle_esm
|
|
863
|
-
const positiveWorldY = bundle_esm
|
|
1129
|
+
const worldX = bundle_esm.vector3.normalize(bundle_esm.vector3.cross(this.up, bundle_esm.vector3.normalize(this.viewVector)));
|
|
1130
|
+
const positiveWorldY = bundle_esm.vector3.normalize(bundle_esm.vector3.cross(bundle_esm.vector3.normalize(this.viewVector), worldX));
|
|
864
1131
|
// Invert the world y axis if the provided normal is more than 90 degrees from it
|
|
865
1132
|
// to compute a proper angle to rotate the view vector by
|
|
866
|
-
const worldY = bundle_esm
|
|
867
|
-
? bundle_esm
|
|
1133
|
+
const worldY = bundle_esm.vector3.angleTo(normal, positiveWorldY) > Math.PI / 2
|
|
1134
|
+
? bundle_esm.vector3.negate(positiveWorldY)
|
|
868
1135
|
: positiveWorldY;
|
|
869
|
-
const localX = bundle_esm
|
|
1136
|
+
const localX = bundle_esm.vector3.isEqual(worldY, normal)
|
|
870
1137
|
? worldX
|
|
871
|
-
: bundle_esm
|
|
872
|
-
const transformedViewVector = bundle_esm
|
|
873
|
-
const lookAtRay = bundle_esm
|
|
1138
|
+
: bundle_esm.vector3.normalize(bundle_esm.vector3.cross(worldY, normal));
|
|
1139
|
+
const transformedViewVector = bundle_esm.vector3.transformMatrix(this.viewVector, bundle_esm.matrix4.makeRotation(bundle_esm.quaternion.fromAxisAngle(localX, bundle_esm.vector3.angleTo(normal, worldY))));
|
|
1140
|
+
const lookAtRay = bundle_esm.ray.create({
|
|
874
1141
|
origin: position,
|
|
875
|
-
direction: bundle_esm
|
|
1142
|
+
direction: bundle_esm.vector3.normalize(transformedViewVector),
|
|
876
1143
|
});
|
|
877
|
-
const lookAt = bundle_esm
|
|
1144
|
+
const lookAt = bundle_esm.ray.at(lookAtRay, bundle_esm.vector3.magnitude(this.viewVector));
|
|
878
1145
|
return this.update({
|
|
879
1146
|
position,
|
|
880
1147
|
lookAt,
|
|
@@ -893,8 +1160,8 @@ class Camera {
|
|
|
893
1160
|
standardView(standardView) {
|
|
894
1161
|
return this.update({
|
|
895
1162
|
position: standardView.position,
|
|
896
|
-
viewVector: bundle_esm
|
|
897
|
-
lookAt: bundle_esm
|
|
1163
|
+
viewVector: bundle_esm.vector3.subtract(bundle_esm.vector3.origin(), standardView.position),
|
|
1164
|
+
lookAt: bundle_esm.vector3.origin(),
|
|
898
1165
|
up: standardView.up,
|
|
899
1166
|
});
|
|
900
1167
|
}
|
|
@@ -908,15 +1175,15 @@ class Camera {
|
|
|
908
1175
|
* @returns A new camera.
|
|
909
1176
|
*/
|
|
910
1177
|
standardViewFixedLookAt(standardView) {
|
|
911
|
-
const standardViewRay = bundle_esm
|
|
1178
|
+
const standardViewRay = bundle_esm.ray.create({
|
|
912
1179
|
origin: this.lookAt,
|
|
913
|
-
direction: bundle_esm
|
|
1180
|
+
direction: bundle_esm.vector3.normalize(standardView.position),
|
|
914
1181
|
});
|
|
915
|
-
const updatedPosition = bundle_esm
|
|
1182
|
+
const updatedPosition = bundle_esm.ray.at(standardViewRay, bundle_esm.vector3.magnitude(this.viewVector));
|
|
916
1183
|
return this.update({
|
|
917
1184
|
up: standardView.up,
|
|
918
1185
|
position: updatedPosition,
|
|
919
|
-
viewVector: bundle_esm
|
|
1186
|
+
viewVector: bundle_esm.vector3.subtract(this.lookAt, updatedPosition),
|
|
920
1187
|
});
|
|
921
1188
|
}
|
|
922
1189
|
buildFlyToType(options) {
|
|
@@ -953,15 +1220,15 @@ class PerspectiveCamera extends Camera {
|
|
|
953
1220
|
*/
|
|
954
1221
|
moveBy(delta) {
|
|
955
1222
|
return this.update({
|
|
956
|
-
position: bundle_esm
|
|
957
|
-
lookAt: bundle_esm
|
|
1223
|
+
position: bundle_esm.vector3.add(this.position, delta),
|
|
1224
|
+
lookAt: bundle_esm.vector3.add(this.lookAt, delta),
|
|
958
1225
|
});
|
|
959
1226
|
}
|
|
960
1227
|
rotateAroundAxisAtPoint(angleInRadians, point, axis) {
|
|
961
1228
|
return this.update({
|
|
962
|
-
position: bundle_esm
|
|
963
|
-
lookAt: bundle_esm
|
|
964
|
-
up: bundle_esm
|
|
1229
|
+
position: bundle_esm.vector3.rotateAboutAxis(angleInRadians, this.position, axis, point),
|
|
1230
|
+
lookAt: bundle_esm.vector3.rotateAboutAxis(angleInRadians, this.lookAt, axis, point),
|
|
1231
|
+
up: bundle_esm.vector3.rotateAboutAxis(angleInRadians, this.up, axis, bundle_esm.vector3.origin()),
|
|
965
1232
|
});
|
|
966
1233
|
}
|
|
967
1234
|
update(camera) {
|
|
@@ -974,7 +1241,7 @@ class PerspectiveCamera extends Camera {
|
|
|
974
1241
|
return new streamAttributes.FramePerspectiveCamera(this.position, this.lookAt, this.up, this.near, this.far, this.aspectRatio, (_a = this.fovY) !== null && _a !== void 0 ? _a : 45);
|
|
975
1242
|
}
|
|
976
1243
|
get viewVector() {
|
|
977
|
-
return bundle_esm
|
|
1244
|
+
return bundle_esm.vector3.subtract(this.lookAt, this.position);
|
|
978
1245
|
}
|
|
979
1246
|
/**
|
|
980
1247
|
* The position vector for the camera, in world space coordinates.
|
|
@@ -1037,27 +1304,27 @@ class OrthographicCamera extends Camera {
|
|
|
1037
1304
|
*/
|
|
1038
1305
|
moveBy(delta) {
|
|
1039
1306
|
// The rotation point should match the lookAt point when panning
|
|
1040
|
-
const updatedPoint = bundle_esm
|
|
1307
|
+
const updatedPoint = bundle_esm.vector3.add(this.lookAt, delta);
|
|
1041
1308
|
return this.update({
|
|
1042
1309
|
lookAt: updatedPoint,
|
|
1043
1310
|
rotationPoint: updatedPoint,
|
|
1044
1311
|
});
|
|
1045
1312
|
}
|
|
1046
1313
|
rotateAroundAxisAtPoint(angleInRadians, point, axis) {
|
|
1047
|
-
const updatedLookAt = bundle_esm
|
|
1048
|
-
const updatedPosition = bundle_esm
|
|
1049
|
-
const viewVector = streamAttributes.constrainViewVector(bundle_esm
|
|
1314
|
+
const updatedLookAt = bundle_esm.vector3.rotateAboutAxis(angleInRadians, this.lookAt, axis, point);
|
|
1315
|
+
const updatedPosition = bundle_esm.vector3.rotateAboutAxis(angleInRadians, this.position, axis, point);
|
|
1316
|
+
const viewVector = streamAttributes.constrainViewVector(bundle_esm.vector3.subtract(updatedLookAt, updatedPosition), bundle_esm.boundingSphere.create(this.boundingBox));
|
|
1050
1317
|
return this.update({
|
|
1051
1318
|
viewVector: viewVector,
|
|
1052
1319
|
lookAt: updatedLookAt,
|
|
1053
|
-
up: bundle_esm
|
|
1320
|
+
up: bundle_esm.vector3.rotateAboutAxis(angleInRadians, this.up, axis, bundle_esm.vector3.origin()),
|
|
1054
1321
|
});
|
|
1055
1322
|
}
|
|
1056
1323
|
update(camera) {
|
|
1057
1324
|
return new OrthographicCamera(this.stream, this.aspect, Object.assign(Object.assign({}, this.orthographicData), camera), this.boundingBox, this.decodeFrame, this.flyToOptions);
|
|
1058
1325
|
}
|
|
1059
1326
|
toFrameCamera() {
|
|
1060
|
-
const boundingSphere = bundle_esm
|
|
1327
|
+
const boundingSphere = bundle_esm.boundingSphere.create(this.boundingBox);
|
|
1061
1328
|
const viewVector = streamAttributes.constrainViewVector(this.viewVector, boundingSphere);
|
|
1062
1329
|
const lookAt = streamAttributes.updateLookAtRelativeToBoundingBoxCenter(this.lookAt, viewVector, boundingSphere.center);
|
|
1063
1330
|
return new streamAttributes.FrameOrthographicCamera(viewVector, lookAt, this.up, this.near, this.far, this.aspectRatio, this.fovHeight, this.rotationPoint);
|
|
@@ -1066,7 +1333,7 @@ class OrthographicCamera extends Camera {
|
|
|
1066
1333
|
return Object.assign({}, this.orthographicData.viewVector);
|
|
1067
1334
|
}
|
|
1068
1335
|
get position() {
|
|
1069
|
-
return bundle_esm
|
|
1336
|
+
return bundle_esm.vector3.add(this.lookAt, bundle_esm.vector3.negate(this.viewVector));
|
|
1070
1337
|
}
|
|
1071
1338
|
/**
|
|
1072
1339
|
* A vector, in world space coordinates, of where the camera should be rotated around.
|
|
@@ -1296,7 +1563,7 @@ class Raycaster {
|
|
|
1296
1563
|
async hitItems(point, options) {
|
|
1297
1564
|
const scale = this.imageScaleProvider();
|
|
1298
1565
|
const res = await this.stream.hitItems({
|
|
1299
|
-
point: bundle_esm
|
|
1566
|
+
point: bundle_esm.point.scale(point, (scale === null || scale === void 0 ? void 0 : scale.x) || 1, (scale === null || scale === void 0 ? void 0 : scale.y) || 1),
|
|
1300
1567
|
includeMetadata: options === null || options === void 0 ? void 0 : options.includeMetadata,
|
|
1301
1568
|
}, true);
|
|
1302
1569
|
return res.hitItems || undefined;
|
|
@@ -1334,7 +1601,7 @@ class SceneViewStateLoader {
|
|
|
1334
1601
|
const flyToResult = await this.stream.flyTo({
|
|
1335
1602
|
sceneViewStateIdentifier: identifier,
|
|
1336
1603
|
animation: {
|
|
1337
|
-
duration: bundle_esm.toProtoDuration(opts.animation.milliseconds),
|
|
1604
|
+
duration: bundle_esm$1.toProtoDuration(opts.animation.milliseconds),
|
|
1338
1605
|
},
|
|
1339
1606
|
frameCorrelationId: {
|
|
1340
1607
|
value: corrId,
|
|
@@ -1889,7 +2156,7 @@ class Scene {
|
|
|
1889
2156
|
camera() {
|
|
1890
2157
|
const { scene } = this.frame;
|
|
1891
2158
|
if (scene.camera.isOrthographic()) {
|
|
1892
|
-
return new OrthographicCamera(this.stream, bundle_esm
|
|
2159
|
+
return new OrthographicCamera(this.stream, bundle_esm.dimensions.aspectRatio(this.viewport()), {
|
|
1893
2160
|
viewVector: scene.camera.viewVector,
|
|
1894
2161
|
lookAt: scene.camera.lookAt,
|
|
1895
2162
|
up: scene.camera.up,
|
|
@@ -1898,7 +2165,7 @@ class Scene {
|
|
|
1898
2165
|
}, this.frame.scene.boundingBox, this.decodeFrame);
|
|
1899
2166
|
}
|
|
1900
2167
|
else if (scene.camera.isPerspective()) {
|
|
1901
|
-
return new PerspectiveCamera(this.stream, bundle_esm
|
|
2168
|
+
return new PerspectiveCamera(this.stream, bundle_esm.dimensions.aspectRatio(this.viewport()), {
|
|
1902
2169
|
position: scene.camera.position,
|
|
1903
2170
|
lookAt: scene.camera.lookAt,
|
|
1904
2171
|
up: scene.camera.up,
|
|
@@ -1941,7 +2208,7 @@ class Scene {
|
|
|
1941
2208
|
* The current x and y scale of the rendered image.
|
|
1942
2209
|
*/
|
|
1943
2210
|
scale() {
|
|
1944
|
-
return this.imageScaleProvider() || bundle_esm
|
|
2211
|
+
return this.imageScaleProvider() || bundle_esm.point.create(1, 1);
|
|
1945
2212
|
}
|
|
1946
2213
|
}
|
|
1947
2214
|
|
|
@@ -2376,16 +2643,23 @@ class SceneItemQueryExecutor {
|
|
|
2376
2643
|
|
|
2377
2644
|
exports.Camera = Camera;
|
|
2378
2645
|
exports.CrossSectioner = CrossSectioner;
|
|
2646
|
+
exports.PanInteraction = PanInteraction;
|
|
2647
|
+
exports.PivotInteraction = PivotInteraction;
|
|
2648
|
+
exports.PointerInteractionHandler = PointerInteractionHandler;
|
|
2379
2649
|
exports.Raycaster = Raycaster;
|
|
2380
2650
|
exports.RootQuery = RootQuery;
|
|
2651
|
+
exports.RotateInteraction = RotateInteraction;
|
|
2652
|
+
exports.RotatePointInteraction = RotatePointInteraction;
|
|
2381
2653
|
exports.Scene = Scene;
|
|
2382
2654
|
exports.SceneItemOperationsBuilder = SceneItemOperationsBuilder;
|
|
2383
2655
|
exports.SceneItemQueryExecutor = SceneItemQueryExecutor;
|
|
2384
2656
|
exports.SceneOperationBuilder = SceneOperationBuilder;
|
|
2385
2657
|
exports.SynchronizedClock = SynchronizedClock;
|
|
2658
|
+
exports.TwistInteraction = TwistInteraction;
|
|
2659
|
+
exports.ZoomInteraction = ZoomInteraction;
|
|
2386
2660
|
exports.colorMaterial = colorMaterial;
|
|
2387
2661
|
exports.fromUrn = fromUrn;
|
|
2388
2662
|
exports.loadableResource = loadableResource;
|
|
2389
2663
|
exports.sceneViewStateIdentifier = sceneViewStateIdentifier;
|
|
2390
2664
|
|
|
2391
|
-
//# sourceMappingURL=queries-
|
|
2665
|
+
//# sourceMappingURL=queries-918bb133.js.map
|