@vertexvis/viewer-toolkit-react 0.0.2-canary.3 → 0.0.2-canary.4
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/bundle.cjs.js +102 -131
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +97 -127
- package/dist/bundle.esm.js.map +1 -1
- package/dist/components/common/resizable-content.d.ts +3 -2
- package/dist/components/context-menu/menu-items/__tests__/ghost-selected-menu-item.spec.d.ts +1 -0
- package/dist/components/context-menu/menu-items/__tests__/unghost-selected-menu-item.spec.d.ts +1 -0
- package/dist/components/context-menu/menu-items/ghost-selected-menu-item.d.ts +1 -0
- package/dist/components/context-menu/menu-items/unghost-selected-menu-item.d.ts +1 -0
- package/dist/components/scene-tree/vertex-scene-tree-header.d.ts +5 -0
- package/dist/components/viewer/vertex-viewer.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/state/context-menu/actions.d.ts +2 -2
- package/dist/state/keybinding/default-keybindings.d.ts +1 -0
- package/dist/state/keybinding/index.d.ts +1 -0
- package/dist/state/viewer/scene/item-operations.d.ts +3 -4
- package/package.json +16 -11
package/dist/bundle.cjs.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var tslib = require('tslib');
|
|
3
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
5
|
var uiReact = require('@vertexvis/ui-react');
|
|
5
6
|
var classNames = require('classnames');
|
|
@@ -9,6 +10,7 @@ var geometry = require('@vertexvis/geometry');
|
|
|
9
10
|
var utils = require('@vertexvis/utils');
|
|
10
11
|
var React = require('react');
|
|
11
12
|
var viewerReact = require('@vertexvis/viewer-react');
|
|
13
|
+
var loader$1 = require('@vertexvis/ui/loader');
|
|
12
14
|
var loader = require('@vertexvis/viewer/loader');
|
|
13
15
|
|
|
14
16
|
function _interopNamespaceDefault(e) {
|
|
@@ -31,11 +33,12 @@ function _interopNamespaceDefault(e) {
|
|
|
31
33
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
32
34
|
|
|
33
35
|
const DEFAULT_VERTICAL_SCALE = 1;
|
|
34
|
-
const VertexResizableContent = (
|
|
35
|
-
|
|
36
|
-
const
|
|
36
|
+
const VertexResizableContent = (_a) => {
|
|
37
|
+
var { className, style, displayShadow, heading, id, initialScale, placement = 'left', children, onResize } = _a, uiProps = tslib.__rest(_a, ["className", "style", "displayShadow", "heading", "id", "initialScale", "placement", "children", "onResize"]);
|
|
38
|
+
const isHorizontallyPositioned = placement === 'left' || placement === 'right';
|
|
39
|
+
const isVerticallyPositioned = placement === 'top';
|
|
37
40
|
function getHorizontalResizeDirection() {
|
|
38
|
-
switch (
|
|
41
|
+
switch (placement) {
|
|
39
42
|
case 'left':
|
|
40
43
|
return 'right';
|
|
41
44
|
case 'right':
|
|
@@ -45,23 +48,22 @@ const VertexResizableContent = ({ displayShadow, heading, id, initialScale, posi
|
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
function getVerticalResizeDirection() {
|
|
48
|
-
return
|
|
51
|
+
return placement === 'top' ? 'top' : 'none';
|
|
49
52
|
}
|
|
50
53
|
const initialVerticalScale = initialScale != null ? initialScale : DEFAULT_VERTICAL_SCALE;
|
|
51
|
-
return (jsxRuntime.jsx(uiReact.VertexResizable, { id: id, "data-testid": `resizable-content-position-${
|
|
52
|
-
['border-r min-w-75 max-w-half']:
|
|
53
|
-
['sidebar-shadow-right']:
|
|
54
|
-
['border-l right-0 relative']:
|
|
55
|
-
['sidebar-shadow-left']:
|
|
56
|
-
['border-t bottom-0 fixed']:
|
|
54
|
+
return (jsxRuntime.jsx(uiReact.VertexResizable, Object.assign({ id: id, "data-testid": `resizable-content-position-${placement}`, className: classNames(className, 'pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300', {
|
|
55
|
+
['border-r min-w-75 max-w-half']: placement === 'left',
|
|
56
|
+
['sidebar-shadow-right']: placement === 'left' && displayShadow,
|
|
57
|
+
['border-l right-0 relative']: placement === 'right',
|
|
58
|
+
['sidebar-shadow-left']: placement === 'right' && displayShadow,
|
|
59
|
+
['border-t bottom-0 fixed']: placement === 'top',
|
|
57
60
|
['min-h-12 sheet']: isVerticallyPositioned,
|
|
58
|
-
}), style: {
|
|
61
|
+
}), style: Object.assign({
|
|
59
62
|
// This corrects an issue on mobile where `100vh` reflects the space
|
|
60
63
|
// under the address bar and bottom toolbar in CSS.
|
|
61
|
-
maxHeight:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}), children: children })] }) }));
|
|
64
|
+
maxHeight: placement === 'top' ? window.innerHeight : undefined }, style), initialHorizontalScale: isHorizontallyPositioned ? initialScale : undefined, initialVerticalScale: isVerticallyPositioned ? initialVerticalScale : undefined, horizontalDirection: getHorizontalResizeDirection(), verticalDirection: getVerticalResizeDirection(), position: placement === 'right' || placement === 'top' ? 'absolute' : 'relative', onResizeEnd: () => onResize === null || onResize === void 0 ? void 0 : onResize() }, uiProps, { children: jsxRuntime.jsxs("div", { className: "flex flex-col h-full w-full", children: [jsxRuntime.jsx("div", { className: "flex justify-center w-full", children: jsxRuntime.jsx("div", { className: "block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded" }) }), heading, jsxRuntime.jsx("div", { className: classNames('w-full flex flex-col h-0 flex-grow', {
|
|
65
|
+
['right-0']: placement === 'right',
|
|
66
|
+
}), children: children })] }) })));
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
function contextMenuItemIsRow(item) {
|
|
@@ -93,40 +95,6 @@ const contextMenuActivePosition = recoil.selector({
|
|
|
93
95
|
get: ({ get }) => get(contextMenuActive) != null ? get(contextMenuPosition) : undefined,
|
|
94
96
|
});
|
|
95
97
|
|
|
96
|
-
/******************************************************************************
|
|
97
|
-
Copyright (c) Microsoft Corporation.
|
|
98
|
-
|
|
99
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
100
|
-
purpose with or without fee is hereby granted.
|
|
101
|
-
|
|
102
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
103
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
104
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
105
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
106
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
107
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
108
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
109
|
-
***************************************************************************** */
|
|
110
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
function __rest(s, e) {
|
|
114
|
-
var t = {};
|
|
115
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
116
|
-
t[p] = s[p];
|
|
117
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
118
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
119
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
120
|
-
t[p[i]] = s[p[i]];
|
|
121
|
-
}
|
|
122
|
-
return t;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
126
|
-
var e = new Error(message);
|
|
127
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
98
|
// Create a new logger instance
|
|
131
99
|
const pinoLogger = Pino({
|
|
132
100
|
formatters: {
|
|
@@ -234,7 +202,7 @@ function useActionCallback(fn, deps = []) {
|
|
|
234
202
|
*/
|
|
235
203
|
function retainSnapshot(fn) {
|
|
236
204
|
return (_a) => {
|
|
237
|
-
var { snapshot } = _a, cb = __rest(_a, ["snapshot"]);
|
|
205
|
+
var { snapshot } = _a, cb = tslib.__rest(_a, ["snapshot"]);
|
|
238
206
|
return async (...args) => {
|
|
239
207
|
const release = snapshot.retain();
|
|
240
208
|
try {
|
|
@@ -1005,22 +973,20 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
1005
973
|
|
|
1006
974
|
function useContextMenuActions() {
|
|
1007
975
|
return {
|
|
1008
|
-
pointerDown: useActionCallback(({ set }) => async (event
|
|
1009
|
-
var _a, _b;
|
|
976
|
+
pointerDown: useActionCallback(({ set }) => async (event) => {
|
|
1010
977
|
if (event.button === 2) {
|
|
1011
|
-
const xCoordinate =
|
|
1012
|
-
const yCoordinate =
|
|
978
|
+
const xCoordinate = event.clientX;
|
|
979
|
+
const yCoordinate = event === null || event === void 0 ? void 0 : event.clientY;
|
|
1013
980
|
set(contextMenuPosition, geometry.Point.create(xCoordinate, yCoordinate));
|
|
1014
981
|
set(contextMenuTarget, event.target);
|
|
1015
982
|
}
|
|
1016
983
|
}),
|
|
1017
|
-
pointerUp: useActionCallback(({ snapshot, set }) => async (event, type, predicate, onOpen
|
|
1018
|
-
var _a, _b;
|
|
984
|
+
pointerUp: useActionCallback(({ snapshot, set }) => async (event, type, predicate, onOpen) => {
|
|
1019
985
|
const downPosition = await snapshot.getPromise(contextMenuPosition);
|
|
1020
986
|
const active = await snapshot.getPromise(contextMenuActive);
|
|
1021
987
|
if (downPosition != null && active == null) {
|
|
1022
|
-
const xCoordinate =
|
|
1023
|
-
const yCoordinate =
|
|
988
|
+
const xCoordinate = event.clientX;
|
|
989
|
+
const yCoordinate = event === null || event === void 0 ? void 0 : event.clientY;
|
|
1024
990
|
const point = geometry.Point.create(xCoordinate, yCoordinate);
|
|
1025
991
|
const pointDistance = downPosition != null ? geometry.Point.distance(downPosition, point) : 0;
|
|
1026
992
|
const predicateResult = predicate == null || predicate(event);
|
|
@@ -1322,6 +1288,18 @@ const useKeyBindings = ({ keydownRepeatInterval = 25, keydownIgnorePredicate = i
|
|
|
1322
1288
|
}, [state.applyBindings, state.lastPressed]);
|
|
1323
1289
|
};
|
|
1324
1290
|
|
|
1291
|
+
function useDefaultKeybindings() {
|
|
1292
|
+
useApplyKeyBinding({
|
|
1293
|
+
fn: useActionCallback(({ snapshot }) => async () => {
|
|
1294
|
+
const sceneProvider = await snapshot.getPromiseRequired(viewerSceneProvider);
|
|
1295
|
+
const animation = { milliseconds: 500 };
|
|
1296
|
+
const scene = await sceneProvider();
|
|
1297
|
+
await (scene === null || scene === void 0 ? void 0 : scene.camera().viewAll().render({ animation }));
|
|
1298
|
+
}),
|
|
1299
|
+
keyBind: 'f',
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1325
1303
|
function useLongPress({ target, callback, delay = 500, onMovement, }) {
|
|
1326
1304
|
const [longPressTimeout, setLongPressTimeout] = React__namespace.useState();
|
|
1327
1305
|
const [touchStartPosition, setTouchStartPosition] = React__namespace.useState();
|
|
@@ -1368,6 +1346,7 @@ const VertexContextMenu = ({ targetElement, menuType, disableBackdrop, openPredi
|
|
|
1368
1346
|
const activeContextMenu = recoil.useRecoilValue(contextMenuActive);
|
|
1369
1347
|
const activePosition = recoil.useRecoilValue(contextMenuActivePosition);
|
|
1370
1348
|
const fallbackPlacements = React.useMemo(() => ['bottom-end', 'top-start', 'top-end', 'right', 'left'], []);
|
|
1349
|
+
const isOpen = activeContextMenu === menuType;
|
|
1371
1350
|
useStackKeyBinding({
|
|
1372
1351
|
id: 'ContextMenu',
|
|
1373
1352
|
keyBind: 'Escape',
|
|
@@ -1409,26 +1388,10 @@ const VertexContextMenu = ({ targetElement, menuType, disableBackdrop, openPredi
|
|
|
1409
1388
|
}, [disableBackdrop, menuType, activeContextMenu]);
|
|
1410
1389
|
React.useEffect(() => {
|
|
1411
1390
|
const handlePointerDown = (event) => {
|
|
1412
|
-
|
|
1413
|
-
const pointerEvent = event;
|
|
1414
|
-
const targetElement = target;
|
|
1415
|
-
const boundingBox = targetElement != null
|
|
1416
|
-
? targetElement.getBoundingClientRect()
|
|
1417
|
-
: undefined;
|
|
1418
|
-
const xCoordinate = pointerEvent.clientX - ((_a = boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.x) !== null && _a !== void 0 ? _a : 0);
|
|
1419
|
-
const yCoordinate = pointerEvent.clientY - ((_b = boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.y) !== null && _b !== void 0 ? _b : 0);
|
|
1420
|
-
contextMenuActions.pointerDown(pointerEvent, geometry.Point.create(xCoordinate, yCoordinate));
|
|
1391
|
+
contextMenuActions.pointerDown(event);
|
|
1421
1392
|
};
|
|
1422
1393
|
const handlePointerUp = (event) => {
|
|
1423
|
-
|
|
1424
|
-
const pointerEvent = event;
|
|
1425
|
-
const targetElement = target;
|
|
1426
|
-
const boundingBox = targetElement != null
|
|
1427
|
-
? targetElement.getBoundingClientRect()
|
|
1428
|
-
: undefined;
|
|
1429
|
-
const xCoordinate = pointerEvent.clientX - ((_a = boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.x) !== null && _a !== void 0 ? _a : 0);
|
|
1430
|
-
const yCoordinate = pointerEvent.clientY - ((_b = boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.y) !== null && _b !== void 0 ? _b : 0);
|
|
1431
|
-
contextMenuActions.pointerUp(event, menuType, openPredicate, onOpen, geometry.Point.create(xCoordinate, yCoordinate));
|
|
1394
|
+
contextMenuActions.pointerUp(event, menuType, openPredicate, onOpen);
|
|
1432
1395
|
};
|
|
1433
1396
|
const handleContextMenu = (event) => contextMenuActions.contextMenu(event, openPredicate);
|
|
1434
1397
|
target === null || target === void 0 ? void 0 : target.addEventListener('pointerdown', handlePointerDown);
|
|
@@ -1440,7 +1403,9 @@ const VertexContextMenu = ({ targetElement, menuType, disableBackdrop, openPredi
|
|
|
1440
1403
|
target === null || target === void 0 ? void 0 : target.removeEventListener('contextmenu', handleContextMenu);
|
|
1441
1404
|
};
|
|
1442
1405
|
}, [targetElement, menuType, openPredicate]);
|
|
1443
|
-
return (jsxRuntime.jsx(uiReact.VertexMenu, {
|
|
1406
|
+
return (jsxRuntime.jsx(uiReact.VertexMenu, { className: classNames({
|
|
1407
|
+
hidden: !isOpen,
|
|
1408
|
+
}), "data-testid": `${menuType}-context-menu`, open: isOpen, position: activePosition, fallbackPlacements: fallbackPlacements, backdrop: !disableBackdrop, onMenuClosed: () => {
|
|
1444
1409
|
contextMenuActions.clearActiveContextMenu();
|
|
1445
1410
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
1446
1411
|
}, children: jsxRuntime.jsx("div", { className: "pt-1", children: children }) }));
|
|
@@ -1723,66 +1688,63 @@ const VertexFlyToMenuItem = () => {
|
|
|
1723
1688
|
}, disabled: currentItem == null, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "paper-airplane", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Fly To" })] }));
|
|
1724
1689
|
};
|
|
1725
1690
|
|
|
1726
|
-
function useSceneItemsOperations(
|
|
1691
|
+
function useSceneItemsOperations() {
|
|
1692
|
+
const viewer = recoil.useRecoilValue(viewerElement);
|
|
1727
1693
|
const sceneItemsOperation = React.useCallback(async (f, ids) => {
|
|
1728
|
-
const scene = await (
|
|
1694
|
+
const scene = await (viewer === null || viewer === void 0 ? void 0 : viewer.scene());
|
|
1729
1695
|
if (ids == null) {
|
|
1730
1696
|
await (scene === null || scene === void 0 ? void 0 : scene.items((op) => f(op.where((q) => q.all()))).execute());
|
|
1731
1697
|
}
|
|
1732
1698
|
else if (ids.length > 0) {
|
|
1733
1699
|
await (scene === null || scene === void 0 ? void 0 : scene.items((op) => f(op.where((q) => q.withItemIds(ids)))).execute());
|
|
1734
1700
|
}
|
|
1735
|
-
}, [
|
|
1736
|
-
useApplyKeyBinding({
|
|
1737
|
-
fn: React.useCallback(async () => {
|
|
1738
|
-
const animation = { milliseconds: 500 };
|
|
1739
|
-
const scene = await (viewerElement === null || viewerElement === void 0 ? void 0 : viewerElement.scene());
|
|
1740
|
-
await (scene === null || scene === void 0 ? void 0 : scene.camera().viewAll().render({ animation }));
|
|
1741
|
-
}, [viewerElement]),
|
|
1742
|
-
keyBind: 'f',
|
|
1743
|
-
});
|
|
1701
|
+
}, [viewer]);
|
|
1744
1702
|
const showOnlySelected = React.useCallback(async () => {
|
|
1745
|
-
const scene = await (
|
|
1703
|
+
const scene = await (viewer === null || viewer === void 0 ? void 0 : viewer.scene());
|
|
1746
1704
|
scene === null || scene === void 0 ? void 0 : scene.items((op) => [
|
|
1747
1705
|
op.where((q) => q.all()).hide(),
|
|
1748
1706
|
op.where((q) => q.withSelected()).show(),
|
|
1749
1707
|
]).execute();
|
|
1750
|
-
}, [
|
|
1708
|
+
}, [viewer]);
|
|
1751
1709
|
const hideSelected = React.useCallback(async () => {
|
|
1752
|
-
const scene = await (
|
|
1710
|
+
const scene = await (viewer === null || viewer === void 0 ? void 0 : viewer.scene());
|
|
1753
1711
|
scene === null || scene === void 0 ? void 0 : scene.items((op) => [op.where((q) => q.withSelected()).hide()]).execute();
|
|
1754
|
-
}, [
|
|
1712
|
+
}, [viewer]);
|
|
1755
1713
|
const showOnlyItem = React.useCallback(async (id) => {
|
|
1756
|
-
const scene = await (
|
|
1714
|
+
const scene = await (viewer === null || viewer === void 0 ? void 0 : viewer.scene());
|
|
1757
1715
|
scene === null || scene === void 0 ? void 0 : scene.items((op) => [
|
|
1758
1716
|
op.where((q) => q.all()).hide(),
|
|
1759
1717
|
op.where((q) => q.withItemIds([id])).show(),
|
|
1760
1718
|
]).execute();
|
|
1761
|
-
}, [
|
|
1719
|
+
}, [viewer]);
|
|
1720
|
+
const ghostSelected = React.useCallback(async () => {
|
|
1721
|
+
const scene = await (viewer === null || viewer === void 0 ? void 0 : viewer.scene());
|
|
1722
|
+
scene === null || scene === void 0 ? void 0 : scene.items((op) => [op.where((q) => q.withSelected()).setPhantom(true)]).execute();
|
|
1723
|
+
}, [viewer]);
|
|
1724
|
+
const unGhostSelected = React.useCallback(async () => {
|
|
1725
|
+
const scene = await (viewer === null || viewer === void 0 ? void 0 : viewer.scene());
|
|
1726
|
+
scene === null || scene === void 0 ? void 0 : scene.items((op) => [op.where((q) => q.withSelected()).setPhantom(false)]).execute();
|
|
1727
|
+
}, [viewer]);
|
|
1762
1728
|
return {
|
|
1763
1729
|
sceneItemsOperation,
|
|
1764
1730
|
showOnlySelected,
|
|
1765
1731
|
hideSelected,
|
|
1766
1732
|
showOnlyItem,
|
|
1733
|
+
ghostSelected,
|
|
1734
|
+
unGhostSelected,
|
|
1767
1735
|
};
|
|
1768
1736
|
}
|
|
1769
1737
|
|
|
1770
1738
|
const VertexHideAllMenuItem = () => {
|
|
1771
|
-
const
|
|
1772
|
-
const sceneItemOperations = useSceneItemsOperations({
|
|
1773
|
-
viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null,
|
|
1774
|
-
});
|
|
1739
|
+
const sceneItemOperations = useSceneItemsOperations();
|
|
1775
1740
|
return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "hide-all-menu-option", onClick: () => {
|
|
1776
1741
|
sceneItemOperations.sceneItemsOperation((builder) => builder.hide());
|
|
1777
1742
|
}, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Hide All Parts" })] }));
|
|
1778
1743
|
};
|
|
1779
1744
|
|
|
1780
1745
|
const VertexHidePartMenuItem = () => {
|
|
1781
|
-
const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
|
|
1782
1746
|
const currentItem = recoil.useRecoilValue(contextMenuItem);
|
|
1783
|
-
const sceneItemOperations = useSceneItemsOperations(
|
|
1784
|
-
viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null,
|
|
1785
|
-
});
|
|
1747
|
+
const sceneItemOperations = useSceneItemsOperations();
|
|
1786
1748
|
return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "hide-menu-option", onClick: () => {
|
|
1787
1749
|
var _a;
|
|
1788
1750
|
const isRow = contextMenuItemIsRow(currentItem);
|
|
@@ -1794,30 +1756,21 @@ const VertexHidePartMenuItem = () => {
|
|
|
1794
1756
|
};
|
|
1795
1757
|
|
|
1796
1758
|
const VertexHideSelectedMenuItem = () => {
|
|
1797
|
-
const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
|
|
1798
1759
|
const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
|
|
1799
|
-
const sceneItemOperations = useSceneItemsOperations(
|
|
1800
|
-
viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null,
|
|
1801
|
-
});
|
|
1760
|
+
const sceneItemOperations = useSceneItemsOperations();
|
|
1802
1761
|
return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "hide-selected-menu-option", onClick: () => sceneItemOperations.hideSelected(), disabled: selectedItems.length === 0, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Hide Selected" })] }));
|
|
1803
1762
|
};
|
|
1804
1763
|
|
|
1805
1764
|
const VertexShowAllMenuItem = () => {
|
|
1806
|
-
const
|
|
1807
|
-
const sceneItemOperations = useSceneItemsOperations({
|
|
1808
|
-
viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null,
|
|
1809
|
-
});
|
|
1765
|
+
const sceneItemOperations = useSceneItemsOperations();
|
|
1810
1766
|
return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "show-all-menu-option", onClick: () => {
|
|
1811
1767
|
sceneItemOperations.sceneItemsOperation((builder) => builder.show());
|
|
1812
1768
|
}, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Show All Parts" })] }));
|
|
1813
1769
|
};
|
|
1814
1770
|
|
|
1815
1771
|
const VertexShowOnlyMenuItem = () => {
|
|
1816
|
-
const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
|
|
1817
1772
|
const currentItem = recoil.useRecoilValue(contextMenuItem);
|
|
1818
|
-
const sceneItemOperations = useSceneItemsOperations(
|
|
1819
|
-
viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null,
|
|
1820
|
-
});
|
|
1773
|
+
const sceneItemOperations = useSceneItemsOperations();
|
|
1821
1774
|
return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "show-only-menu-option", onClick: () => {
|
|
1822
1775
|
var _a;
|
|
1823
1776
|
const isRow = contextMenuItemIsRow(currentItem);
|
|
@@ -1829,11 +1782,8 @@ const VertexShowOnlyMenuItem = () => {
|
|
|
1829
1782
|
};
|
|
1830
1783
|
|
|
1831
1784
|
const VertexShowOnlySelectedMenuItem = () => {
|
|
1832
|
-
const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
|
|
1833
1785
|
const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
|
|
1834
|
-
const sceneItemOperations = useSceneItemsOperations(
|
|
1835
|
-
viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null,
|
|
1836
|
-
});
|
|
1786
|
+
const sceneItemOperations = useSceneItemsOperations();
|
|
1837
1787
|
return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "show-only-selected-menu-option", onClick: () => sceneItemOperations.showOnlySelected(), disabled: selectedItems.length === 0, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Show Only Selected" })] }));
|
|
1838
1788
|
};
|
|
1839
1789
|
|
|
@@ -1914,8 +1864,20 @@ function useSceneTreeActions() {
|
|
|
1914
1864
|
};
|
|
1915
1865
|
}
|
|
1916
1866
|
|
|
1867
|
+
const VertexGhostSelectedMenuItem = () => {
|
|
1868
|
+
const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
|
|
1869
|
+
const sceneItemOperations = useSceneItemsOperations();
|
|
1870
|
+
return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "ghost-selected-menu-option", onClick: () => sceneItemOperations.ghostSelected(), disabled: selectedItems.length === 0, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-partial", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Ghost Selected" })] }));
|
|
1871
|
+
};
|
|
1872
|
+
|
|
1873
|
+
const VertexUnghostSelectedMenuItem = () => {
|
|
1874
|
+
const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
|
|
1875
|
+
const sceneItemOperations = useSceneItemsOperations();
|
|
1876
|
+
return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "unghost-selected-menu-option", onClick: () => sceneItemOperations.unGhostSelected(), disabled: selectedItems.length === 0, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Unghost Selected" })] }));
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1917
1879
|
const DefaultSceneTreeContextMenu = () => {
|
|
1918
|
-
return (jsxRuntime.jsxs("div", { className: "w-56", children: [jsxRuntime.jsx(VertexHideSelectedMenuItem, {}), jsxRuntime.jsx(VertexHideAllMenuItem, {}), jsxRuntime.jsx(VertexShowOnlyMenuItem, {}), jsxRuntime.jsx(VertexShowOnlySelectedMenuItem, {}), jsxRuntime.jsx(VertexShowAllMenuItem, {}), jsxRuntime.jsx(
|
|
1880
|
+
return (jsxRuntime.jsxs("div", { className: "w-56", children: [jsxRuntime.jsx(VertexHideSelectedMenuItem, {}), jsxRuntime.jsx(VertexHideAllMenuItem, {}), jsxRuntime.jsx(VertexShowOnlyMenuItem, {}), jsxRuntime.jsx(VertexShowOnlySelectedMenuItem, {}), jsxRuntime.jsx(VertexShowAllMenuItem, {}), jsxRuntime.jsx(VertexGhostSelectedMenuItem, {}), jsxRuntime.jsx(VertexUnghostSelectedMenuItem, {}), jsxRuntime.jsx(uiReact.VertexMenuDivider, {}), jsxRuntime.jsx(VertexFitSelectedMenuItem, {}), jsxRuntime.jsx(VertexFlyToMenuItem, {})] }));
|
|
1919
1881
|
};
|
|
1920
1882
|
|
|
1921
1883
|
const VertexSceneTreeContextMenu = ({ children, }) => {
|
|
@@ -1929,7 +1891,7 @@ const VertexSceneTreeContextMenu = ({ children, }) => {
|
|
|
1929
1891
|
};
|
|
1930
1892
|
|
|
1931
1893
|
const DefaultViewerContextMenu = () => {
|
|
1932
|
-
return (jsxRuntime.jsxs("div", { className: "w-56", children: [jsxRuntime.jsx(VertexHidePartMenuItem, {}), jsxRuntime.jsx(VertexHideSelectedMenuItem, {}), jsxRuntime.jsx(VertexHideAllMenuItem, {}), jsxRuntime.jsx(VertexShowOnlyMenuItem, {}), jsxRuntime.jsx(VertexShowOnlySelectedMenuItem, {}), jsxRuntime.jsx(VertexShowAllMenuItem, {}), jsxRuntime.jsx(
|
|
1894
|
+
return (jsxRuntime.jsxs("div", { className: "w-56", children: [jsxRuntime.jsx(VertexHidePartMenuItem, {}), jsxRuntime.jsx(VertexHideSelectedMenuItem, {}), jsxRuntime.jsx(VertexHideAllMenuItem, {}), jsxRuntime.jsx(VertexShowOnlyMenuItem, {}), jsxRuntime.jsx(VertexShowOnlySelectedMenuItem, {}), jsxRuntime.jsx(VertexShowAllMenuItem, {}), jsxRuntime.jsx(VertexGhostSelectedMenuItem, {}), jsxRuntime.jsx(VertexUnghostSelectedMenuItem, {}), jsxRuntime.jsx(uiReact.VertexMenuDivider, {}), jsxRuntime.jsx(VertexFitSelectedMenuItem, {}), jsxRuntime.jsx(VertexFlyToMenuItem, {})] }));
|
|
1933
1895
|
};
|
|
1934
1896
|
|
|
1935
1897
|
const VertexViewerContextMenu = ({ children }) => {
|
|
@@ -2003,6 +1965,11 @@ function VertexSceneTreeToolbar() {
|
|
|
2003
1965
|
return (jsxRuntime.jsx(viewerReact.VertexSceneTreeToolbar, { className: "h-10 border-b border-neutral-300 box-border", children: jsxRuntime.jsxs("div", { className: "flex flex-shrink-0 w-full text-neutral-700 items-center gap mx-2", children: [jsxRuntime.jsx(VertexSceneTreeExpandAll, {}), jsxRuntime.jsx(VertexSceneTreeCollapseAll, {})] }) }));
|
|
2004
1966
|
}
|
|
2005
1967
|
|
|
1968
|
+
const VertexSceneTreeHeader = ({ children }) => {
|
|
1969
|
+
const hasDefinedChildren = children != null && children !== false;
|
|
1970
|
+
return (jsxRuntime.jsx("div", { slot: "header", className: "flex flex-col", children: hasDefinedChildren ? (children) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(viewerReact.VertexSceneTreeSearch, { className: "border-b border-neutral-300" }), jsxRuntime.jsx(VertexSceneTreeToolbar, {})] })) }));
|
|
1971
|
+
};
|
|
1972
|
+
|
|
2006
1973
|
const DEFAULT_NAME_COLUMN = {
|
|
2007
1974
|
binding: '{{row.node.name}}',
|
|
2008
1975
|
label: 'Name',
|
|
@@ -2082,7 +2049,7 @@ const VertexSceneTreeTableLayout = (sdkProps) => {
|
|
|
2082
2049
|
};
|
|
2083
2050
|
|
|
2084
2051
|
const VertexSceneTree = (_a) => {
|
|
2085
|
-
var { id, font, backgroundColors, children, style, onPointerDown, onClick, onToggleSelection, onToggleExpansion, onToggleVisibility, className, rowData } = _a, sdkProps = __rest(_a, ["id", "font", "backgroundColors", "children", "style", "onPointerDown", "onClick", "onToggleSelection", "onToggleExpansion", "onToggleVisibility", "className", "rowData"]);
|
|
2052
|
+
var { id, font, backgroundColors, children, style, onPointerDown, onClick, onToggleSelection, onToggleExpansion, onToggleVisibility, className, rowData } = _a, sdkProps = tslib.__rest(_a, ["id", "font", "backgroundColors", "children", "style", "onPointerDown", "onClick", "onToggleSelection", "onToggleExpansion", "onToggleVisibility", "className", "rowData"]);
|
|
2086
2053
|
const config = recoil.useRecoilValue(sdkConfig);
|
|
2087
2054
|
const selectionActions = useSelectionActions();
|
|
2088
2055
|
const sceneTreeActions = useSceneTreeActions();
|
|
@@ -2090,6 +2057,7 @@ const VertexSceneTree = (_a) => {
|
|
|
2090
2057
|
const callbackRef = useRecoilRef({
|
|
2091
2058
|
state: sceneTreeElement,
|
|
2092
2059
|
});
|
|
2060
|
+
const hasDefinedChildren = children != null && children !== false;
|
|
2093
2061
|
const wrappedExpansionHandler = (event, node, tree) => {
|
|
2094
2062
|
sceneTreeActions.toggleExpansion(event, node, tree);
|
|
2095
2063
|
onToggleExpansion === null || onToggleExpansion === void 0 ? void 0 : onToggleExpansion(event, node, tree);
|
|
@@ -2114,13 +2082,13 @@ const VertexSceneTree = (_a) => {
|
|
|
2114
2082
|
}
|
|
2115
2083
|
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(event);
|
|
2116
2084
|
};
|
|
2117
|
-
return (jsxRuntime.jsx("div", { className:
|
|
2085
|
+
return (jsxRuntime.jsx("div", { className: classNames('flex flex-col w-full h-full', className), children: jsxRuntime.jsx("div", { className: "flex group h-full", children: jsxRuntime.jsx(viewerReact.VertexSceneTree, Object.assign({ id: id !== null && id !== void 0 ? id : 'vertex-scene-tree', "data-testid": "vertex-scene-tree", config: config, ref: callbackRef, className: "flex-1", style: Object.assign(Object.assign(Object.assign({}, styleFromOptionalFont(font)), styleFromOptionalBackgroundColors(backgroundColors)), style), onConnectionError: (e) => {
|
|
2118
2086
|
logger.error('Scene Tree Connection Error: ', e.detail);
|
|
2119
2087
|
}, viewer: viewer, onPointerDown: handlePointerDown, onClick: handleClick, rowData: (row) => {
|
|
2120
2088
|
var _a;
|
|
2121
2089
|
const providedRowData = (_a = rowData === null || rowData === void 0 ? void 0 : rowData(row)) !== null && _a !== void 0 ? _a : {};
|
|
2122
2090
|
return Object.assign({ handleExpansion: wrappedExpansionHandler, handleSelection: wrappedSelectionHandler, handleVisibility: wrappedVisibilityHandler }, providedRowData);
|
|
2123
|
-
} }, sdkProps, { children: [jsxRuntime.jsx(
|
|
2091
|
+
} }, sdkProps, { children: hasDefinedChildren ? (children) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(VertexSceneTreeHeader, {}), jsxRuntime.jsx(VertexSceneTreeTableLayout, {}), jsxRuntime.jsx(VertexSceneTreeContextMenu, {})] })) })) }) }));
|
|
2124
2092
|
};
|
|
2125
2093
|
|
|
2126
2094
|
const useSynchronizedProp = (state, value) => {
|
|
@@ -2131,7 +2099,7 @@ const useSynchronizedProp = (state, value) => {
|
|
|
2131
2099
|
};
|
|
2132
2100
|
|
|
2133
2101
|
const VertexPopupButton = (_a) => {
|
|
2134
|
-
var { open, children } = _a, uiProps = __rest(_a, ["open", "children"]);
|
|
2102
|
+
var { open, children } = _a, uiProps = tslib.__rest(_a, ["open", "children"]);
|
|
2135
2103
|
const anchor = children.find((c) => c.type === Anchor);
|
|
2136
2104
|
const others = children.filter((c) => c.type !== Anchor);
|
|
2137
2105
|
if (anchor == null) {
|
|
@@ -2147,7 +2115,7 @@ const Anchor = ({ tooltipContent, children }) => {
|
|
|
2147
2115
|
VertexPopupButton.Anchor = Anchor;
|
|
2148
2116
|
|
|
2149
2117
|
const VertexSlider = (_a) => {
|
|
2150
|
-
var { value, defaultValue, onChange, onValueChange, onValueInput } = _a, uiProps = __rest(_a, ["value", "defaultValue", "onChange", "onValueChange", "onValueInput"]);
|
|
2118
|
+
var { value, defaultValue, onChange, onValueChange, onValueInput } = _a, uiProps = tslib.__rest(_a, ["value", "defaultValue", "onChange", "onValueChange", "onValueInput"]);
|
|
2151
2119
|
const [displayedValue, setDisplayedValue] = React.useState(defaultValue);
|
|
2152
2120
|
return (jsxRuntime.jsx(uiReact.VertexSlider, Object.assign({ className: "w-52 mx-2 items-center", value: value !== null && value !== void 0 ? value : displayedValue, onValueChange: (e) => {
|
|
2153
2121
|
setDisplayedValue(e.detail.value);
|
|
@@ -2488,7 +2456,7 @@ const BoxSelectionTool = () => {
|
|
|
2488
2456
|
};
|
|
2489
2457
|
|
|
2490
2458
|
const VertexViewerViewCube = (_a) => {
|
|
2491
|
-
var { placement, children } = _a, sdkProps = __rest(_a, ["placement", "children"]);
|
|
2459
|
+
var { placement, children } = _a, sdkProps = tslib.__rest(_a, ["placement", "children"]);
|
|
2492
2460
|
const childrenAsArray = Array.isArray(children)
|
|
2493
2461
|
? children
|
|
2494
2462
|
: [children];
|
|
@@ -2500,7 +2468,7 @@ const VertexViewerViewCube = (_a) => {
|
|
|
2500
2468
|
};
|
|
2501
2469
|
|
|
2502
2470
|
const VertexViewer = (_a) => {
|
|
2503
|
-
var { id, disableSelection, onTap, onLongpress, onFrameDrawn, viewerRefCallback, children } = _a, sdkProps = __rest(_a, ["id", "disableSelection", "onTap", "onLongpress", "onFrameDrawn", "viewerRefCallback", "children"]);
|
|
2471
|
+
var { id, className, disableSelection, onTap, onLongpress, onFrameDrawn, viewerRefCallback, children } = _a, sdkProps = tslib.__rest(_a, ["id", "className", "disableSelection", "onTap", "onLongpress", "onFrameDrawn", "viewerRefCallback", "children"]);
|
|
2504
2472
|
const config = recoil.useRecoilValue(sdkConfig);
|
|
2505
2473
|
const callbackRef = useRecoilRef({
|
|
2506
2474
|
state: viewerElement,
|
|
@@ -2513,7 +2481,8 @@ const VertexViewer = (_a) => {
|
|
|
2513
2481
|
const selectionActions = useSelectionActions();
|
|
2514
2482
|
const hasDefinedChildren = children != null && children !== false;
|
|
2515
2483
|
useKeyBindings();
|
|
2516
|
-
|
|
2484
|
+
useDefaultKeybindings();
|
|
2485
|
+
return (jsxRuntime.jsxs(viewerReact.VertexViewer, Object.assign({ id: id !== null && id !== void 0 ? id : 'vertex-viewer', "data-testid": "vertex-viewer", ref: viewerRefCallback !== null && viewerRefCallback !== void 0 ? viewerRefCallback : callbackRef, className: classNames('flex w-full h-full', className, {
|
|
2517
2486
|
'cursor-crosshair': currentCrossSectionAlignment.hitPending,
|
|
2518
2487
|
}), config: config, onTap: (e) => {
|
|
2519
2488
|
const actions = [
|
|
@@ -2531,7 +2500,7 @@ const VertexViewer = (_a) => {
|
|
|
2531
2500
|
if (!sceneReady) {
|
|
2532
2501
|
setSceneReady(true);
|
|
2533
2502
|
}
|
|
2534
|
-
}, children: [isBoxSelectionEnabled && jsxRuntime.jsx(BoxSelectionTool, {}), hasDefinedChildren ? (children) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(VertexViewerViewCube, {}), jsxRuntime.jsx(VertexToolbar, {})] }))] })));
|
|
2503
|
+
}, children: [isBoxSelectionEnabled && jsxRuntime.jsx(BoxSelectionTool, {}), hasDefinedChildren ? (children) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(VertexViewerViewCube, {}), jsxRuntime.jsx(VertexToolbar, {}), jsxRuntime.jsx(VertexViewerContextMenu, {})] }))] })));
|
|
2535
2504
|
};
|
|
2536
2505
|
|
|
2537
2506
|
function toSdkConfig(config) {
|
|
@@ -2561,9 +2530,10 @@ const VertexViewerToolkitEventListener = ({ onHitStateChange, onSelectionStateCh
|
|
|
2561
2530
|
};
|
|
2562
2531
|
|
|
2563
2532
|
const VertexViewerToolkitRoot = (_a) => {
|
|
2564
|
-
var { override, children, config } = _a, eventWrapperProps = __rest(_a, ["override", "children", "config"]);
|
|
2533
|
+
var { override, children, config } = _a, eventWrapperProps = tslib.__rest(_a, ["override", "children", "config"]);
|
|
2565
2534
|
React.useEffect(() => {
|
|
2566
2535
|
loader.defineCustomElements();
|
|
2536
|
+
loader$1.defineCustomElements();
|
|
2567
2537
|
}, []);
|
|
2568
2538
|
return (jsxRuntime.jsx(recoil.RecoilRoot, { override: override, children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(VertexViewerToolkitEventListener, Object.assign({}, eventWrapperProps)), jsxRuntime.jsx(VertexViewerToolkitRootConfig, { config: config, children: children })] }) }));
|
|
2569
2539
|
};
|
|
@@ -2597,6 +2567,7 @@ exports.VertexResizableContent = VertexResizableContent;
|
|
|
2597
2567
|
exports.VertexRotateButton = VertexRotateButton;
|
|
2598
2568
|
exports.VertexSceneTree = VertexSceneTree;
|
|
2599
2569
|
exports.VertexSceneTreeContextMenu = VertexSceneTreeContextMenu;
|
|
2570
|
+
exports.VertexSceneTreeHeader = VertexSceneTreeHeader;
|
|
2600
2571
|
exports.VertexSceneTreeTableLayout = VertexSceneTreeTableLayout;
|
|
2601
2572
|
exports.VertexShowAllMenuItem = VertexShowAllMenuItem;
|
|
2602
2573
|
exports.VertexShowOnlyMenuItem = VertexShowOnlyMenuItem;
|