mirror of
https://github.com/penpot/penpot.git
synced 2025-03-29 08:01:41 -05:00
🐛 Make create component children scale
This commit is contained in:
parent
26af5c7847
commit
e36dce372a
1 changed files with 10 additions and 0 deletions
|
@ -39,6 +39,7 @@
|
||||||
[it shapes objects page-id file-id components-v2 prepare-create-group prepare-create-board]
|
[it shapes objects page-id file-id components-v2 prepare-create-group prepare-create-board]
|
||||||
(let [changes (pcb/empty-changes it page-id)
|
(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]
|
[root changes old-root-ids]
|
||||||
(if (and (= (count shapes) 1)
|
(if (and (= (count shapes) 1)
|
||||||
(or (and (= (:type (first shapes)) :group) (not components-v2))
|
(or (and (= (:type (first shapes)) :group) (not components-v2))
|
||||||
|
@ -72,6 +73,15 @@
|
||||||
|
|
||||||
[root changes (map :id shapes)]))
|
[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)
|
objects' (assoc objects (:id root) root)
|
||||||
|
|
||||||
[root-shape changes] (generate-add-component-changes changes root objects' file-id page-id components-v2)
|
[root-shape changes] (generate-add-component-changes changes root objects' file-id page-id components-v2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue