Skip to content

Commit

Permalink
Fix jumpy group children during resize (#4226)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruggi authored Sep 22, 2023
1 parent e6d1026 commit 181064b
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,19 @@ function getUpdateResizedGroupChildrenCommands(
continue
}

let constraints: Array<keyof FrameWithAllPoints> =
editor.allElementProps[EP.toString(child)]?.['data-constraints'] ?? []
let constraints: Set<keyof FrameWithAllPoints> = new Set(
editor.allElementProps[EP.toString(child)]?.['data-constraints'] ?? [],
)

const elementMetadata = MetadataUtils.findElementByElementPath(editor.jsxMetadata, child)

const jsxElement = MetadataUtils.getJSXElementFromMetadata(editor.jsxMetadata, child)
if (jsxElement != null) {
if (isHugFromStyleAttribute(jsxElement.props, 'width')) {
constraints.push('width')
constraints.add('width')
}
if (isHugFromStyleAttribute(jsxElement.props, 'height')) {
constraints.push('height')
constraints.add('height')
}
}

Expand All @@ -243,7 +244,7 @@ function getUpdateResizedGroupChildrenCommands(
updatedGroupBounds,
childrenBounds,
rectangleToSixFramePoints(currentLocalFrame, childrenBounds),
constraints,
Array.from(constraints),
),
)

Expand Down

0 comments on commit 181064b

Please sign in to comment.