Skip to content

Commit a54a054

Browse files
committed
Open or close all components for semantic zoom
1 parent 9c9539c commit a54a054

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/components/visualization/page-setup/sidebar/customizationbar/settings/settings.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import ResetButton from 'explorviz-frontend/src/components/visualization/page-se
3333
import FlagSetting from 'explorviz-frontend/src/components/visualization/page-setup/sidebar/customizationbar/settings/setting-type/flag-setting';
3434
import RangeSetting from 'explorviz-frontend/src/components/visualization/page-setup/sidebar/customizationbar/settings/setting-type/range-setting';
3535
import ButtonSetting from 'explorviz-frontend/src/components/visualization/page-setup/sidebar/customizationbar/settings/setting-type/button-setting';
36+
import { useShallow } from 'zustand/react/shallow';
3637

3738
interface SettingsProps {
3839
enterFullscreen(): void;
@@ -69,8 +70,18 @@ export default function Settings({
6970
const showErrorToastMessage = useToastHandlerStore(
7071
(state) => state.showErrorToastMessage
7172
);
72-
const updateApplicationLayout = useApplicationRendererStore(
73-
(state) => state.updateApplicationLayout
73+
const {
74+
closeAllComponentsOfAllApplications,
75+
openAllComponentsOfAllApplications,
76+
updateApplicationLayout,
77+
} = useApplicationRendererStore(
78+
useShallow((state) => ({
79+
closeAllComponentsOfAllApplications:
80+
state.closeAllComponentsOfAllApplications,
81+
openAllComponentsOfAllApplications:
82+
state.openAllComponentsOfAllApplications,
83+
updateApplicationLayout: state.updateApplicationLayout,
84+
}))
7485
);
7586
const updateLabels = useApplicationRendererStore(
7687
(state) => state.updateLabels
@@ -440,6 +451,9 @@ export default function Settings({
440451
SemanticZoomManager.instance.triggerLevelDecision2(undefined);
441452
break;
442453
case 'autoOpenCloseFeature':
454+
value
455+
? closeAllComponentsOfAllApplications()
456+
: openAllComponentsOfAllApplications();
443457
SemanticZoomManager.instance.toggleAutoOpenClose(value);
444458
SemanticZoomManager.instance.triggerLevelDecision2(undefined);
445459
break;

src/stores/application-renderer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ interface ApplicationRendererState {
9898
updateApplicationObject3DAfterUpdate: (
9999
applicationObject3D: ApplicationObject3D
100100
) => void;
101+
closeAllComponentsOfAllApplications: () => void;
101102
openAllComponentsOfAllApplications: () => void;
102103
toggleCommunicationRendering: () => void;
103104
openParents: (
@@ -445,6 +446,10 @@ export const useApplicationRendererStore = create<ApplicationRendererState>(
445446
useHighlightingStore.getState().updateHighlighting(); // needs to be after update links
446447
},
447448

449+
closeAllComponentsOfAllApplications: () => {
450+
get().forEachOpenApplication(get().closeAllComponentsLocally);
451+
},
452+
448453
openAllComponentsOfAllApplications: () => {
449454
get().forEachOpenApplication(get().openAllComponents);
450455
},

0 commit comments

Comments
 (0)