From e36dce372a5750a0abe43c49f48dad78dbd70562 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 19 Jan 2024 09:52:33 +0100 Subject: [PATCH] :bug: Make create component children scale --- common/src/app/common/files/libraries_helpers.cljc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/src/app/common/files/libraries_helpers.cljc b/common/src/app/common/files/libraries_helpers.cljc index cf4b637c4..bd750dee5 100644 --- a/common/src/app/common/files/libraries_helpers.cljc +++ b/common/src/app/common/files/libraries_helpers.cljc @@ -39,6 +39,7 @@ [it shapes objects page-id file-id components-v2 prepare-create-group prepare-create-board] (let [changes (pcb/empty-changes it page-id) + from-singe-frame? (and (= 1 (count shapes)) (-> shapes first cfh/frame-shape?)) [root changes old-root-ids] (if (and (= (count shapes) 1) (or (and (= (:type (first shapes)) :group) (not components-v2)) @@ -72,6 +73,15 @@ [root changes (map :id shapes)])) + changes + (cond-> changes + (not from-singe-frame?) + (pcb/update-shapes + (:shapes root) + (fn [shape] + (-> shape + (assoc :constraints-h :scale :constraints-v :scale))))) + objects' (assoc objects (:id root) root) [root-shape changes] (generate-add-component-changes changes root objects' file-id page-id components-v2)