@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.
@@ -592,6 +592,14 @@ function useViewerSceneActions() {
592
592
  selectItemsTransform,
593
593
  deselectItemsTransform,
594
594
  clearSelectionTransform,
595
+ reset: useActionCallback(({ snapshot }) => async (correlationId) => {
596
+ const sceneProvider = await snapshot.getPromiseRequired(viewerSceneProvider);
597
+ const scene = await sceneProvider();
598
+ scene === null || scene === void 0 ? void 0 : scene.reset({
599
+ includeCamera: true,
600
+ suppliedCorrelationId: correlationId,
601
+ });
602
+ }),
595
603
  };
596
604
  }
597
605
 
@@ -1653,82 +1661,31 @@ var index$1 = /*#__PURE__*/Object.freeze({
1653
1661
  useSelectionActions: useSelectionActions
1654
1662
  });
1655
1663
 
1656
- recoil.atom({
1657
- key: 'sceneTreeLoaderVisible',
1658
- default: false,
1659
- });
1660
- const sceneTreeElement = recoil.atom({
1661
- key: 'sceneTreeElement',
1662
- default: undefined,
1663
- });
1664
- const sceneTreeWidth = recoil.atom({
1665
- key: 'sceneTreeWidth',
1666
- default: undefined,
1667
- });
1668
- recoil.selector({
1669
- key: 'sceneTreeController',
1670
- get: ({ get }) => { var _a; return (_a = get(sceneTreeElement)) === null || _a === void 0 ? void 0 : _a.controller; },
1671
- dangerouslyAllowMutability: true,
1672
- });
1673
-
1674
- function useSceneTreeActions() {
1675
- const selectionActions = useSelectionActions();
1676
- const viewerCameraActions = useViewerCameraActions();
1677
- return {
1678
- toggleSelection: useActionCallback(({ snapshot }) => async (event, node, tree) => {
1679
- var _a, _b;
1680
- if (event.defaultPrevented || event.button !== 0) {
1681
- return;
1682
- }
1683
- if (!event.altKey) {
1684
- if ((event.ctrlKey || event.metaKey) && node.selected) {
1685
- tree.deselectItem(node);
1686
- }
1687
- else if (node.selected) {
1688
- tree.selectItem(node, {
1689
- recurseParent: true,
1690
- });
1691
- }
1692
- else if (!node.selected) {
1693
- tree.selectItem(node, {
1694
- append: event.ctrlKey || event.metaKey,
1695
- range: event.shiftKey,
1696
- });
1697
- }
1698
- }
1699
- if (node.id != null) {
1700
- const lastSelected = await snapshot.getPromise(selectionLastSelected);
1701
- selectionActions.syncSelection({
1702
- id: (_a = node.id) === null || _a === void 0 ? void 0 : _a.hex,
1703
- ancestors: (_b = lastSelected === null || lastSelected === void 0 ? void 0 : lastSelected.ancestors) !== null && _b !== void 0 ? _b : [],
1704
- }, {
1705
- selected: event.metaKey || event.ctrlKey ? !node.selected : true,
1706
- multiSelect: event.shiftKey || event.metaKey || event.ctrlKey,
1707
- });
1708
- // TODO: transform widget interaction
1664
+ const VertexFitSelectedMenuItem = () => {
1665
+ const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
1666
+ const selectedSummary = recoil.useRecoilValue(selectionVisibleSummary);
1667
+ const cameraActions = useViewerCameraActions();
1668
+ return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "fit-selected-menu-option", onClick: () => {
1669
+ if ((selectedSummary === null || selectedSummary === void 0 ? void 0 : selectedSummary.boundingBox) != null) {
1670
+ cameraActions.flyToByBoundingBox(selectedSummary.boundingBox);
1709
1671
  }
1710
- }),
1711
- toggleExpansion: useActionCallback(() => (event, node, tree) => {
1712
- tree.toggleExpandItem(node);
1713
- }),
1714
- toggleVisibility: useActionCallback(() => (event, node, tree) => {
1715
- tree.toggleItemVisibility(node);
1716
- }),
1717
- flyToRow: useActionCallback(({ snapshot }) => async (rowClientY) => {
1672
+ }, disabled: selectedItems.length === 0, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "fit-selected", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Fit Selected" })] }));
1673
+ };
1674
+
1675
+ const VertexFlyToMenuItem = () => {
1676
+ const cameraActions = useViewerCameraActions();
1677
+ const currentItem = recoil.useRecoilValue(contextMenuItem);
1678
+ return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "fly-to-part-menu-option", onClick: () => {
1718
1679
  var _a;
1719
- const element = await snapshot.getPromise(sceneTreeElement);
1720
- const row = await (element === null || element === void 0 ? void 0 : element.getRowAtClientY(rowClientY));
1721
- if (((_a = row === null || row === void 0 ? void 0 : row.node.id) === null || _a === void 0 ? void 0 : _a.hex) != null) {
1722
- await viewerCameraActions.flyToById(row.node.id.hex);
1680
+ const isRow = contextMenuItemIsRow(currentItem);
1681
+ const itemId = isRow
1682
+ ? (_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.node.id) === null || _a === void 0 ? void 0 : _a.hex
1683
+ : currentItem === null || currentItem === void 0 ? void 0 : currentItem.id;
1684
+ if (itemId != null) {
1685
+ cameraActions.flyToById(itemId);
1723
1686
  }
1724
- }),
1725
- setContextMenuItem: useActionCallback(({ set, snapshot }) => async (rowClientY) => {
1726
- const element = await snapshot.getPromise(sceneTreeElement);
1727
- const row = await (element === null || element === void 0 ? void 0 : element.getRowAtClientY(rowClientY));
1728
- set(contextMenuItem, row);
1729
- }),
1730
- };
1731
- }
1687
+ }, disabled: currentItem == null, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "paper-airplane", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Fly To" })] }));
1688
+ };
1732
1689
 
1733
1690
  function useSceneItemsOperations({ viewerElement }) {
1734
1691
  const sceneItemsOperation = React.useCallback(async (f, ids) => {
@@ -1774,13 +1731,6 @@ function useSceneItemsOperations({ viewerElement }) {
1774
1731
  };
1775
1732
  }
1776
1733
 
1777
- const VertexHideSelectedMenuItem = () => {
1778
- const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
1779
- const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
1780
- const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
1781
- 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" })] }));
1782
- };
1783
-
1784
1734
  const VertexHideAllMenuItem = () => {
1785
1735
  const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
1786
1736
  const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
@@ -1789,27 +1739,27 @@ const VertexHideAllMenuItem = () => {
1789
1739
  }, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Hide All Parts" })] }));
1790
1740
  };
1791
1741
 
1792
- const VertexShowOnlyMenuItem = () => {
1742
+ const VertexHidePartMenuItem = () => {
1793
1743
  const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
1794
1744
  const currentItem = recoil.useRecoilValue(contextMenuItem);
1795
1745
  const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
1796
- return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "show-only-menu-option", onClick: () => {
1746
+ return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "hide-menu-option", onClick: () => {
1797
1747
  var _a;
1798
1748
  const isRow = contextMenuItemIsRow(currentItem);
1799
1749
  const itemId = isRow
1800
1750
  ? (_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.node.id) === null || _a === void 0 ? void 0 : _a.hex
1801
- : currentItem === null || currentItem === void 0 ? void 0 : currentItem.id;
1751
+ : currentItem.id;
1802
1752
  if (itemId != null) {
1803
- sceneItemOperations.showOnlyItem(itemId);
1753
+ sceneItemOperations.sceneItemsOperation((builder) => builder.hide(), [itemId]);
1804
1754
  }
1805
- }, disabled: currentItem == null, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Show Only Part" })] }));
1755
+ }, disabled: currentItem == null, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Hide Part" })] }));
1806
1756
  };
1807
1757
 
1808
- const VertexShowOnlySelectedMenuItem = () => {
1758
+ const VertexHideSelectedMenuItem = () => {
1809
1759
  const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
1810
1760
  const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
1811
1761
  const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
1812
- 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" })] }));
1762
+ 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" })] }));
1813
1763
  };
1814
1764
 
1815
1765
  const VertexShowAllMenuItem = () => {
@@ -1820,32 +1770,106 @@ const VertexShowAllMenuItem = () => {
1820
1770
  }, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Show All Parts" })] }));
1821
1771
  };
1822
1772
 
1823
- const VertexFitSelectedMenuItem = () => {
1824
- const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
1825
- const selectedSummary = recoil.useRecoilValue(selectionVisibleSummary);
1826
- const cameraActions = useViewerCameraActions();
1827
- return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "fit-selected-menu-option", onClick: () => {
1828
- if ((selectedSummary === null || selectedSummary === void 0 ? void 0 : selectedSummary.boundingBox) != null) {
1829
- cameraActions.flyToByBoundingBox(selectedSummary.boundingBox);
1830
- }
1831
- }, disabled: selectedItems.length === 0, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "fit-selected", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Fit Selected" })] }));
1832
- };
1833
-
1834
- const VertexFlyToMenuItem = () => {
1835
- const cameraActions = useViewerCameraActions();
1773
+ const VertexShowOnlyMenuItem = () => {
1774
+ const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
1836
1775
  const currentItem = recoil.useRecoilValue(contextMenuItem);
1837
- return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "fly-to-part-menu-option", onClick: () => {
1776
+ const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
1777
+ return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "show-only-menu-option", onClick: () => {
1838
1778
  var _a;
1839
1779
  const isRow = contextMenuItemIsRow(currentItem);
1840
1780
  const itemId = isRow
1841
1781
  ? (_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.node.id) === null || _a === void 0 ? void 0 : _a.hex
1842
1782
  : currentItem === null || currentItem === void 0 ? void 0 : currentItem.id;
1843
1783
  if (itemId != null) {
1844
- cameraActions.flyToById(itemId);
1784
+ sceneItemOperations.showOnlyItem(itemId);
1845
1785
  }
1846
- }, disabled: currentItem == null, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "paper-airplane", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Fly To" })] }));
1786
+ }, disabled: currentItem == null, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-visible", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Show Only Part" })] }));
1787
+ };
1788
+
1789
+ const VertexShowOnlySelectedMenuItem = () => {
1790
+ const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
1791
+ const selectedItems = recoil.useRecoilValue(selectionSelectedItemIds);
1792
+ const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
1793
+ 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" })] }));
1847
1794
  };
1848
1795
 
1796
+ recoil.atom({
1797
+ key: 'sceneTreeLoaderVisible',
1798
+ default: false,
1799
+ });
1800
+ const sceneTreeElement = recoil.atom({
1801
+ key: 'sceneTreeElement',
1802
+ default: undefined,
1803
+ });
1804
+ const sceneTreeWidth = recoil.atom({
1805
+ key: 'sceneTreeWidth',
1806
+ default: undefined,
1807
+ });
1808
+ recoil.selector({
1809
+ key: 'sceneTreeController',
1810
+ get: ({ get }) => { var _a; return (_a = get(sceneTreeElement)) === null || _a === void 0 ? void 0 : _a.controller; },
1811
+ dangerouslyAllowMutability: true,
1812
+ });
1813
+
1814
+ function useSceneTreeActions() {
1815
+ const selectionActions = useSelectionActions();
1816
+ const viewerCameraActions = useViewerCameraActions();
1817
+ return {
1818
+ toggleSelection: useActionCallback(({ snapshot }) => async (event, node, tree) => {
1819
+ var _a, _b;
1820
+ if (event.defaultPrevented || event.button !== 0) {
1821
+ return;
1822
+ }
1823
+ if (!event.altKey) {
1824
+ if ((event.ctrlKey || event.metaKey) && node.selected) {
1825
+ tree.deselectItem(node);
1826
+ }
1827
+ else if (node.selected) {
1828
+ tree.selectItem(node, {
1829
+ recurseParent: true,
1830
+ });
1831
+ }
1832
+ else if (!node.selected) {
1833
+ tree.selectItem(node, {
1834
+ append: event.ctrlKey || event.metaKey,
1835
+ range: event.shiftKey,
1836
+ });
1837
+ }
1838
+ }
1839
+ if (node.id != null) {
1840
+ const lastSelected = await snapshot.getPromise(selectionLastSelected);
1841
+ selectionActions.syncSelection({
1842
+ id: (_a = node.id) === null || _a === void 0 ? void 0 : _a.hex,
1843
+ ancestors: (_b = lastSelected === null || lastSelected === void 0 ? void 0 : lastSelected.ancestors) !== null && _b !== void 0 ? _b : [],
1844
+ }, {
1845
+ selected: event.metaKey || event.ctrlKey ? !node.selected : true,
1846
+ multiSelect: event.shiftKey || event.metaKey || event.ctrlKey,
1847
+ });
1848
+ // TODO: transform widget interaction
1849
+ }
1850
+ }),
1851
+ toggleExpansion: useActionCallback(() => (event, node, tree) => {
1852
+ tree.toggleExpandItem(node);
1853
+ }),
1854
+ toggleVisibility: useActionCallback(() => (event, node, tree) => {
1855
+ tree.toggleItemVisibility(node);
1856
+ }),
1857
+ flyToRow: useActionCallback(({ snapshot }) => async (rowClientY) => {
1858
+ var _a;
1859
+ const element = await snapshot.getPromise(sceneTreeElement);
1860
+ const row = await (element === null || element === void 0 ? void 0 : element.getRowAtClientY(rowClientY));
1861
+ if (((_a = row === null || row === void 0 ? void 0 : row.node.id) === null || _a === void 0 ? void 0 : _a.hex) != null) {
1862
+ await viewerCameraActions.flyToById(row.node.id.hex);
1863
+ }
1864
+ }),
1865
+ setContextMenuItem: useActionCallback(({ set, snapshot }) => async (rowClientY) => {
1866
+ const element = await snapshot.getPromise(sceneTreeElement);
1867
+ const row = await (element === null || element === void 0 ? void 0 : element.getRowAtClientY(rowClientY));
1868
+ set(contextMenuItem, row);
1869
+ }),
1870
+ };
1871
+ }
1872
+
1849
1873
  const DefaultSceneTreeContextMenu = () => {
1850
1874
  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(uiReact.VertexMenuDivider, { className: "md:contents hidden short:hidden" }), jsxRuntime.jsx(VertexFitSelectedMenuItem, {}), jsxRuntime.jsx(VertexFlyToMenuItem, {})] }));
