fix: incorrect scaling due to ignoring bound text when finding selection bounds

This commit is contained in:
Alex Kim 2023-04-21 16:27:25 +05:00
parent bbaa1be1df
commit f4d21c26f5
No known key found for this signature in database
GPG key ID: CEE74CFA44D238D7

View file

@ -632,8 +632,17 @@ export const resizeMultipleElements = (
[], [],
); );
// getCommonBoundingBox() uses getBoundTextElement() which returns null for
// original elements from pointerDownState, so we have to find and add these
// bound text elements manually
const boundTextElements = targetElements
.map(({ orig }) => getBoundTextElementId(orig))
.filter((id): id is string => typeof id === "string")
.map((id) => pointerDownState.originalElements.get(id) ?? null)
.filter(isBoundToContainer);
const { minX, minY, maxX, maxY, midX, midY } = getCommonBoundingBox( const { minX, minY, maxX, maxY, midX, midY } = getCommonBoundingBox(
targetElements.map(({ orig }) => orig), targetElements.map(({ orig }) => orig).concat(boundTextElements),
); );
const direction = transformHandleType; const direction = transformHandleType;