@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.
Files changed (50) hide show
  1. package/dist/cjs/index.cjs.js +4 -1
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/cjs/multiElementInteractionHandler-93bd9593.js.map +1 -1
  4. package/dist/cjs/{queries-d9cd5ec1.js → queries-918bb133.js} +315 -41
  5. package/dist/cjs/queries-918bb133.js.map +1 -0
  6. package/dist/cjs/vertex-viewer.cjs.entry.js +3 -256
  7. package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
  8. package/dist/collection/index.js +1 -0
  9. package/dist/collection/index.js.map +1 -1
  10. package/dist/collection/lib/interactions/baseInteractionHandler.js.map +1 -1
  11. package/dist/collection/lib/interactions/index.js +1 -0
  12. package/dist/collection/lib/interactions/index.js.map +1 -1
  13. package/dist/collection/lib/interactions/mouseInteractions.js +6 -0
  14. package/dist/collection/lib/interactions/mouseInteractions.js.map +1 -1
  15. package/dist/collection/lib/interactions/pointerInteractionHandler.js +6 -0
  16. package/dist/collection/lib/interactions/pointerInteractionHandler.js.map +1 -1
  17. package/dist/components/index.js +1 -1
  18. package/dist/components/multiElementInteractionHandler.js.map +1 -1
  19. package/dist/components/queries.js +269 -2
  20. package/dist/components/queries.js.map +1 -1
  21. package/dist/components/vertex-viewer.js +3 -256
  22. package/dist/components/vertex-viewer.js.map +1 -1
  23. package/dist/esm/index.js +3 -1
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/index.mjs +3 -1
  26. package/dist/esm/multiElementInteractionHandler-8b48d16e.js.map +1 -1
  27. package/dist/esm/{queries-2834b01d.js → queries-e3684cb0.js} +270 -3
  28. package/dist/esm/queries-e3684cb0.js.map +1 -0
  29. package/dist/esm/vertex-viewer.entry.js +3 -256
  30. package/dist/esm/vertex-viewer.entry.js.map +1 -1
  31. package/dist/types/index.d.ts +1 -0
  32. package/dist/types/lib/interactions/baseInteractionHandler.d.ts +6 -6
  33. package/dist/types/lib/interactions/index.d.ts +1 -0
  34. package/dist/types/lib/interactions/mouseInteractions.d.ts +2 -0
  35. package/dist/types/lib/interactions/pointerInteractionHandler.d.ts +2 -0
  36. package/dist/viewer/index.esm.js +1 -1
  37. package/dist/viewer/index.esm.js.map +1 -1
  38. package/dist/viewer/p-0ab3b3cc.js +5 -0
  39. package/dist/viewer/p-0ab3b3cc.js.map +1 -0
  40. package/dist/viewer/p-8a56c008.entry.js +5 -0
  41. package/dist/viewer/p-8a56c008.entry.js.map +1 -0
  42. package/dist/viewer/p-bf67f570.js.map +1 -1
  43. package/dist/viewer/viewer.esm.js +1 -1
  44. package/package.json +7 -7
  45. package/dist/cjs/queries-d9cd5ec1.js.map +0 -1
  46. package/dist/esm/queries-2834b01d.js.map +0 -1
  47. package/dist/viewer/p-339774b3.js +0 -5
  48. package/dist/viewer/p-339774b3.js.map +0 -1
  49. package/dist/viewer/p-b8dfa0c1.entry.js +0 -5
  50. package/dist/viewer/p-b8dfa0c1.entry.js.map +0 -1
@@ -13,11 +13,11 @@ import { r as requestUnary, c as createMetadata, a as requestPaged } from './grp
13
13
  import { l as fromPbStencilBufferOrThrow, m as decodePng, n as DepthBuffer, o as fromPbStringValue, j as fromPbVector3f, u as updateLookAtRelativeToBoundingBoxCenter, t as toProtobuf, p as toPbStreamAttributes, q as toPbRGBi, r as fromPbFrameOrThrow, s as fromPbStartStreamResponseOrThrow, x as fromPbReconnectResponseOrThrow, y as fromPbSyncTimeResponseOrThrow, z as fromPbRefreshTokenResponseOrThrow, B as copySummaryIfInvalid, C as toOrthographic, E as toPerspective } from './streamAttributes-432eda7f.js';
