@vertexvis/viewer 0.22.0-canary.3 → 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
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
+
import { p as point, b as boundingBox, v as vector3, m as matrix4, q as quaternion, r as ray, a as boundingSphere, d as dimensions } from './bundle.esm.js';
|
|
5
|
+
import { g as getMouseClientPosition } from './dom.js';
|
|
6
|
+
import { M as MultiElementInteractionHandler } from './multiElementInteractionHandler.js';
|
|
4
7
|
import { c as color, u as uri, a as async, b as uuid } from './browser.esm.js';
|
|
5
8
|
import { I as InvalidResourceUrnError, a as InvalidArgumentError, b as InvalidCameraError } from './errors.js';
|
|
6
|
-
import { b as boundingBox, v as vector3, m as matrix4, q as quaternion, r as ray, a as boundingSphere, p as point, d as dimensions } from './bundle.esm.js';
|
|
7
9
|
import { t as toProtobuf, v as vertexvis, w as withPositionAndViewVector, h as fromBoundingBoxAndLookAtCamera, f as FramePerspectiveCamera, i as constrainViewVector, u as updateLookAtRelativeToBoundingBoxCenter, e as FrameOrthographicCamera } from './streamAttributes.js';
|
|
8
10
|
import { r as representation_pb } from './scene_view_api_pb.js';
|
|
9
11
|
import { t as toProtoDuration } from './bundle.esm2.js';
|
|
@@ -66,6 +68,271 @@ const colorMaterial = /*#__PURE__*/Object.freeze({
|
|
|
66
68
|
fromHex: fromHex
|
|
67
69
|
});
|
|
68
70
|
|
|
71
|
+
class MouseInteraction {
|
|
72
|
+
setPosition(position) {
|
|
73
|
+
this.currentPosition = position;
|
|
74
|
+
}
|
|
75
|
+
getPosition() {
|
|
76
|
+
return this.currentPosition;
|
|
77
|
+
}
|
|
78
|
+
getType() {
|
|
79
|
+
return this.type;
|
|
80
|
+
}
|
|
81
|
+
beginDrag(event, canvasPosition, api, element) {
|
|
82
|
+
// noop
|
|
83
|
+
}
|
|
84
|
+
drag(event, api) {
|
|
85
|
+
// noop
|
|
86
|
+
}
|
|
87
|
+
endDrag(event, api) {
|
|
88
|
+
if (this.currentPosition != null) {
|
|
89
|
+
api.endInteraction();
|
|
90
|
+
this.currentPosition = undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
zoom(delta, api) {
|
|
94
|
+
// noop
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
class RotateInteraction extends MouseInteraction {
|
|
98
|
+
constructor() {
|
|
99
|
+
super(...arguments);
|
|
100
|
+
this.type = 'rotate';
|
|
101
|
+
}
|
|
102
|
+
beginDrag(event, canvasPosition, api) {
|
|
103
|
+
if (this.currentPosition == null) {
|
|
104
|
+
this.currentPosition = point.create(event.screenX, event.screenY);
|
|
105
|
+
api.beginInteraction();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
drag(event, api) {
|
|
109
|
+
if (this.currentPosition != null) {
|
|
110
|
+
const position = point.create(event.screenX, event.screenY);
|
|
111
|
+
const delta = point.subtract(position, this.currentPosition);
|
|
112
|
+
api.rotateCamera(delta);
|
|
113
|
+
this.currentPosition = position;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
endDrag(event, api) {
|
|
117
|
+
super.endDrag(event, api);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
class RotatePointInteraction extends MouseInteraction {
|
|
121
|
+
constructor() {
|
|
122
|
+
super(...arguments);
|
|
123
|
+
this.type = 'rotate-point';
|
|
124
|
+
}
|
|
125
|
+
beginDrag(event, canvasPosition, api) {
|
|
126
|
+
if (this.currentPosition == null) {
|
|
127
|
+
this.currentPosition = point.create(event.screenX, event.screenY);
|
|
128
|
+
this.startingPosition = canvasPosition;
|
|
129
|
+
api.beginInteraction();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
drag(event, api) {
|
|
133
|
+
if (this.currentPosition != null && this.startingPosition != null) {
|
|
134
|
+
const position = point.create(event.screenX, event.screenY);
|
|
135
|
+
const delta = point.subtract(position, this.currentPosition);
|
|
136
|
+
api.rotateCameraAtPoint(delta, this.startingPosition);
|
|
137
|
+
this.currentPosition = position;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
endDrag(event, api) {
|
|
141
|
+
super.endDrag(event, api);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
class ZoomInteraction extends MouseInteraction {
|
|
145
|
+
constructor(interactionTimeout = 1000) {
|
|
146
|
+
super();
|
|
147
|
+
this.interactionTimeout = interactionTimeout;
|
|
148
|
+
this.type = 'zoom';
|
|
149
|
+
this.didTransformBegin = false;
|
|
150
|
+
}
|
|
151
|
+
beginDrag(event, canvasPosition, api, element) {
|
|
152
|
+
if (this.currentPosition == null) {
|
|
153
|
+
this.currentPosition = point.create(event.clientX, event.clientY);
|
|
154
|
+
const rect = element.getBoundingClientRect();
|
|
155
|
+
const point$1 = getMouseClientPosition(event, rect);
|
|
156
|
+
this.startPt = point$1;
|
|
157
|
+
api.beginInteraction();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
drag(event, api) {
|
|
161
|
+
if (this.currentPosition != null) {
|
|
162
|
+
const position = point.create(event.clientX, event.clientY);
|
|
163
|
+
const delta = point.subtract(position, this.currentPosition);
|
|
164
|
+
if (this.startPt != null) {
|
|
165
|
+
api.zoomCameraToPoint(this.startPt, delta.y);
|
|
166
|
+
this.currentPosition = position;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
setInteractionTimeout(ms) {
|
|
171
|
+
this.interactionTimeout = ms;
|
|
172
|
+
}
|
|
173
|
+
getInteractionTimeout() {
|
|
174
|
+
return this.interactionTimeout;
|
|
175
|
+
}
|
|
176
|
+
endDrag(event, api) {
|
|
177
|
+
super.endDrag(event, api);
|
|
178
|
+
this.stopInteractionTimer();
|
|
179
|
+
this.didTransformBegin = false;
|
|
180
|
+
this.startPt = undefined;
|
|
181
|
+
}
|
|
182
|
+
zoom(delta, api) {
|
|
183
|
+
this.operateWithTimer(api, () => api.zoomCamera(delta));
|
|
184
|
+
}
|
|
185
|
+
zoomToPoint(pt, delta, api) {
|
|
186
|
+
this.operateWithTimer(api, () => api.zoomCameraToPoint(pt, delta));
|
|
187
|
+
}
|
|
188
|
+
beginInteraction(api) {
|
|
189
|
+
this.didTransformBegin = true;
|
|
190
|
+
api.beginInteraction();
|
|
191
|
+
}
|
|
192
|
+
endInteraction(api) {
|
|
193
|
+
this.didTransformBegin = false;
|
|
194
|
+
api.endInteraction();
|
|
195
|
+
}
|
|
196
|
+
resetInteractionTimer(api) {
|
|
197
|
+
this.stopInteractionTimer();
|
|
198
|
+
this.startInteractionTimer(api);
|
|
199
|
+
}
|
|
200
|
+
startInteractionTimer(api) {
|
|
201
|
+
this.interactionTimer = window.setTimeout(() => {
|
|
202
|
+
this.interactionTimer = undefined;
|
|
203
|
+
this.endInteraction(api);
|
|
204
|
+
}, this.interactionTimeout);
|
|
205
|
+
}
|
|
206
|
+
stopInteractionTimer() {
|
|
207
|
+
if (this.interactionTimer != null) {
|
|
208
|
+
window.clearTimeout(this.interactionTimer);
|
|
209
|
+
this.interactionTimer = undefined;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
operateWithTimer(api, f) {
|
|
213
|
+
if (!this.didTransformBegin) {
|
|
214
|
+
this.beginInteraction(api);
|
|
215
|
+
}
|
|
216
|
+
this.resetInteractionTimer(api);
|
|
217
|
+
f();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
class PanInteraction extends MouseInteraction {
|
|
221
|
+
constructor() {
|
|
222
|
+
super(...arguments);
|
|
223
|
+
this.type = 'pan';
|
|
224
|
+
}
|
|
225
|
+
beginDrag(event, canvasPosition, api, element) {
|
|
226
|
+
if (this.currentPosition == null) {
|
|
227
|
+
this.currentPosition = point.create(event.screenX, event.screenY);
|
|
228
|
+
this.canvasRect = element.getBoundingClientRect();
|
|
229
|
+
api.beginInteraction();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
drag(event, api) {
|
|
233
|
+
if (this.currentPosition != null && this.canvasRect != null) {
|
|
234
|
+
const position = getMouseClientPosition(event, this.canvasRect);
|
|
235
|
+
api.panCameraToScreenPoint(position);
|
|
236
|
+
this.currentPosition = position;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
endDrag(event, api) {
|
|
240
|
+
super.endDrag(event, api);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
class TwistInteraction extends MouseInteraction {
|
|
244
|
+
constructor() {
|
|
245
|
+
super(...arguments);
|
|
246
|
+
this.type = 'twist';
|
|
247
|
+
}
|
|
248
|
+
beginDrag(event, canvasPosition, api, element) {
|
|
249
|
+
this.currentPosition = point.create(event.offsetX, event.offsetY);
|
|
250
|
+
this.canvasRect = element.getBoundingClientRect();
|
|
251
|
+
api.beginInteraction();
|
|
252
|
+
}
|
|
253
|
+
drag(event, api) {
|
|
254
|
+
const position = getMouseClientPosition(event, this.canvasRect);
|
|
255
|
+
this.currentPosition = position;
|
|
256
|
+
api.twistCamera(position);
|
|
257
|
+
}
|
|
258
|
+
endDrag(event, api) {
|
|
259
|
+
super.endDrag(event, api);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
class PivotInteraction extends MouseInteraction {
|
|
263
|
+
constructor() {
|
|
264
|
+
super(...arguments);
|
|
265
|
+
this.type = 'pivot';
|
|
266
|
+
}
|
|
267
|
+
beginDrag(event, canvasPosition, api) {
|
|
268
|
+
if (this.currentPosition == null) {
|
|
269
|
+
this.currentPosition = point.create(event.screenX, event.screenY);
|
|
270
|
+
api.beginInteraction();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
drag(event, api) {
|
|
274
|
+
if (this.currentPosition != null) {
|
|
275
|
+
const position = point.create(event.screenX, event.screenY);
|
|
276
|
+
const delta = point.subtract(position, this.currentPosition);
|
|
277
|
+
api.pivotCamera(-0.25 * delta.y, 0.25 * delta.x);
|
|
278
|
+
this.currentPosition = position;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
endDrag(event, api) {
|
|
282
|
+
super.endDrag(event, api);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
class PointerInteractionHandler extends MultiElementInteractionHandler {
|
|
287
|
+
constructor(getConfig, rotateInteraction = new RotateInteraction(), rotatePointInteraction = new RotatePointInteraction(), zoomInteraction = new ZoomInteraction(), panInteraction = new PanInteraction(), twistInteraction = new TwistInteraction(), pivotInteraction = new PivotInteraction()) {
|
|
288
|
+
super('pointerdown', 'pointerup', 'pointermove', rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig);
|
|
289
|
+
this.touchPoints = new Set();
|
|
290
|
+
this.handlePointerDown = this.handlePointerDown.bind(this);
|
|
291
|
+
this.handlePointerUp = this.handlePointerUp.bind(this);
|
|
292
|
+
}
|
|
293
|
+
initialize(element, api) {
|
|
294
|
+
super.initialize(element, api);
|
|
295
|
+
element.addEventListener('pointerdown', this.handlePointerDown);
|
|
296
|
+
}
|
|
297
|
+
setZoomInteractionTimeout(ms) {
|
|
298
|
+
this.zoomInteraction.setInteractionTimeout(ms);
|
|
299
|
+
}
|
|
300
|
+
getZoomInteractionTimeout() {
|
|
301
|
+
return this.zoomInteraction.getInteractionTimeout();
|
|
302
|
+
}
|
|
303
|
+
addEventListenersToElement(element) {
|
|
304
|
+
element.addEventListener(this.downEvent, this.handleDownEvent);
|
|
305
|
+
element.addEventListener('wheel', this.handleMouseWheel, {
|
|
306
|
+
passive: false,
|
|
307
|
+
});
|
|
308
|
+
return {
|
|
309
|
+
dispose: () => {
|
|
310
|
+
element.removeEventListener(this.downEvent, this.handleDownEvent);
|
|
311
|
+
element.removeEventListener('wheel', this.handleMouseWheel);
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
handlePointerDown(event) {
|
|
316
|
+
this.downPosition = point.create(event.screenX, event.screenY);
|
|
317
|
+
this.touchPoints.add(event.pointerId);
|
|
318
|
+
if (this.touchPoints.size === 1) {
|
|
319
|
+
window.addEventListener('pointerup', this.handlePointerUp);
|
|
320
|
+
}
|
|
321
|
+
if (this.touchPoints.size === 2) {
|
|
322
|
+
this.disableIndividualInteractions = true;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
handlePointerUp(event) {
|
|
326
|
+
this.touchPoints.delete(event.pointerId);
|
|
327
|
+
if (this.touchPoints.size < 2) {
|
|
328
|
+
this.disableIndividualInteractions = false;
|
|
329
|
+
}
|
|
330
|
+
if (this.touchPoints.size === 0) {
|
|
331
|
+
window.removeEventListener('pointerup', this.handlePointerUp);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
69
336
|
function fromUrn(urn) {
|
|
70
337
|
var _a;
|
|
71
338
|
const uri$1 = uri.parse(urn);
|
|
@@ -2371,6 +2638,6 @@ class SceneItemQueryExecutor {
|
|
|
2371
2638
|
}
|
|
2372
2639
|
}
|
|
2373
2640
|
|
|
2374
|
-
export { Camera as C, Raycaster as R, Scene as S, CrossSectioner as a, RootQuery as b, colorMaterial as c, SceneItemOperationsBuilder as d, SceneItemQueryExecutor as e, SceneOperationBuilder as f, SynchronizedClock as g,
|
|
2641
|
+
export { Camera as C, PointerInteractionHandler as P, Raycaster as R, Scene as S, TwistInteraction as T, ZoomInteraction as Z, CrossSectioner as a, RootQuery as b, colorMaterial as c, SceneItemOperationsBuilder as d, SceneItemQueryExecutor as e, SceneOperationBuilder as f, SynchronizedClock as g, RotateInteraction as h, RotatePointInteraction as i, PanInteraction as j, PivotInteraction as k, loadableResource as l, fromUrn as m, sceneViewStateIdentifier as s };
|
|
2375
2642
|
|
|
2376
2643
|
//# sourceMappingURL=queries.js.map
|