Skip to content

Commit

Permalink
[2604] Expand the tool section when the mouse is over
Browse files Browse the repository at this point in the history
Bug: #2604
Signed-off-by: Florian Barbin <[email protected]>
  • Loading branch information
florianbarbin authored and sbegaudeau committed Sep 12, 2024
1 parent 8195cef commit 6787ea4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

=== Improvements

- https://github.com/eclipse-sirius/sirius-web/issues/2604[#2604] [diagram] Expand a tool section when the mouse is over it


== v2024.9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export const ToolSection = ({ toolSection, onToolClick, toolSectionExpandId, onE
);
}

const onMouseEnter = () => {
if (tools.length > 1) {
onExpand(toolSection.id);
}
};

const checkLastToolInvoked = (): GQLTool | undefined => {
const lastToolInvoked = getLastToolInvoked(toolSection.id);
if (lastToolInvoked && tools.some((tool) => tool.id === lastToolInvoked.id)) {
Expand All @@ -91,7 +97,7 @@ export const ToolSection = ({ toolSection, onToolClick, toolSectionExpandId, onE
return (
<>
{defaultTool && (
<div className={classes.toolSection} data-testid={toolSection.label}>
<div className={classes.toolSection} data-testid={toolSection.label} onMouseEnter={onMouseEnter}>
<Tool tool={defaultTool} onClick={() => onToolClick(defaultTool)} thumbnail />
{caretContent}
</div>
Expand Down

0 comments on commit 6787ea4

Please sign in to comment.