1851
1875
  };
@@ -1862,22 +1886,6 @@ const VertexSceneTreeContextMenu = ({ children }) => {
1862
1886
  : (jsxRuntime.jsx(DefaultSceneTreeContextMenu, {})) }));
1863
1887
  };
1864
1888
 
1865
- const VertexHidePartMenuItem = () => {
1866
- const viewerHTMLElement = recoil.useRecoilValue(viewerElement);
1867
- const currentItem = recoil.useRecoilValue(contextMenuItem);
1868
- const sceneItemOperations = useSceneItemsOperations({ viewerElement: viewerHTMLElement !== null && viewerHTMLElement !== void 0 ? viewerHTMLElement : null });
1869
- return (jsxRuntime.jsxs(uiReact.VertexMenuItem, { "data-testid": "hide-menu-option", onClick: () => {
1870
- var _a;
1871
- const isRow = contextMenuItemIsRow(currentItem);
1872
- const itemId = isRow
1873
- ? (_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.node.id) === null || _a === void 0 ? void 0 : _a.hex
1874
- : currentItem.id;
1875
- if (itemId != null) {
1876
- sceneItemOperations.sceneItemsOperation((builder) => builder.hide(), [itemId]);
1877
- }
1878
- }, disabled: currentItem == null, children: [jsxRuntime.jsx(uiReact.VertexIcon, { slot: "icon", name: "visibility-hidden", size: "sm" }), jsxRuntime.jsx("div", { className: "pl-2", children: "Hide Part" })] }));
1879
- };
1880
-
1881
1889
  const DefaultViewerContextMenu = () => {
1882
1890
  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(uiReact.VertexMenuDivider, { className: "md:contents hidden short:hidden" }), jsxRuntime.jsx(VertexFitSelectedMenuItem, {}), jsxRuntime.jsx(VertexFlyToMenuItem, {})] }));
