Skip to content

Commit

Permalink
fix(common): return null when hover selected element #WIK-15199 (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
huanhuanwa authored Apr 19, 2024
1 parent 2a33c1c commit 2010baa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-mayflies-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@plait/core': patch
---

return null when hover selected element
9 changes: 6 additions & 3 deletions packages/core/src/utils/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,16 @@ export const getHighestSelectedElements = (board: PlaitBoard, elements?: PlaitEl
};

export const createGroupRectangleG = (board: PlaitBoard, elements: PlaitElement[]): SVGGElement | null => {
const selectedElements = getSelectedElements(board);
const groupRectangleG: SVGGElement = createG();
const selectedElementIds = getSelectedElements(board).map(item => item.id);
let groupRectangleG: SVGGElement | null = null;
const isMoving = isSelectionMoving(board);

elements.forEach(item => {
const isRender = (!selectedElements.includes(item) && !isMoving) || isMoving;
const isRender = (!selectedElementIds.includes(item.id) && !isMoving) || isMoving;
if (item.groupId && isRender) {
if (!groupRectangleG) {
groupRectangleG = createG();
}
const elements = getElementsInGroupByElement(board, item);
const rectangle = getRectangleByElements(board, elements, false);
const rectangleG = drawRectangle(board, rectangle, {
Expand Down

0 comments on commit 2010baa

Please sign in to comment.