@vertexvis/viewer-toolkit-react 0.0.1 → 0.0.2-canary.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/bundle.cjs.js +169 -122
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +171 -125
- package/dist/bundle.esm.js.map +1 -1
- package/dist/components/scene-tree/scene-tree-toolbar/__tests__/scene-tree-toolbar.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-toolbar/scene-tree-collapse-all.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-toolbar/scene-tree-expand-all.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-toolbar/scene-tree-toolbar.d.ts +1 -0
- package/dist/components/viewer/__tests__/scene-reset.spec.d.ts +1 -0
- package/dist/components/viewer/scene-reset.d.ts +4 -0
- package/dist/components/viewer/vertex-viewer-view-cube.d.ts +3 -2
- package/dist/index.css +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/state/viewer/scene/actions.d.ts +1 -0
- package/package.json +2 -2
package/dist/bundle.esm.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { VertexMenu, VertexMenuItem, VertexIcon, VertexMenuDivider,
|
|
4
|
+
import { VertexMenu, VertexMenuItem, VertexIcon, VertexMenuDivider, VertexTooltip, VertexPopover, VertexSlider as VertexSlider$1, VertexIconButton, VertexTextfield } from '@vertexvis/ui-react';
|
|
5
5
|
import { UUID, Color } from '@vertexvis/utils';
|
|
6
6
|
import { useRecoilValue, useRecoilCallback, atom, selector, atomFamily, useSetRecoilState, useRecoilValueLoadable, useRecoilState, RecoilRoot } from 'recoil';
|
|
7
7
|
import { Point, Vector3, BoundingBox, Angle } from '@vertexvis/geometry';
|
|
8
8
|
import Pino from 'pino';
|
|
9
|
-
import { VertexSceneTreeTableLayout as VertexSceneTreeTableLayout$1, VertexSceneTreeTableColumn, VertexSceneTree as VertexSceneTree$1, VertexViewerToolbarGroup, VertexViewerToolbar, VertexViewerBoxQueryTool, VertexViewerViewCube as VertexViewerViewCube$1, VertexViewer as VertexViewer$1 } from '@vertexvis/viewer-react';
|
|
9
|
+
import { VertexSceneTreeTableLayout as VertexSceneTreeTableLayout$1, VertexSceneTreeTableColumn, VertexSceneTreeToolbar as VertexSceneTreeToolbar$1, VertexSceneTree as VertexSceneTree$1, VertexViewerToolbarGroup, VertexViewerToolbar, VertexViewerBoxQueryTool, VertexViewerViewCube as VertexViewerViewCube$1, VertexViewer as VertexViewer$1 } from '@vertexvis/viewer-react';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { defineCustomElements } from '@vertexvis/viewer/loader';
|
|
12
12
|
|
|
@@ -572,6 +572,14 @@ function useViewerSceneActions() {
|
|
|
572
572
|
selectItemsTransform,
|
|
573
573
|
deselectItemsTransform,
|
|
574
574
|
clearSelectionTransform,
|
|
575
|
+
reset: useActionCallback(({ snapshot }) => async (correlationId) => {
|
|
576
|
+
const sceneProvider = await snapshot.getPromiseRequired(viewerSceneProvider);
|
|
577
|
+
const scene = await sceneProvider();
|
|
578
|
+
scene === null || scene === void 0 ? void 0 : scene.reset({
|
|
579
|
+
includeCamera: true,
|
|
580
|
+
suppliedCorrelationId: correlationId,
|
|
581
|
+
});
|
|
582
|
+
}),
|
|
575
583
|
};
|
|
576
584
|
}
|
|
577
585
|
|
|
@@ -1633,82 +1641,31 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1633
1641
|
useSelectionActions: useSelectionActions
|
|
1634
1642
|
});
|
|
1635
1643
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
});
|
|
1644
|
-
const sceneTreeWidth = atom({
|
|
1645
|
-
key: 'sceneTreeWidth',
|
|
1646
|
-
default: undefined,
|
|
1647
|
-
});
|
|
1648
|
-
selector({
|
|
1649
|
-
key: 'sceneTreeController',
|
|
1650
|
-
get: ({ get }) => { var _a; return (_a = get(sceneTreeElement)) === null || _a === void 0 ? void 0 : _a.controller; },
|
|
1651
|
-
dangerouslyAllowMutability: true,
|
|
1652
|
-
});
|
|
1653
|
-
|
|
1654
|
-
function useSceneTreeActions() {
|
|
1655
|
-
const selectionActions = useSelectionActions();
|
|
1656
|
-
const viewerCameraActions = useViewerCameraActions();
|
|
1657
|
-
return {
|
|
1658
|
-
toggleSelection: useActionCallback(({ snapshot }) => async (event, node, tree) => {
|
|
1659
|
-
var _a, _b;
|
|
1660
|
-
if (event.defaultPrevented || event.button !== 0) {
|
|
1661
|
-
return;
|
|
1662
|
-
}
|
|
1663
|
-
if (!event.altKey) {
|
|
1664
|
-
if ((event.ctrlKey || event.metaKey) && node.selected) {
|
|
1665
|
-
tree.deselectItem(node);
|
|
1666
|
-
}
|
|
1667
|
-
else if (node.selected) {
|
|
1668
|
-
tree.selectItem(node, {
|
|
1669
|
-
recurseParent: true,
|
|
1670
|
-
});
|
|
1671
|
-
}
|
|
1672
|
-
else if (!node.selected) {
|
|
1673
|
-
tree.selectItem(node, {
|
|
1674
|
-
append: event.ctrlKey || event.metaKey,
|
|
1675
|
-
range: event.shiftKey,
|
|
1676
|
-
});
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
if (node.id != null) {
|
|
1680
|
-
const lastSelected = await snapshot.getPromise(selectionLastSelected);
|
|
1681
|
-
selectionActions.syncSelection({
|
|
1682
|
-
id: (_a = node.id) === null || _a === void 0 ? void 0 : _a.hex,
|
|
1683
|
-
ancestors: (_b = lastSelected === null || lastSelected === void 0 ? void 0 : lastSelected.ancestors) !== null && _b !== void 0 ? _b : [],
|
|
1684
|
-
}, {
|
|
1685
|
-
selected: event.metaKey || event.ctrlKey ? !node.selected : true,
|
|
1686
|
-
multiSelect: event.shiftKey || event.metaKey || event.ctrlKey,
|
|
1687
|
-
});
|
|
1688
|
-
// TODO: transform widget interaction
|
|
1644
|
+
const VertexFitSelectedMenuItem = () => {
|
|
1645
|
+
const selectedItems = useRecoilValue(selectionSelectedItemIds);
|
|
1646
|
+
const selectedSummary = useRecoilValue(selectionVisibleSummary);
|
|
1647
|
+
const cameraActions = useViewerCameraActions();
|
|
1648
|
+
return (jsxs(VertexMenuItem, { "data-testid": "fit-selected-menu-option", onClick: () => {
|
|
1649
|
+
if ((selectedSummary === null || selectedSummary === void 0 ? void 0 : selectedSummary.boundingBox) != null) {
|
|
1650
|
+
cameraActions.flyToByBoundingBox(selectedSummary.boundingBox);
|
|
1689
1651
|
}
|
|
1690
|
-
}),
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
flyToRow: useActionCallback(({ snapshot }) => async (rowClientY) => {
|
|
1652
|
+
}, disabled: selectedItems.length === 0, children: [jsx(VertexIcon, { slot: "icon", name: "fit-selected", size: "sm" }), jsx("div", { className: "pl-2", children: "Fit Selected" })] }));
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1655
|
+
const VertexFlyToMenuItem = () => {
|
|
1656
|
+
const cameraActions = useViewerCameraActions();
|
|
1657
|
+
const currentItem = useRecoilValue(contextMenuItem);
|
|
1658
|
+
return (jsxs(VertexMenuItem, { "data-testid": "fly-to-part-menu-option", onClick: () => {
|
|
1698
1659
|
var _a;
|
|
1699
|
-
const
|
|
1700
|
-
const
|
|
1701
|
-
|
|
1702
|
-
|
|
1660
|
+
const isRow = contextMenuItemIsRow(currentItem);
|
|
1661
|
+
const itemId = isRow
|
|
1662
|
+
? (_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.node.id) === null || _a === void 0 ? void 0 : _a.hex
|
|
1663
|
+
: currentItem === null || currentItem === void 0 ? void 0 : currentItem.id;
|
|
1664
|
+
if (itemId != null) {
|
|
1665
|
+
cameraActions.flyToById(itemId);
|
|
1703
1666
|
}
|
|
1704
|
-
}),
|
|
1705
|
-
|
|
1706
|
-
const element = await snapshot.getPromise(sceneTreeElement);
|
|
1707
|
-
const row = await (element === null || element === void 0 ? void 0 : element.getRowAtClientY(rowClientY));
|
|
1708
|
-
set(contextMenuItem, row);
|
|
1709
|
-
}),
|
|
1710
|
-
};
|
|
1711
|
-
}
|
|
1667
|
+
}, disabled: currentItem == null, children: [jsx(VertexIcon, { slot: "icon", name: "paper-airplane", size: "sm" }), jsx("div", { className: "pl-2", children: "Fly To" })] }));
|
|
1668
|
+
};
|
|
1712
1669
|
|
|
1713
1670
|
function useSceneItemsOperations({ viewerElement }) {
|
|
1714
1671
|
const sceneItemsOperation = React__default.useCallback(async (f, ids) => {
|
|
@@ -1754,13 +1711,6 @@ function useSceneItemsOperations({ viewerElement }) {
|
|
|
1754
1711
|
};
|
|
1755
1712
|
}
|
|
1756
1713
|
|
|
1757
|
-
const VertexHideSelectedMenuItem = () => {
|
|
1758
|
-
const viewerHTMLElement = useRecoilValue(viewerElement);
|
|
1759
|
-
const selectedItems = useRecoilValue(selectionSelectedItemIds);
|
|
1760
|
-
const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
|
|
1761
|
-
return (jsxs(VertexMenuItem, { "data-testid": "hide-selected-menu-option", onClick: () => sceneItemOperations.hideSelected(), disabled: selectedItems.length === 0, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsx("div", { className: "pl-2", children: "Hide Selected" })] }));
|
|
1762
|
-
};
|
|
1763
|
-
|
|
1764
1714
|
const VertexHideAllMenuItem = () => {
|
|
1765
1715
|
const viewerHTMLElement = useRecoilValue(viewerElement);
|
|
1766
1716
|
const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
|
|
@@ -1769,27 +1719,27 @@ const VertexHideAllMenuItem = () => {
|
|
|
1769
1719
|
}, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsx("div", { className: "pl-2", children: "Hide All Parts" })] }));
|
|
1770
1720
|
};
|
|
1771
1721
|
|
|
1772
|
-
const
|
|
1722
|
+
const VertexHidePartMenuItem = () => {
|
|
1773
1723
|
const viewerHTMLElement = useRecoilValue(viewerElement);
|
|
1774
1724
|
const currentItem = useRecoilValue(contextMenuItem);
|
|
1775
1725
|
const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
|
|
1776
|
-
return (jsxs(VertexMenuItem, { "data-testid": "
|
|
1726
|
+
return (jsxs(VertexMenuItem, { "data-testid": "hide-menu-option", onClick: () => {
|
|
1777
1727
|
var _a;
|
|
1778
1728
|
const isRow = contextMenuItemIsRow(currentItem);
|
|
1779
1729
|
const itemId = isRow
|
|
1780
1730
|
? (_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.node.id) === null || _a === void 0 ? void 0 : _a.hex
|
|
1781
|
-
: currentItem
|
|
1731
|
+
: currentItem.id;
|
|
1782
1732
|
if (itemId != null) {
|
|
1783
|
-
sceneItemOperations.
|
|
1733
|
+
sceneItemOperations.sceneItemsOperation((builder) => builder.hide(), [itemId]);
|
|
1784
1734
|
}
|
|
1785
|
-
}, disabled: currentItem == null, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-
|
|
1735
|
+
}, disabled: currentItem == null, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsx("div", { className: "pl-2", children: "Hide Part" })] }));
|
|
1786
1736
|
};
|
|
1787
1737
|
|
|
1788
|
-
const
|
|
1738
|
+
const VertexHideSelectedMenuItem = () => {
|
|
1789
1739
|
const viewerHTMLElement = useRecoilValue(viewerElement);
|
|
1790
1740
|
const selectedItems = useRecoilValue(selectionSelectedItemIds);
|
|
1791
1741
|
const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
|
|
1792
|
-
return (jsxs(VertexMenuItem, { "data-testid": "
|
|
1742
|
+
return (jsxs(VertexMenuItem, { "data-testid": "hide-selected-menu-option", onClick: () => sceneItemOperations.hideSelected(), disabled: selectedItems.length === 0, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsx("div", { className: "pl-2", children: "Hide Selected" })] }));
|
|
1793
1743
|
};
|
|
1794
1744
|
|
|
1795
1745
|
const VertexShowAllMenuItem = () => {
|
|
@@ -1800,32 +1750,106 @@ const VertexShowAllMenuItem = () => {
|
|
|
1800
1750
|
}, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsx("div", { className: "pl-2", children: "Show All Parts" })] }));
|
|
1801
1751
|
};
|
|
1802
1752
|
|
|
1803
|
-
const
|
|
1804
|
-
const
|
|
1805
|
-
const selectedSummary = useRecoilValue(selectionVisibleSummary);
|
|
1806
|
-
const cameraActions = useViewerCameraActions();
|
|
1807
|
-
return (jsxs(VertexMenuItem, { "data-testid": "fit-selected-menu-option", onClick: () => {
|
|
1808
|
-
if ((selectedSummary === null || selectedSummary === void 0 ? void 0 : selectedSummary.boundingBox) != null) {
|
|
1809
|
-
cameraActions.flyToByBoundingBox(selectedSummary.boundingBox);
|
|
1810
|
-
}
|
|
1811
|
-
}, disabled: selectedItems.length === 0, children: [jsx(VertexIcon, { slot: "icon", name: "fit-selected", size: "sm" }), jsx("div", { className: "pl-2", children: "Fit Selected" })] }));
|
|
1812
|
-
};
|
|
1813
|
-
|
|
1814
|
-
const VertexFlyToMenuItem = () => {
|
|
1815
|
-
const cameraActions = useViewerCameraActions();
|
|
1753
|
+
const VertexShowOnlyMenuItem = () => {
|
|
1754
|
+
const viewerHTMLElement = useRecoilValue(viewerElement);
|
|
1816
1755
|
const currentItem = useRecoilValue(contextMenuItem);
|
|
1817
|
-
|
|
1756
|
+
const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
|
|
1757
|
+
return (jsxs(VertexMenuItem, { "data-testid": "show-only-menu-option", onClick: () => {
|
|
1818
1758
|
var _a;
|
|
1819
1759
|
const isRow = contextMenuItemIsRow(currentItem);
|
|
1820
1760
|
const itemId = isRow
|
|
1821
1761
|
? (_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.node.id) === null || _a === void 0 ? void 0 : _a.hex
|
|
1822
1762
|
: currentItem === null || currentItem === void 0 ? void 0 : currentItem.id;
|
|
1823
1763
|
if (itemId != null) {
|
|
1824
|
-
|
|
1764
|
+
sceneItemOperations.showOnlyItem(itemId);
|
|
1825
1765
|
}
|
|
1826
|
-
}, disabled: currentItem == null, children: [jsx(VertexIcon, { slot: "icon", name: "
|
|
1766
|
+
}, disabled: currentItem == null, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsx("div", { className: "pl-2", children: "Show Only Part" })] }));
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
const VertexShowOnlySelectedMenuItem = () => {
|
|
1770
|
+
const viewerHTMLElement = useRecoilValue(viewerElement);
|
|
1771
|
+
const selectedItems = useRecoilValue(selectionSelectedItemIds);
|
|
1772
|
+
const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
|
|
1773
|
+
return (jsxs(VertexMenuItem, { "data-testid": "show-only-selected-menu-option", onClick: () => sceneItemOperations.showOnlySelected(), disabled: selectedItems.length === 0, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsx("div", { className: "pl-2", children: "Show Only Selected" })] }));
|
|
1827
1774
|
};
|
|
1828
1775
|
|
|
1776
|
+
atom({
|
|
1777
|
+
key: 'sceneTreeLoaderVisible',
|
|
1778
|
+
default: false,
|
|
1779
|
+
});
|
|
1780
|
+
const sceneTreeElement = atom({
|
|
1781
|
+
key: 'sceneTreeElement',
|
|
1782
|
+
default: undefined,
|
|
1783
|
+
});
|
|
1784
|
+
const sceneTreeWidth = atom({
|
|
1785
|
+
key: 'sceneTreeWidth',
|
|
1786
|
+
default: undefined,
|
|
1787
|
+
});
|
|
1788
|
+
selector({
|
|
1789
|
+
key: 'sceneTreeController',
|
|
1790
|
+
get: ({ get }) => { var _a; return (_a = get(sceneTreeElement)) === null || _a === void 0 ? void 0 : _a.controller; },
|
|
1791
|
+
dangerouslyAllowMutability: true,
|
|
1792
|
+
});
|
|
1793
|
+
|
|
1794
|
+
function useSceneTreeActions() {
|
|
1795
|
+
const selectionActions = useSelectionActions();
|
|
1796
|
+
const viewerCameraActions = useViewerCameraActions();
|
|
1797
|
+
return {
|
|
1798
|
+
toggleSelection: useActionCallback(({ snapshot }) => async (event, node, tree) => {
|
|
1799
|
+
var _a, _b;
|
|
1800
|
+
if (event.defaultPrevented || event.button !== 0) {
|
|
1801
|
+
return;
|
|
1802
|
+
}
|
|
1803
|
+
if (!event.altKey) {
|
|
1804
|
+
if ((event.ctrlKey || event.metaKey) && node.selected) {
|
|
1805
|
+
tree.deselectItem(node);
|
|
1806
|
+
}
|
|
1807
|
+
else if (node.selected) {
|
|
1808
|
+
tree.selectItem(node, {
|
|
1809
|
+
recurseParent: true,
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
else if (!node.selected) {
|
|
1813
|
+
tree.selectItem(node, {
|
|
1814
|
+
append: event.ctrlKey || event.metaKey,
|
|
1815
|
+
range: event.shiftKey,
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
if (node.id != null) {
|
|
1820
|
+
const lastSelected = await snapshot.getPromise(selectionLastSelected);
|
|
1821
|
+
selectionActions.syncSelection({
|
|
1822
|
+
id: (_a = node.id) === null || _a === void 0 ? void 0 : _a.hex,
|
|
1823
|
+
ancestors: (_b = lastSelected === null || lastSelected === void 0 ? void 0 : lastSelected.ancestors) !== null && _b !== void 0 ? _b : [],
|
|
1824
|
+
}, {
|
|
1825
|
+
selected: event.metaKey || event.ctrlKey ? !node.selected : true,
|
|
1826
|
+
multiSelect: event.shiftKey || event.metaKey || event.ctrlKey,
|
|
1827
|
+
});
|
|
1828
|
+
// TODO: transform widget interaction
|
|
1829
|
+
}
|
|
1830
|
+
}),
|
|
1831
|
+
toggleExpansion: useActionCallback(() => (event, node, tree) => {
|
|
1832
|
+
tree.toggleExpandItem(node);
|
|
1833
|
+
}),
|
|
1834
|
+
toggleVisibility: useActionCallback(() => (event, node, tree) => {
|
|
1835
|
+
tree.toggleItemVisibility(node);
|
|
1836
|
+
}),
|
|
1837
|
+
flyToRow: useActionCallback(({ snapshot }) => async (rowClientY) => {
|
|
1838
|
+
var _a;
|
|
1839
|
+
const element = await snapshot.getPromise(sceneTreeElement);
|
|
1840
|
+
const row = await (element === null || element === void 0 ? void 0 : element.getRowAtClientY(rowClientY));
|
|
1841
|
+
if (((_a = row === null || row === void 0 ? void 0 : row.node.id) === null || _a === void 0 ? void 0 : _a.hex) != null) {
|
|
1842
|
+
await viewerCameraActions.flyToById(row.node.id.hex);
|
|
1843
|
+
}
|
|
1844
|
+
}),
|
|
1845
|
+
setContextMenuItem: useActionCallback(({ set, snapshot }) => async (rowClientY) => {
|
|
1846
|
+
const element = await snapshot.getPromise(sceneTreeElement);
|
|
1847
|
+
const row = await (element === null || element === void 0 ? void 0 : element.getRowAtClientY(rowClientY));
|
|
1848
|
+
set(contextMenuItem, row);
|
|
1849
|
+
}),
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1829
1853
|
const DefaultSceneTreeContextMenu = () => {
|
|
1830
1854
|
return (jsxs("div", { className: "w-56", children: [jsx(VertexHideSelectedMenuItem, {}), jsx(VertexHideAllMenuItem, {}), jsx(VertexShowOnlyMenuItem, {}), jsx(VertexShowOnlySelectedMenuItem, {}), jsx(VertexShowAllMenuItem, {}), jsx(VertexMenuDivider, { className: "md:contents hidden short:hidden" }), jsx(VertexFitSelectedMenuItem, {}), jsx(VertexFlyToMenuItem, {})] }));
|
|
1831
1855
|
};
|
|
@@ -1842,22 +1866,6 @@ const VertexSceneTreeContextMenu = ({ children }) => {
|
|
|
1842
1866
|
: (jsx(DefaultSceneTreeContextMenu, {})) }));
|
|
1843
1867
|
};
|
|
1844
1868
|
|
|
1845
|
-
const VertexHidePartMenuItem = () => {
|
|
1846
|
-
const viewerHTMLElement = useRecoilValue(viewerElement);
|
|
1847
|
-
const currentItem = useRecoilValue(contextMenuItem);
|
|
1848
|
-
const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
|
|
1849
|
-
return (jsxs(VertexMenuItem, { "data-testid": "hide-menu-option", onClick: () => {
|
|
1850
|
-
var _a;
|
|
1851
|
-
const isRow = contextMenuItemIsRow(currentItem);
|
|
1852
|
-
const itemId = isRow
|
|
1853
|
-
? (_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.node.id) === null || _a === void 0 ? void 0 : _a.hex
|
|
1854
|
-
: currentItem.id;
|
|
1855
|
-
if (itemId != null) {
|
|
1856
|
-
sceneItemOperations.sceneItemsOperation((builder) => builder.hide(), [itemId]);
|
|
1857
|
-
}
|
|
1858
|
-
}, disabled: currentItem == null, children: [jsx(VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsx("div", { className: "pl-2", children: "Hide Part" })] }));
|
|
1859
|
-
};
|
|
1860
|
-
|
|
1861
1869
|
const DefaultViewerContextMenu = () => {
|
|
1862
1870
|
return (jsxs("div", { className: "w-56", children: [jsx(VertexHidePartMenuItem, {}), jsx(VertexHideSelectedMenuItem, {}), jsx(VertexHideAllMenuItem, {}), jsx(VertexShowOnlyMenuItem, {}), jsx(VertexShowOnlySelectedMenuItem, {}), jsx(VertexShowAllMenuItem, {}), jsx(VertexMenuDivider, { className: "md:contents hidden short:hidden" }), jsx(VertexFitSelectedMenuItem, {}), jsx(VertexFlyToMenuItem, {})] }));
|
|
1863
1871
|
};
|
|
@@ -1995,6 +2003,24 @@ const VertexSceneTreeTableLayout = (sdkProps) => {
|
|
|
1995
2003
|
}) })));
|
|
1996
2004
|
};
|
|
1997
2005
|
|
|
2006
|
+
const VertexSceneTreeExpandAll = () => {
|
|
2007
|
+
const sceneTreeHTMLElement = useRecoilValue(sceneTreeElement);
|
|
2008
|
+
return (jsx(VertexTooltip, { className: "w-auto", content: "Expand All", placement: "top", children: jsx(VertexIcon, { size: "sm", "data-testid": "expand-all-icon", className: "h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer", name: "expand-all", onClick: () => {
|
|
2009
|
+
sceneTreeHTMLElement === null || sceneTreeHTMLElement === void 0 ? void 0 : sceneTreeHTMLElement.expandAll();
|
|
2010
|
+
} }) }));
|
|
2011
|
+
};
|
|
2012
|
+
|
|
2013
|
+
const VertexSceneTreeCollapseAll = () => {
|
|
2014
|
+
const sceneTreeHTMLElement = useRecoilValue(sceneTreeElement);
|
|
2015
|
+
return (jsx(VertexTooltip, { className: "w-auto", content: "Collapse All", placement: "top", children: jsx(VertexIcon, { size: "sm", className: "h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer", "data-testid": "collapse-all-icon", name: "collapse-all", onClick: () => {
|
|
2016
|
+
sceneTreeHTMLElement === null || sceneTreeHTMLElement === void 0 ? void 0 : sceneTreeHTMLElement.collapseAll();
|
|
2017
|
+
} }) }));
|
|
2018
|
+
};
|
|
2019
|
+
|
|
2020
|
+
function VertexSceneTreeToolbar() {
|
|
2021
|
+
return (jsx(VertexSceneTreeToolbar$1, { className: "h-10 border-b border-neutral-300 box-border", children: jsxs("div", { className: "flex flex-shrink-0 w-full text-neutral-700 items-center gap mx-2", children: [jsx(VertexSceneTreeExpandAll, {}), jsx(VertexSceneTreeCollapseAll, {})] }) }));
|
|
2022
|
+
}
|
|
2023
|
+
|
|
1998
2024
|
const VertexSceneTree = (_a) => {
|
|
1999
2025
|
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"]);
|
|
2000
2026
|
const config = useRecoilValue(sdkConfig);
|
|
@@ -2034,7 +2060,7 @@ const VertexSceneTree = (_a) => {
|
|
|
2034
2060
|
var _a;
|
|
2035
2061
|
const providedRowData = (_a = rowData === null || rowData === void 0 ? void 0 : rowData(row)) !== null && _a !== void 0 ? _a : {};
|
|
2036
2062
|
return Object.assign({ handleExpansion: wrappedExpansionHandler, handleSelection: wrappedSelectionHandler, handleVisibility: wrappedVisibilityHandler }, providedRowData);
|
|
2037
|
-
} }, sdkProps, { children: [jsx(VertexSceneTreeTableLayout, {}), children] })));
|
|
2063
|
+
} }, sdkProps, { children: [jsx(VertexSceneTreeToolbar, {}), jsx(VertexSceneTreeTableLayout, {}), children] })));
|
|
2038
2064
|
};
|
|
2039
2065
|
|
|
2040
2066
|
const useSynchronizedProp = (state, value) => {
|
|
@@ -2355,6 +2381,19 @@ const VertexToolbar = ({ children }) => {
|
|
|
2355
2381
|
return (jsx(VertexViewerToolbar, { placement: 'bottom-center', children: hasDefinedChildren ? (jsx(VertexViewerToolbarGroup, { className: "p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95", children: children })) : (jsx(DefaultToolbar, {})) }));
|
|
2356
2382
|
};
|
|
2357
2383
|
|
|
2384
|
+
const VertexViewerSceneReset = ({ onReset }) => {
|
|
2385
|
+
const crossSectioningActions = useCrossSectioningActions();
|
|
2386
|
+
const selectionActions = useSelectionActions();
|
|
2387
|
+
const viewerSceneActions = useViewerSceneActions();
|
|
2388
|
+
const handleReset = async () => {
|
|
2389
|
+
await crossSectioningActions.disable();
|
|
2390
|
+
selectionActions.resetSelectionState();
|
|
2391
|
+
onReset === null || onReset === void 0 ? void 0 : onReset();
|
|
2392
|
+
await viewerSceneActions.reset();
|
|
2393
|
+
};
|
|
2394
|
+
return (jsx(VertexTooltip, { content: "Reset View", children: jsx(VertexIconButton, { iconName: "reset", className: "flex bg-white opacity-70 hover:opacity-100 text-neutral-900 hover:text-neutral-700 hover:bg-neutral-200 rounded p-1 cursor-pointer", "data-testid": "viewer-reset-tool-button", onClick: handleReset, variant: "plain" }) }));
|
|
2395
|
+
};
|
|
2396
|
+
|
|
2358
2397
|
function useViewerFrameActions() {
|
|
2359
2398
|
return {
|
|
2360
2399
|
frameDrawn: useActionCallback(({ set, reset, snapshot }) => async (event) => {
|
|
@@ -2389,8 +2428,15 @@ const BoxSelectionTool = () => {
|
|
|
2389
2428
|
};
|
|
2390
2429
|
|
|
2391
2430
|
const VertexViewerViewCube = (_a) => {
|
|
2392
|
-
var { placement } = _a, sdkProps = __rest(_a, ["placement"]);
|
|
2393
|
-
|
|
2431
|
+
var { placement, children } = _a, sdkProps = __rest(_a, ["placement", "children"]);
|
|
2432
|
+
const childrenAsArray = Array.isArray(children)
|
|
2433
|
+
? children
|
|
2434
|
+
: [children];
|
|
2435
|
+
const definedChildrenWithoutViewCube = childrenAsArray
|
|
2436
|
+
.filter((c) => !React__default.isValidElement(c) || c.type !== VertexViewerViewCube$1)
|
|
2437
|
+
.filter((c) => c != null && c !== false);
|
|
2438
|
+
const viewCube = childrenAsArray.find((c) => React__default.isValidElement(c) && c.type === VertexViewerViewCube$1);
|
|
2439
|
+
return (jsxs(VertexViewerToolbar, { direction: "vertical", "data-testid": "view-cube-toolbar", placement: placement !== null && placement !== void 0 ? placement : 'top-right', children: [viewCube !== null && viewCube !== void 0 ? viewCube : jsx(VertexViewerViewCube$1, Object.assign({ className: "m-7" }, sdkProps)), definedChildrenWithoutViewCube.length === 0 ? (jsx("div", { className: "flex items-center justify-center mt-3", children: jsx(VertexViewerSceneReset, {}) })) : (jsx("div", { className: "mt-3", children: definedChildrenWithoutViewCube }))] }));
|
|
2394
2440
|
};
|
|
2395
2441
|
|
|
2396
2442
|
const VertexViewer = (_a) => {
|
|
@@ -2475,5 +2521,5 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
2475
2521
|
get AssemblyFontFace () { return AssemblyFontFace; }
|
|
2476
2522
|
});
|
|
2477
2523
|
|
|
2478
|
-
export { index$3 as CrossSection, index$2 as Hits, index as SceneTree, index$1 as Selection, VertexContextMenu, VertexFitAllButton, VertexFitSelectedMenuItem, VertexFlyToMenuItem, VertexHideAllMenuItem, VertexHidePartMenuItem, VertexHideSelectedMenuItem, VertexPanButton, VertexRotateButton, VertexSceneTree, VertexSceneTreeContextMenu, VertexSceneTreeTableLayout, VertexShowAllMenuItem, VertexShowOnlyMenuItem, VertexShowOnlySelectedMenuItem, VertexToolbar, VertexViewer, VertexViewerContextMenu, VertexViewerCrossSectionButton, VertexViewerToolbarDivider, VertexViewerToolkitRoot, VertexViewerViewCube, VertexZoomButton };
|
|
2524
|
+
export { index$3 as CrossSection, index$2 as Hits, index as SceneTree, index$1 as Selection, VertexContextMenu, VertexFitAllButton, VertexFitSelectedMenuItem, VertexFlyToMenuItem, VertexHideAllMenuItem, VertexHidePartMenuItem, VertexHideSelectedMenuItem, VertexPanButton, VertexRotateButton, VertexSceneTree, VertexSceneTreeContextMenu, VertexSceneTreeTableLayout, VertexShowAllMenuItem, VertexShowOnlyMenuItem, VertexShowOnlySelectedMenuItem, VertexToolbar, VertexViewer, VertexViewerContextMenu, VertexViewerCrossSectionButton, VertexViewerSceneReset, VertexViewerToolbarDivider, VertexViewerToolkitRoot, VertexViewerViewCube, VertexZoomButton };
|
|
2479
2525
|
//# sourceMappingURL=bundle.esm.js.map
|