1883
1891
  };
@@ -2015,6 +2023,24 @@ const VertexSceneTreeTableLayout = (sdkProps) => {
2015
2023
  }) })));
2016
2024
  };
2017
2025
 
2026
+ const VertexSceneTreeExpandAll = () => {
2027
+ const sceneTreeHTMLElement = recoil.useRecoilValue(sceneTreeElement);
2028
+ return (jsxRuntime.jsx(uiReact.VertexTooltip, { className: "w-auto", content: "Expand All", placement: "top", children: jsxRuntime.jsx(uiReact.VertexIcon, { size: "sm", "data-testid": "expand-all-icon", className: "h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer", name: "expand-all", onClick: () => {
2029
+ sceneTreeHTMLElement === null || sceneTreeHTMLElement === void 0 ? void 0 : sceneTreeHTMLElement.expandAll();
2030
+ } }) }));
2031
+ };
2032
+
2033
+ const VertexSceneTreeCollapseAll = () => {
2034
+ const sceneTreeHTMLElement = recoil.useRecoilValue(sceneTreeElement);
2035
+ return (jsxRuntime.jsx(uiReact.VertexTooltip, { className: "w-auto", content: "Collapse All", placement: "top", children: jsxRuntime.jsx(uiReact.VertexIcon, { size: "sm", className: "h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer", "data-testid": "collapse-all-icon", name: "collapse-all", onClick: () => {
2036
+ sceneTreeHTMLElement === null || sceneTreeHTMLElement === void 0 ? void 0 : sceneTreeHTMLElement.collapseAll();
2037
+ } }) }));
2038
+ };
2039
+
2040
+ function VertexSceneTreeToolbar() {
2041
+ 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, {})] }) }));
2042
+ }
2043
+
2018
2044
  const VertexSceneTree = (_a) => {
2019
2045
  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"]);
2020
2046
  const config = recoil.useRecoilValue(sdkConfig);
@@ -2054,7 +2080,7 @@ const VertexSceneTree = (_a) => {
2054
2080
  var _a;
2055
2081
  const providedRowData = (_a = rowData === null || rowData === void 0 ? void 0 : rowData(row)) !== null && _a !== void 0 ? _a : {};
2056
2082
  return Object.assign({ handleExpansion: wrappedExpansionHandler, handleSelection: wrappedSelectionHandler, handleVisibility: wrappedVisibilityHandler }, providedRowData);
2057
- } }, sdkProps, { children: [jsxRuntime.jsx(VertexSceneTreeTableLayout, {}), children] })));
2083
+ } }, sdkProps, { children: [jsxRuntime.jsx(VertexSceneTreeToolbar, {}), jsxRuntime.jsx(VertexSceneTreeTableLayout, {}), children] })));
2058
2084
  };
