diff --git a/src/components/canvas/groups/Group.ts b/src/components/canvas/groups/Group.ts index 43684c40..d657d365 100644 --- a/src/components/canvas/groups/Group.ts +++ b/src/components/canvas/groups/Group.ts @@ -115,15 +115,18 @@ export class Group extends GraphComponent { - event.stopPropagation(); - this.groupState.setSelection( - true, - !isMetaKeyEvent(event as MouseEvent | KeyboardEvent) ? ESelectionStrategy.REPLACE : ESelectionStrategy.APPEND - ); - }); + this.addEventListener("click", this.handleClick); } + protected handleClick = (event: MouseEvent) => { + event.stopPropagation(); + const isMeta = isMetaKeyEvent(event); + this.groupState.setSelection( + !isMeta ? true : !this.groupState.$selected.value, + !isMeta ? ESelectionStrategy.REPLACE : ESelectionStrategy.APPEND + ); + }; + /** * Set the highlighted state of the group */