From 181064b2c6491ba0f6997993d8602cd6d84ddd56 Mon Sep 17 00:00:00 2001 From: Federico Ruggi <1081051+ruggi@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:57:41 +0200 Subject: [PATCH] Fix jumpy group children during resize (#4226) --- .../push-intended-bounds-and-update-groups-command.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/editor/src/components/canvas/commands/push-intended-bounds-and-update-groups-command.ts b/editor/src/components/canvas/commands/push-intended-bounds-and-update-groups-command.ts index b62f1602d26b..601f9223771c 100644 --- a/editor/src/components/canvas/commands/push-intended-bounds-and-update-groups-command.ts +++ b/editor/src/components/canvas/commands/push-intended-bounds-and-update-groups-command.ts @@ -222,18 +222,19 @@ function getUpdateResizedGroupChildrenCommands( continue } - let constraints: Array = - editor.allElementProps[EP.toString(child)]?.['data-constraints'] ?? [] + let constraints: Set = 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') } } @@ -243,7 +244,7 @@ function getUpdateResizedGroupChildrenCommands( updatedGroupBounds, childrenBounds, rectangleToSixFramePoints(currentLocalFrame, childrenBounds), - constraints, + Array.from(constraints), ), )