Skip to content

Commit

Permalink
[4330] Close the palette when clicking on a tool
Browse files Browse the repository at this point in the history
Bug: #4330
Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
  • Loading branch information
mcharfadi committed Dec 19, 2024
1 parent 15e9f50 commit dd8b3f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ This is now fixed
- https://github.com/eclipse-sirius/sirius-web/issues/4319[#4319] [view] Rename "Hide/Show Tool Section" tool section to "Show/Hide".
- https://github.com/eclipse-sirius/sirius-web/issues/4317[#4317] [sirius-web] Export `NewObjectModal`, `NewRootObjectModal`, and `NewRepresentationModal` frontend components
These components could be reused by downstream applications in custom creation tool.
- https://github.com/eclipse-sirius/sirius-web/issues/4330[#4330] [diagram] Improve responsiveness when executing a tool from the palette


== v2024.11.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { useDialog } from '../../dialog/useDialog';
import { EdgeData, NodeData } from '../DiagramRenderer.types';
import { GQLPalette, GQLSingleClickOnDiagramElementTool, GQLTool } from './Palette.types';

import { useGroupPalette } from './group-tool/useGroupPalette';
import { useDiagramElementPalette } from './useDiagramElementPalette';
import { useDiagramPalette } from './useDiagramPalette';
import {
GQLCollapsingState,
Expand Down Expand Up @@ -196,6 +198,16 @@ export const usePalette = ({
}
);

const { hideDiagramPalette } = useDiagramPalette();
const { hideDiagramElementPalette } = useDiagramElementPalette();
const { hideGroupPalette } = useGroupPalette();

const closeAllPalettes = useCallback(() => {
hideDiagramPalette();
hideDiagramElementPalette();
hideGroupPalette();
}, [hideDiagramPalette, hideDiagramElementPalette, hideGroupPalette]);

const description: GQLRepresentationDescription | undefined =
paletteData?.viewer.editingContext.representation.description;
const palette: GQLPalette | null = description && isDiagramDescription(description) ? description.palette : null;
Expand Down Expand Up @@ -315,6 +327,7 @@ export const usePalette = ({
const { setLastToolInvoked } = useDiagramPalette();

const handleToolClick = (tool: GQLTool) => {
closeAllPalettes();
switch (tool.id) {
case 'edit':
onDirectEditClick();
Expand Down

0 comments on commit dd8b3f4

Please sign in to comment.