@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,10 +13,10 @@ 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, E as EntityType, 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, G as toPerspective } from './streamAttributes.js';
14
14
  import { p as parseConfig } from './config.js';
15
15
  import { C as CursorManager } from './cursors.js';
16
- import { g as getMouseClientPosition, c as cssCursor } from './dom.js';
16
+ import { c as cssCursor } from './dom.js';
17
17
  import { V as Viewport } from './viewport.js';
18
- import { B as BaseInteractionHandler, M as MultiElementInteractionHandler } from './multiElementInteractionHandler.js';
19
- import { h as fromUrn, g as SynchronizedClock, S as Scene } from './queries.js';
18
+ 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.js';
19
+ import { B as BaseInteractionHandler } from './multiElementInteractionHandler.js';
20
20
  import { w as writeDOM } from './stencil.js';
21
21
 
22
22
  /**
@@ -1250,215 +1250,6 @@ class FlyToPositionKeyInteraction {
1250
1250
  }
1251
1251
  }
1252
1252
 
1253
- class MouseInteraction {
1254
- setPosition(position) {
1255
- this.currentPosition = position;
1256
- }
1257
- getPosition() {
1258
- return this.currentPosition;
1259
- }
1260
- getType() {
1261
- return this.type;
1262
- }
1263
- beginDrag(event, canvasPosition, api, element) {
1264
- // noop
1265
- }
1266
- drag(event, api) {
1267
- // noop
1268
- }
1269
- endDrag(event, api) {
1270
- if (this.currentPosition != null) {
1271
- api.endInteraction();
1272
- this.currentPosition = undefined;
1273
- }
1274
- }
1275
- zoom(delta, api) {
1276
- // noop
1277
- }
1278
- }
1279
- class RotateInteraction extends MouseInteraction {
1280
- constructor() {
1281
- super(...arguments);
1282
- this.type = 'rotate';
1283
- }
1284
- beginDrag(event, canvasPosition, api) {
1285
- if (this.currentPosition == null) {
1286
- this.currentPosition = point.create(event.screenX, event.screenY);
1287
- api.beginInteraction();
1288
- }
1289
- }
1290
- drag(event, api) {
1291
- if (this.currentPosition != null) {
1292
- const position = point.create(event.screenX, event.screenY);
1293
- const delta = point.subtract(position, this.currentPosition);
1294
- api.rotateCamera(delta);
1295
- this.currentPosition = position;
1296
- }
1297
- }
1298
- endDrag(event, api) {
1299
- super.endDrag(event, api);
1300
- }
1301
- }
1302
- class RotatePointInteraction extends MouseInteraction {
1303
- constructor() {
1304
- super(...arguments);
1305
- this.type = 'rotate-point';
1306
- }
1307
- beginDrag(event, canvasPosition, api) {
1308
- if (this.currentPosition == null) {
1309
- this.currentPosition = point.create(event.screenX, event.screenY);
1310
- this.startingPosition = canvasPosition;
1311
- api.beginInteraction();
1312
- }
1313
- }
1314
- drag(event, api) {
1315
- if (this.currentPosition != null && this.startingPosition != null) {
1316
- const position = point.create(event.screenX, event.screenY);
1317
- const delta = point.subtract(position, this.currentPosition);
1318
- api.rotateCameraAtPoint(delta, this.startingPosition);
1319
- this.currentPosition = position;
1320
- }
1321
- }
1322
- endDrag(event, api) {
1323
- super.endDrag(event, api);
1324
- }
1325
- }
1326
- class ZoomInteraction extends MouseInteraction {
1327
- constructor(interactionTimeout = 1000) {
1328
- super();
1329
- this.interactionTimeout = interactionTimeout;
1330
- this.type = 'zoom';
1331
- this.didTransformBegin = false;
1332
- }
1333
- beginDrag(event, canvasPosition, api, element) {
1334
- if (this.currentPosition == null) {
1335
- this.currentPosition = point.create(event.clientX, event.clientY);
1336
- const rect = element.getBoundingClientRect();
1337
- const point$1 = getMouseClientPosition(event, rect);
1338
- this.startPt = point$1;
1339
- api.beginInteraction();
1340
- }
1341
- }
1342
- drag(event, api) {
1343
- if (this.currentPosition != null) {
1344
- const position = point.create(event.clientX, event.clientY);
1345
- const delta = point.subtract(position, this.currentPosition);
1346
- if (this.startPt != null) {
1347
- api.zoomCameraToPoint(this.startPt, delta.y);
1348
- this.currentPosition = position;
1349
- }
1350
- }
1351
- }
1352
- endDrag(event, api) {
1353
- super.endDrag(event, api);
1354
- this.stopInteractionTimer();
1355
- this.didTransformBegin = false;
1356
- this.startPt = undefined;
1357
- }
1358
- zoom(delta, api) {
1359
- this.operateWithTimer(api, () => api.zoomCamera(delta));
1360
- }
1361
- zoomToPoint(pt, delta, api) {
1362
- this.operateWithTimer(api, () => api.zoomCameraToPoint(pt, delta));
1363
- }
1364
- beginInteraction(api) {
1365
- this.didTransformBegin = true;
1366
- api.beginInteraction();
1367
- }
1368
- endInteraction(api) {
1369
- this.didTransformBegin = false;
1370
- api.endInteraction();
1371
- }
1372
- resetInteractionTimer(api) {
1373
- this.stopInteractionTimer();
1374
- this.startInteractionTimer(api);
1375
- }
1376
- startInteractionTimer(api) {
1377
- this.interactionTimer = window.setTimeout(() => {
1378
- this.interactionTimer = undefined;
1379
- this.endInteraction(api);
1380
- }, this.interactionTimeout);
1381
- }
1382
- stopInteractionTimer() {
1383
- if (this.interactionTimer != null) {
1384
- window.clearTimeout(this.interactionTimer);
1385
- this.interactionTimer = undefined;
1386
- }
1387
- }
1388
- operateWithTimer(api, f) {
1389
- if (!this.didTransformBegin) {
1390
- this.beginInteraction(api);
1391
- }
1392
- this.resetInteractionTimer(api);
1393
- f();
1394
- }
1395
- }
1396
- class PanInteraction extends MouseInteraction {
1397
- constructor() {
1398
- super(...arguments);
1399
- this.type = 'pan';
1400
- }
1401
- beginDrag(event, canvasPosition, api, element) {
1402
- if (this.currentPosition == null) {
1403
- this.currentPosition = point.create(event.screenX, event.screenY);
1404
- this.canvasRect = element.getBoundingClientRect();
1405
- api.beginInteraction();
1406
- }
1407
- }
1408
- drag(event, api) {
1409
- if (this.currentPosition != null && this.canvasRect != null) {
1410
- const position = getMouseClientPosition(event, this.canvasRect);
1411
- api.panCameraToScreenPoint(position);
1412
- this.currentPosition = position;
1413
- }
1414
- }
1415
- endDrag(event, api) {
1416
- super.endDrag(event, api);
1417
- }
1418
- }
1419
- class TwistInteraction extends MouseInteraction {
1420
- constructor() {
1421
- super(...arguments);
1422
- this.type = 'twist';
1423
- }
1424
- beginDrag(event, canvasPosition, api, element) {
1425
- this.currentPosition = point.create(event.offsetX, event.offsetY);
1426
- this.canvasRect = element.getBoundingClientRect();
1427
- api.beginInteraction();
1428
- }
1429
- drag(event, api) {
1430
- const position = getMouseClientPosition(event, this.canvasRect);
1431
- this.currentPosition = position;
1432
- api.twistCamera(position);
1433
- }
1434
- endDrag(event, api) {
1435
- super.endDrag(event, api);
1436
- }
1437
- }
1438
- class PivotInteraction extends MouseInteraction {
1439
- constructor() {
1440
- super(...arguments);
1441
- this.type = 'pivot';
1442
- }
1443
- beginDrag(event, canvasPosition, api) {
1444
- if (this.currentPosition == null) {
1445
- this.currentPosition = point.create(event.screenX, event.screenY);
1446
- api.beginInteraction();
1447
- }
1448
- }
1449
- drag(event, api) {
1450
- if (this.currentPosition != null) {
1451
- const position = point.create(event.screenX, event.screenY);
1452
- const delta = point.subtract(position, this.currentPosition);
1453
- api.pivotCamera(-0.25 * delta.y, 0.25 * delta.x);
1454
- this.currentPosition = position;
1455
- }
1456
- }
1457
- endDrag(event, api) {
1458
- super.endDrag(event, api);
1459
- }
1460
- }
1461
-
1462
1253
  class MouseInteractionHandler extends BaseInteractionHandler {
1463
1254
  constructor(getConfig, rotateInteraction = new RotateInteraction(), rotatePointInteraction = new RotatePointInteraction(), zoomInteraction = new ZoomInteraction(), panInteraction = new PanInteraction(), twistInteraction = new TwistInteraction(), pivotInteraction = new PivotInteraction()) {
1464
1255
  super('mousedown', 'mouseup', 'mousemove', rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig);
@@ -1616,50 +1407,6 @@ class MultiPointerInteractionHandler extends MultiTouchInteractionHandler {
1616
1407
  }
1617
1408
  }
1618
1409
 
1619
- class PointerInteractionHandler extends MultiElementInteractionHandler {
1620
- constructor(getConfig, rotateInteraction = new RotateInteraction(), rotatePointInteraction = new RotatePointInteraction(), zoomInteraction = new ZoomInteraction(), panInteraction = new PanInteraction(), twistInteraction = new TwistInteraction(), pivotInteraction = new PivotInteraction()) {
1621
- super('pointerdown', 'pointerup', 'pointermove', rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig);
1622
- this.touchPoints = new Set();
1623
- this.handlePointerDown = this.handlePointerDown.bind(this);
1624
- this.handlePointerUp = this.handlePointerUp.bind(this);
1625
- }
1626
- initialize(element, api) {
1627
- super.initialize(element, api);
1628
- element.addEventListener('pointerdown', this.handlePointerDown);
1629
- }
1630
- addEventListenersToElement(element) {
1631
- element.addEventListener(this.downEvent, this.handleDownEvent);
1632
- element.addEventListener('wheel', this.handleMouseWheel, {
1633
- passive: false,
1634
- });
1635
- return {
1636
- dispose: () => {
1637
- element.removeEventListener(this.downEvent, this.handleDownEvent);
1638
- element.removeEventListener('wheel', this.handleMouseWheel);
1639
- },
1640
- };
1641
- }
1642
- handlePointerDown(event) {
1643
- this.downPosition = point.create(event.screenX, event.screenY);
1644
- this.touchPoints.add(event.pointerId);
1645
- if (this.touchPoints.size === 1) {
1646
- window.addEventListener('pointerup', this.handlePointerUp);
1647
- }
1648
- if (this.touchPoints.size === 2) {
1649
- this.disableIndividualInteractions = true;
1650
- }
1651
- }
1652
- handlePointerUp(event) {
1653
- this.touchPoints.delete(event.pointerId);
1654
- if (this.touchPoints.size < 2) {
1655
- this.disableIndividualInteractions = false;
1656
- }
1657
- if (this.touchPoints.size === 0) {
1658
- window.removeEventListener('pointerup', this.handlePointerUp);
1659
- }
1660
- }
1661
- }
1662
-
1663
1410
  class TapInteractionHandler {
1664
1411
  constructor(downEvent, upEvent, moveEvent, getConfig) {
1665
1412
  this.downEvent = downEvent;