@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
|
@@ -20,8 +20,8 @@ const cursors = require('./cursors-c6212c17.js');
|
|
|
20
20
|
const dom = require('./dom-4344863c.js');
|
|
21
21
|
const entities = require('./entities-551add54.js');
|
|
22
22
|
const viewport = require('./viewport-75a235f6.js');
|
|
23
|
+
const queries = require('./queries-918bb133.js');
|
|
23
24
|
const multiElementInteractionHandler = require('./multiElementInteractionHandler-93bd9593.js');
|
|
24
|
-
const queries = require('./queries-d9cd5ec1.js');
|
|
25
25
|
const stencil = require('./stencil-19c0fc00.js');
|
|
26
26
|
require('./wrappers_pb-1f2f4854.js');
|
|
27
27
|
require('./_commonjsHelpers-756e53d6.js');
|
|
@@ -1258,217 +1258,8 @@ class FlyToPositionKeyInteraction {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
}
|
|
1260
1260
|
|
|
1261
|
-
class MouseInteraction {
|
|
1262
|
-
setPosition(position) {
|
|
1263
|
-
this.currentPosition = position;
|
|
1264
|
-
}
|
|
1265
|
-
getPosition() {
|
|
1266
|
-
return this.currentPosition;
|
|
1267
|
-
}
|
|
1268
|
-
getType() {
|
|
1269
|
-
return this.type;
|
|
1270
|
-
}
|
|
1271
|
-
beginDrag(event, canvasPosition, api, element) {
|
|
1272
|
-
// noop
|
|
1273
|
-
}
|
|
1274
|
-
drag(event, api) {
|
|
1275
|
-
// noop
|
|
1276
|
-
}
|
|
1277
|
-
endDrag(event, api) {
|
|
1278
|
-
if (this.currentPosition != null) {
|
|
1279
|
-
api.endInteraction();
|
|
1280
|
-
this.currentPosition = undefined;
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
zoom(delta, api) {
|
|
1284
|
-
// noop
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
class RotateInteraction extends MouseInteraction {
|
|
1288
|
-
constructor() {
|
|
1289
|
-
super(...arguments);
|
|
1290
|
-
this.type = 'rotate';
|
|
1291
|
-
}
|
|
1292
|
-
beginDrag(event, canvasPosition, api) {
|
|
1293
|
-
if (this.currentPosition == null) {
|
|
1294
|
-
this.currentPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
1295
|
-
api.beginInteraction();
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
drag(event, api) {
|
|
1299
|
-
if (this.currentPosition != null) {
|
|
1300
|
-
const position = bundle_esm.point.create(event.screenX, event.screenY);
|
|
1301
|
-
const delta = bundle_esm.point.subtract(position, this.currentPosition);
|
|
1302
|
-
api.rotateCamera(delta);
|
|
1303
|
-
this.currentPosition = position;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
endDrag(event, api) {
|
|
1307
|
-
super.endDrag(event, api);
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
class RotatePointInteraction extends MouseInteraction {
|
|
1311
|
-
constructor() {
|
|
1312
|
-
super(...arguments);
|
|
1313
|
-
this.type = 'rotate-point';
|
|
1314
|
-
}
|
|
1315
|
-
beginDrag(event, canvasPosition, api) {
|
|
1316
|
-
if (this.currentPosition == null) {
|
|
1317
|
-
this.currentPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
1318
|
-
this.startingPosition = canvasPosition;
|
|
1319
|
-
api.beginInteraction();
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
drag(event, api) {
|
|
1323
|
-
if (this.currentPosition != null && this.startingPosition != null) {
|
|
1324
|
-
const position = bundle_esm.point.create(event.screenX, event.screenY);
|
|
1325
|
-
const delta = bundle_esm.point.subtract(position, this.currentPosition);
|
|
1326
|
-
api.rotateCameraAtPoint(delta, this.startingPosition);
|
|
1327
|
-
this.currentPosition = position;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
endDrag(event, api) {
|
|
1331
|
-
super.endDrag(event, api);
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
class ZoomInteraction extends MouseInteraction {
|
|
1335
|
-
constructor(interactionTimeout = 1000) {
|
|
1336
|
-
super();
|
|
1337
|
-
this.interactionTimeout = interactionTimeout;
|
|
1338
|
-
this.type = 'zoom';
|
|
1339
|
-
this.didTransformBegin = false;
|
|
1340
|
-
}
|
|
1341
|
-
beginDrag(event, canvasPosition, api, element) {
|
|
1342
|
-
if (this.currentPosition == null) {
|
|
1343
|
-
this.currentPosition = bundle_esm.point.create(event.clientX, event.clientY);
|
|
1344
|
-
const rect = element.getBoundingClientRect();
|
|
1345
|
-
const point = dom.getMouseClientPosition(event, rect);
|
|
1346
|
-
this.startPt = point;
|
|
1347
|
-
api.beginInteraction();
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
drag(event, api) {
|
|
1351
|
-
if (this.currentPosition != null) {
|
|
1352
|
-
const position = bundle_esm.point.create(event.clientX, event.clientY);
|
|
1353
|
-
const delta = bundle_esm.point.subtract(position, this.currentPosition);
|
|
1354
|
-
if (this.startPt != null) {
|
|
1355
|
-
api.zoomCameraToPoint(this.startPt, delta.y);
|
|
1356
|
-
this.currentPosition = position;
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
endDrag(event, api) {
|
|
1361
|
-
super.endDrag(event, api);
|
|
1362
|
-
this.stopInteractionTimer();
|
|
1363
|
-
this.didTransformBegin = false;
|
|
1364
|
-
this.startPt = undefined;
|
|
1365
|
-
}
|
|
1366
|
-
zoom(delta, api) {
|
|
1367
|
-
this.operateWithTimer(api, () => api.zoomCamera(delta));
|
|
1368
|
-
}
|
|
1369
|
-
zoomToPoint(pt, delta, api) {
|
|
1370
|
-
this.operateWithTimer(api, () => api.zoomCameraToPoint(pt, delta));
|
|
1371
|
-
}
|
|
1372
|
-
beginInteraction(api) {
|
|
1373
|
-
this.didTransformBegin = true;
|
|
1374
|
-
api.beginInteraction();
|
|
1375
|
-
}
|
|
1376
|
-
endInteraction(api) {
|
|
1377
|
-
this.didTransformBegin = false;
|
|
1378
|
-
api.endInteraction();
|
|
1379
|
-
}
|
|
1380
|
-
resetInteractionTimer(api) {
|
|
1381
|
-
this.stopInteractionTimer();
|
|
1382
|
-
this.startInteractionTimer(api);
|
|
1383
|
-
}
|
|
1384
|
-
startInteractionTimer(api) {
|
|
1385
|
-
this.interactionTimer = window.setTimeout(() => {
|
|
1386
|
-
this.interactionTimer = undefined;
|
|
1387
|
-
this.endInteraction(api);
|
|
1388
|
-
}, this.interactionTimeout);
|
|
1389
|
-
}
|
|
1390
|
-
stopInteractionTimer() {
|
|
1391
|
-
if (this.interactionTimer != null) {
|
|
1392
|
-
window.clearTimeout(this.interactionTimer);
|
|
1393
|
-
this.interactionTimer = undefined;
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
operateWithTimer(api, f) {
|
|
1397
|
-
if (!this.didTransformBegin) {
|
|
1398
|
-
this.beginInteraction(api);
|
|
1399
|
-
}
|
|
1400
|
-
this.resetInteractionTimer(api);
|
|
1401
|
-
f();
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
class PanInteraction extends MouseInteraction {
|
|
1405
|
-
constructor() {
|
|
1406
|
-
super(...arguments);
|
|
1407
|
-
this.type = 'pan';
|
|
1408
|
-
}
|
|
1409
|
-
beginDrag(event, canvasPosition, api, element) {
|
|
1410
|
-
if (this.currentPosition == null) {
|
|
1411
|
-
this.currentPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
1412
|
-
this.canvasRect = element.getBoundingClientRect();
|
|
1413
|
-
api.beginInteraction();
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
drag(event, api) {
|
|
1417
|
-
if (this.currentPosition != null && this.canvasRect != null) {
|
|
1418
|
-
const position = dom.getMouseClientPosition(event, this.canvasRect);
|
|
1419
|
-
api.panCameraToScreenPoint(position);
|
|
1420
|
-
this.currentPosition = position;
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
endDrag(event, api) {
|
|
1424
|
-
super.endDrag(event, api);
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
class TwistInteraction extends MouseInteraction {
|
|
1428
|
-
constructor() {
|
|
1429
|
-
super(...arguments);
|
|
1430
|
-
this.type = 'twist';
|
|
1431
|
-
}
|
|
1432
|
-
beginDrag(event, canvasPosition, api, element) {
|
|
1433
|
-
this.currentPosition = bundle_esm.point.create(event.offsetX, event.offsetY);
|
|
1434
|
-
this.canvasRect = element.getBoundingClientRect();
|
|
1435
|
-
api.beginInteraction();
|
|
1436
|
-
}
|
|
1437
|
-
drag(event, api) {
|
|
1438
|
-
const position = dom.getMouseClientPosition(event, this.canvasRect);
|
|
1439
|
-
this.currentPosition = position;
|
|
1440
|
-
api.twistCamera(position);
|
|
1441
|
-
}
|
|
1442
|
-
endDrag(event, api) {
|
|
1443
|
-
super.endDrag(event, api);
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
class PivotInteraction extends MouseInteraction {
|
|
1447
|
-
constructor() {
|
|
1448
|
-
super(...arguments);
|
|
1449
|
-
this.type = 'pivot';
|
|
1450
|
-
}
|
|
1451
|
-
beginDrag(event, canvasPosition, api) {
|
|
1452
|
-
if (this.currentPosition == null) {
|
|
1453
|
-
this.currentPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
1454
|
-
api.beginInteraction();
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
drag(event, api) {
|
|
1458
|
-
if (this.currentPosition != null) {
|
|
1459
|
-
const position = bundle_esm.point.create(event.screenX, event.screenY);
|
|
1460
|
-
const delta = bundle_esm.point.subtract(position, this.currentPosition);
|
|
1461
|
-
api.pivotCamera(-0.25 * delta.y, 0.25 * delta.x);
|
|
1462
|
-
this.currentPosition = position;
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
endDrag(event, api) {
|
|
1466
|
-
super.endDrag(event, api);
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
1261
|
class MouseInteractionHandler extends multiElementInteractionHandler.BaseInteractionHandler {
|
|
1471
|
-
constructor(getConfig, rotateInteraction = new RotateInteraction(), rotatePointInteraction = new RotatePointInteraction(), zoomInteraction = new ZoomInteraction(), panInteraction = new PanInteraction(), twistInteraction = new TwistInteraction(), pivotInteraction = new PivotInteraction()) {
|
|
1262
|
+
constructor(getConfig, rotateInteraction = new queries.RotateInteraction(), rotatePointInteraction = new queries.RotatePointInteraction(), zoomInteraction = new queries.ZoomInteraction(), panInteraction = new queries.PanInteraction(), twistInteraction = new queries.TwistInteraction(), pivotInteraction = new queries.PivotInteraction()) {
|
|
1472
1263
|
super('mousedown', 'mouseup', 'mousemove', rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig);
|
|
1473
1264
|
}
|
|
1474
1265
|
}
|
|
@@ -1624,50 +1415,6 @@ class MultiPointerInteractionHandler extends MultiTouchInteractionHandler {
|
|
|
1624
1415
|
}
|
|
1625
1416
|
}
|
|
1626
1417
|
|
|
1627
|
-
class PointerInteractionHandler extends multiElementInteractionHandler.MultiElementInteractionHandler {
|
|
1628
|
-
constructor(getConfig, rotateInteraction = new RotateInteraction(), rotatePointInteraction = new RotatePointInteraction(), zoomInteraction = new ZoomInteraction(), panInteraction = new PanInteraction(), twistInteraction = new TwistInteraction(), pivotInteraction = new PivotInteraction()) {
|
|
1629
|
-
super('pointerdown', 'pointerup', 'pointermove', rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig);
|
|
1630
|
-
this.touchPoints = new Set();
|
|
1631
|
-
this.handlePointerDown = this.handlePointerDown.bind(this);
|
|
1632
|
-
this.handlePointerUp = this.handlePointerUp.bind(this);
|
|
1633
|
-
}
|
|
1634
|
-
initialize(element, api) {
|
|
1635
|
-
super.initialize(element, api);
|
|
1636
|
-
element.addEventListener('pointerdown', this.handlePointerDown);
|
|
1637
|
-
}
|
|
1638
|
-
addEventListenersToElement(element) {
|
|
1639
|
-
element.addEventListener(this.downEvent, this.handleDownEvent);
|
|
1640
|
-
element.addEventListener('wheel', this.handleMouseWheel, {
|
|
1641
|
-
passive: false,
|
|
1642
|
-
});
|
|
1643
|
-
return {
|
|
1644
|
-
dispose: () => {
|
|
1645
|
-
element.removeEventListener(this.downEvent, this.handleDownEvent);
|
|
1646
|
-
element.removeEventListener('wheel', this.handleMouseWheel);
|
|
1647
|
-
},
|
|
1648
|
-
};
|
|
1649
|
-
}
|
|
1650
|
-
handlePointerDown(event) {
|
|
1651
|
-
this.downPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
1652
|
-
this.touchPoints.add(event.pointerId);
|
|
1653
|
-
if (this.touchPoints.size === 1) {
|
|
1654
|
-
window.addEventListener('pointerup', this.handlePointerUp);
|
|
1655
|
-
}
|
|
1656
|
-
if (this.touchPoints.size === 2) {
|
|
1657
|
-
this.disableIndividualInteractions = true;
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
handlePointerUp(event) {
|
|
1661
|
-
this.touchPoints.delete(event.pointerId);
|
|
1662
|
-
if (this.touchPoints.size < 2) {
|
|
1663
|
-
this.disableIndividualInteractions = false;
|
|
1664
|
-
}
|
|
1665
|
-
if (this.touchPoints.size === 0) {
|
|
1666
|
-
window.removeEventListener('pointerup', this.handlePointerUp);
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
1418
|
class TapInteractionHandler {
|
|
1672
1419
|
constructor(downEvent, upEvent, moveEvent, getConfig) {
|
|
1673
1420
|
this.downEvent = downEvent;
|
|
@@ -3414,7 +3161,7 @@ const Viewer = class {
|
|
|
3414
3161
|
if (this.cameraControls) {
|
|
3415
3162
|
if (window.PointerEvent != null) {
|
|
3416
3163
|
this.baseInteractionHandler =
|
|
3417
|
-
(_a = this.baseInteractionHandler) !== null && _a !== void 0 ? _a : new PointerInteractionHandler(() => this.getResolvedConfig());
|
|
3164
|
+
(_a = this.baseInteractionHandler) !== null && _a !== void 0 ? _a : new queries.PointerInteractionHandler(() => this.getResolvedConfig());
|
|
3418
3165
|
const baseDisposable = await this.registerInteractionHandler(this.baseInteractionHandler);
|
|
3419
3166
|
const multiPointerDisposable = await this.registerInteractionHandler(new MultiPointerInteractionHandler());
|
|
3420
3167
|
this.defaultInteractionHandlerDisposables = [
|