14
14
  import { p as parseConfig } from './config-f2ab94b1.js';
15
15
  import { C as CursorManager } from './cursors-a4099905.js';
16
- import { g as getMouseClientPosition, c as cssCursor } from './dom-9cb336d6.js';
16
+ import { c as cssCursor } from './dom-9cb336d6.js';
17
17
  import { E as EntityType } from './entities-0a248a42.js';
18
18
  import { V as Viewport } from './viewport-524a6a2d.js';
19
- import { B as BaseInteractionHandler, M as MultiElementInteractionHandler } from './multiElementInteractionHandler-8b48d16e.js';
20
- import { h as fromUrn, g as SynchronizedClock, S as Scene } from './queries-2834b01d.js';
19
+ import { h as RotateInteraction, i as RotatePointInteraction, Z as ZoomInteraction, j as PanInteraction, T as TwistInteraction, k as PivotInteraction, m as fromUrn, g as SynchronizedClock, P as PointerInteractionHandler, S as Scene } from './queries-e3684cb0.js';
20
+ import { B as BaseInteractionHandler } from './multiElementInteractionHandler-8b48d16e.js';
21
21
  import { w as writeDOM } from './stencil-0342329e.js';
22
22
  import './wrappers_pb-5d0d9a6b.js';
23
23
  import './_commonjsHelpers-f41b5686.js';
@@ -1254,215 +1254,6 @@ class FlyToPositionKeyInteraction {
1254
1254
  }
1255
1255
  }
1256
1256
 