2059
2085
 
2060
2086
  const useSynchronizedProp = (state, value) => {
@@ -2375,6 +2401,19 @@ const VertexToolbar = ({ children }) => {
2375
2401
  return (jsxRuntime.jsx(viewerReact.VertexViewerToolbar, { placement: 'bottom-center', children: hasDefinedChildren ? (jsxRuntime.jsx(viewerReact.VertexViewerToolbarGroup, { className: "p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95", children: children })) : (jsxRuntime.jsx(DefaultToolbar, {})) }));
2376
2402
  };
2377
2403
 
2404
+ const VertexViewerSceneReset = ({ onReset }) => {
2405
+ const crossSectioningActions = useCrossSectioningActions();
2406
+ const selectionActions = useSelectionActions();
2407
+ const viewerSceneActions = useViewerSceneActions();
2408
+ const handleReset = async () => {
2409
+ await crossSectioningActions.disable();
2410
+ selectionActions.resetSelectionState();
2411
+ onReset === null || onReset === void 0 ? void 0 : onReset();
2412
+ await viewerSceneActions.reset();
2413
+ };
2414
+ return (jsxRuntime.jsx(uiReact.VertexTooltip, { content: "Reset View", children: jsxRuntime.jsx(uiReact.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" }) }));
2415
+ };
2416
+
2378
2417
  function useViewerFrameActions() {
2379
2418
  return {
2380
2419
  frameDrawn: useActionCallback(({ set, reset, snapshot }) => async (event) => {
@@ -2409,8 +2448,15 @@ const BoxSelectionTool = () => {
2409
2448
  };
2410
2449
 
2411
2450
  const VertexViewerViewCube = (_a) => {
2412
- var { placement } = _a, sdkProps = __rest(_a, ["placement"]);
2413
- return (jsxRuntime.jsx(viewerReact.VertexViewerToolbar, { "data-testid": "view-cube-toolbar", placement: placement !== null && placement !== void 0 ? placement : 'top-right', children: jsxRuntime.jsx(viewerReact.VertexViewerViewCube, Object.assign({ className: "m-7" }, sdkProps)) }));
2451
+ var { placement, children } = _a, sdkProps = __rest(_a, ["placement", "children"]);
2452
+ const childrenAsArray = Array.isArray(children)
2453
+ ? children
2454
+ : [children];
2455
+ const definedChildrenWithoutViewCube = childrenAsArray
2456
+ .filter((c) => !React.isValidElement(c) || c.type !== viewerReact.VertexViewerViewCube)
2457
+ .filter((c) => c != null && c !== false);
2458
+ const viewCube = childrenAsArray.find((c) => React.isValidElement(c) && c.type === viewerReact.VertexViewerViewCube);
2459
+ return (jsxRuntime.jsxs(viewerReact.VertexViewerToolbar, { direction: "vertical", "data-testid": "view-cube-toolbar", placement: placement !== null && placement !== void 0 ? placement : 'top-right', children: [viewCube !== null && viewCube !== void 0 ? viewCube : jsxRuntime.jsx(viewerReact.VertexViewerViewCube, Object.assign({ className: "m-7" }, sdkProps)), definedChildrenWithoutViewCube.length === 0 ? (jsxRuntime.jsx("div", { className: "flex items-center justify-center mt-3", children: jsxRuntime.jsx(VertexViewerSceneReset, {}) })) : (jsxRuntime.jsx("div", { className: "mt-3", children: definedChildrenWithoutViewCube }))] }));
2414
2460
  };
2415
2461
 
2416
2462
  const VertexViewer = (_a) => {
@@ -2518,6 +2564,7 @@ exports.VertexToolbar = VertexToolbar;
2518
2564
  exports.VertexViewer = VertexViewer;
2519
2565
  exports.VertexViewerContextMenu = VertexViewerContextMenu;
2520
2566
  exports.VertexViewerCrossSectionButton = VertexViewerCrossSectionButton;
2567
+ exports.VertexViewerSceneReset = VertexViewerSceneReset;
2521
2568
  exports.VertexViewerToolbarDivider = VertexViewerToolbarDivider;
2522
2569
  exports.VertexViewerToolkitRoot = VertexViewerToolkitRoot;
2523
2570
  exports.VertexViewerViewCube = VertexViewerViewCube;