1257
- class MouseInteraction {
1258
- setPosition(position) {
1259
- this.currentPosition = position;
1260
- }
1261
- getPosition() {
1262
- return this.currentPosition;
1263
- }
1264
- getType() {
1265
- return this.type;
1266
- }
1267
- beginDrag(event, canvasPosition, api, element) {
1268
- // noop
1269
- }
1270
- drag(event, api) {
1271
- // noop
1272
- }
1273
- endDrag(event, api) {
1274
- if (this.currentPosition != null) {
1275
- api.endInteraction();
1276
- this.currentPosition = undefined;
1277
- }
1278
- }
1279
- zoom(delta, api) {
1280
- // noop
1281
- }
1282
- }
1283
- class RotateInteraction extends MouseInteraction {
1284
- constructor() {
1285
- super(...arguments);
1286
- this.type = 'rotate';
1287
- }
1288
- beginDrag(event, canvasPosition, api) {
1289
- if (this.currentPosition == null) {
1290
- this.currentPosition = point.create(event.screenX, event.screenY);
1291
- api.beginInteraction();
1292
- }
1293
- }
1294
- drag(event, api) {
1295
- if (this.currentPosition != null) {
1296
- const position = point.create(event.screenX, event.screenY);
1297
- const delta = point.subtract(position, this.currentPosition);
1298
- api.rotateCamera(delta);
1299
- this.currentPosition = position;
1300
- }
1301
- }
1302
- endDrag(event, api) {
1303
- super.endDrag(event, api);
1304
- }
1305
- }
1306
- class RotatePointInteraction extends MouseInteraction {
1307
- constructor() {
1308
- super(...arguments);
1309
- this.type = 'rotate-point';
1310
- }
1311
- beginDrag(event, canvasPosition, api) {
1312
- if (this.currentPosition == null) {
1313
- this.currentPosition = point.create(event.screenX, event.screenY);
1314
- this.startingPosition = canvasPosition;
1315
- api.beginInteraction();
1316
- }
1317
- }
1318
- drag(event, api) {
1319
- if (this.currentPosition != null && this.startingPosition != null) {
1320
- const position = point.create(event.screenX, event.screenY);
1321
- const delta = point.subtract(position, this.currentPosition);
1322
- api.rotateCameraAtPoint(delta, this.startingPosition);
1323
- this.currentPosition = position;
1324
- }
1325
- }
1326
- endDrag(event, api) {
1327
- super.endDrag(event, api);
1328
- }
1329
- }
1330
- class ZoomInteraction extends MouseInteraction {
1331
- constructor(interactionTimeout = 1000) {
1332
- super();
1333
- this.interactionTimeout = interactionTimeout;
1334
- this.type = 'zoom';
1335
- this.didTransformBegin = false;
1336
- }
1337
- beginDrag(event, canvasPosition, api, element) {
1338
- if (this.currentPosition == null) {
1339
- this.currentPosition = point.create(event.clientX, event.clientY);
1340
- const rect = element.getBoundingClientRect();
1341
- const point$1 = getMouseClientPosition(event, rect);
1342
- this.startPt = point$1;
1343
- api.beginInteraction();
1344
- }
1345
- }
1346
- drag(event, api) {
1347
- if (this.currentPosition != null) {
1348
- const position = point.create(event.clientX, event.clientY);
1349
- const delta = point.subtract(position, this.currentPosition);
1350
- if (this.startPt != null) {
1351
- api.zoomCameraToPoint(this.startPt, delta.y);
1352
- this.currentPosition = position;
1353
- }
1354
- }
1355
- }
1356
- endDrag(event, api) {
1357
- super.endDrag(event, api);
1358
- this.stopInteractionTimer();
1359
- this.didTransformBegin = false;
1360
- this.startPt = undefined;
1361
- }
1362
- zoom(delta, api) {
1363
- this.operateWithTimer(api, () => api.zoomCamera(delta));
1364
- }
1365
- zoomToPoint(pt, delta, api) {
1366
- this.operateWithTimer(api, () => api.zoomCameraToPoint(pt, delta));
1367
- }
1368
- beginInteraction(api) {
1369
- this.didTransformBegin = true;
1370
- api.beginInteraction();
1371
- }
1372
- endInteraction(api) {
1373
- this.didTransformBegin = false;
1374
- api.endInteraction();
1375
- }
1376
- resetInteractionTimer(api) {
1377
- this.stopInteractionTimer();
1378
- this.startInteractionTimer(api);
1379
- }
1380
- startInteractionTimer(api) {
1381
- this.interactionTimer = window.setTimeout(() => {
1382
- this.interactionTimer = undefined;
1383
- this.endInteraction(api);
1384
- }, this.interactionTimeout);
1385
- }
1386
- stopInteractionTimer() {
1387
- if (this.interactionTimer != null) {
1388
- window.clearTimeout(this.interactionTimer);
1389
- this.interactionTimer = undefined;
1390
- }
1391
- }
1392
- operateWithTimer(api, f) {
1393
- if (!this.didTransformBegin) {
1394
- this.beginInteraction(api);
1395
- }
1396
- this.resetInteractionTimer(api);
1397
- f();
1398
- }
1399
- }
1400
- class PanInteraction extends MouseInteraction {
1401
- constructor() {
1402
- super(...arguments);
1403
- this.type = 'pan';
1404
- }
1405
- beginDrag(event, canvasPosition, api, element) {
1406
- if (this.currentPosition == null) {
1407
- this.currentPosition = point.create(event.screenX, event.screenY);
1408
- this.canvasRect = element.getBoundingClientRect();
1409
- api.beginInteraction();
1410
- }
1411
- }
1412
- drag(event, api) {
1413
- if (this.currentPosition != null && this.canvasRect != null) {
1414
- const position = getMouseClientPosition(event, this.canvasRect);
1415
- api.panCameraToScreenPoint(position);
1416
- this.currentPosition = position;
1417
- }
1418
- }
1419
- endDrag(event, api) {
1420
- super.endDrag(event, api);
1421
- }
1422
- }
1423
- class TwistInteraction extends MouseInteraction {
1424
- constructor() {
1425
- super(...arguments);
1426
- this.type = 'twist';
1427
- }
1428
- beginDrag(event, canvasPosition, api, element) {
1429
- this.currentPosition = point.create(event.offsetX, event.offsetY);
1430
- this.canvasRect = element.getBoundingClientRect();
1431
- api.beginInteraction();
1432
- }
1433
- drag(event, api) {
1434
- const position = getMouseClientPosition(event, this.canvasRect);
1435
- this.currentPosition = position;
1436
- api.twistCamera(position);
1437
- }
1438
- endDrag(event, api) {
1439
- super.endDrag(event, api);
1440
- }
1441
- }
1442
- class PivotInteraction extends MouseInteraction {
1443
- constructor() {
1444
- super(...arguments);
1445
- this.type = 'pivot';
1446
- }
1447
- beginDrag(event, canvasPosition, api) {
1448
- if (this.currentPosition == null) {
1449
- this.currentPosition = point.create(event.screenX, event.screenY);
1450
- api.beginInteraction();
1451
- }
1452
- }
1453
- drag(event, api) {
1454
- if (this.currentPosition != null) {
1455
- const position = point.create(event.screenX, event.screenY);
1456
- const delta = point.subtract(position, this.currentPosition);
1457
- api.pivotCamera(-0.25 * delta.y, 0.25 * delta.x);
1458
- this.currentPosition = position;
1459
- }
1460
- }
1461
- endDrag(event, api) {
1462
- super.endDrag(event, api);
1463
- }
1464
- }
1465
-
1466
1257
  class MouseInteractionHandler extends BaseInteractionHandler {
1467
1258
  constructor(getConfig, rotateInteraction = new RotateInteraction(), rotatePointInteraction = new RotatePointInteraction(), zoomInteraction = new ZoomInteraction(), panInteraction = new PanInteraction(), twistInteraction = new TwistInteraction(), pivotInteraction = new PivotInteraction()) {
1468
1259
  super('mousedown', 'mouseup', 'mousemove', rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig);
@@ -1620,50 +1411,6 @@ class MultiPointerInteractionHandler extends MultiTouchInteractionHandler {
1620
1411
  }
1621
1412
  }
1622
1413
 
1623
- class PointerInteractionHandler extends MultiElementInteractionHandler {
1624
- constructor(getConfig, rotateInteraction = new RotateInteraction(), rotatePointInteraction = new RotatePointInteraction(), zoomInteraction = new ZoomInteraction(), panInteraction = new PanInteraction(), twistInteraction = new TwistInteraction(), pivotInteraction = new PivotInteraction()) {
1625
- super('pointerdown', 'pointerup', 'pointermove', rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig);
1626
- this.touchPoints = new Set();
1627
- this.handlePointerDown = this.handlePointerDown.bind(this);
1628
- this.handlePointerUp = this.handlePointerUp.bind(this);
1629
- }
1630
- initialize(element, api) {
1631
- super.initialize(element, api);
1632
- element.addEventListener('pointerdown', this.handlePointerDown);
1633
- }
1634
- addEventListenersToElement(element) {
1635
- element.addEventListener(this.downEvent, this.handleDownEvent);
1636
- element.addEventListener('wheel', this.handleMouseWheel, {
1637
- passive: false,
1638
- });
1639
- return {
1640
- dispose: () => {
1641
- element.removeEventListener(this.downEvent, this.handleDownEvent);
1642
- element.removeEventListener('wheel', this.handleMouseWheel);
1643
- },
1644
- };
1645
- }
1646
- handlePointerDown(event) {
1647
- this.downPosition = point.create(event.screenX, event.screenY);
1648
- this.touchPoints.add(event.pointerId);
1649
- if (this.touchPoints.size === 1) {
1650
- window.addEventListener('pointerup', this.handlePointerUp);
1651
- }
1652
- if (this.touchPoints.size === 2) {
1653
- this.disableIndividualInteractions = true;
1654
- }
1655
- }
1656
- handlePointerUp(event) {
1657
- this.touchPoints.delete(event.pointerId);
1658
- if (this.touchPoints.size < 2) {
1659
- this.disableIndividualInteractions = false;
1660
- }
1661
- if (this.touchPoints.size === 0) {
1662
- window.removeEventListener('pointerup', this.handlePointerUp);
1663
- }
1664
- }
1665
- }
1666
-
1667
1414
  class TapInteractionHandler {
1668
1415
  constructor(downEvent, upEvent, moveEvent, getConfig) {
1669
1416
  this.downEvent = downEvent;