mirror of
https://github.com/penpot/penpot.git
synced 2025-07-17 18:17:14 +02:00
🐛 Fix problem when duplicating grid layout (#6426)
This commit is contained in:
parent
7e6a621484
commit
9be569c54c
2 changed files with 13 additions and 3 deletions
|
@ -43,6 +43,7 @@
|
|||
- Fix Out of Sync Token Value & Color Picker [Github #102](https://github.com/tokens-studio/penpot/issues/102)
|
||||
- Fix Color should preserve color space [Github #69](https://github.com/tokens-studio/penpot/issues/69)
|
||||
- Fix cannot rename Design Token Sets when group of same name exists [Taiga Issue #10773](https://tree.taiga.io/project/penpot/issue/10773)
|
||||
- Fix problem when duplicating grid layout [Github #6391](https://github.com/penpot/penpot/issues/6391)
|
||||
|
||||
## 2.6.2 (Unreleased)
|
||||
|
||||
|
|
|
@ -216,10 +216,12 @@
|
|||
"Generate changes to create a new instance from a component."
|
||||
([changes objects file-id component-id position page libraries]
|
||||
(generate-instantiate-component changes objects file-id component-id position page libraries nil nil nil {}))
|
||||
|
||||
([changes objects file-id component-id position page libraries old-id parent-id frame-id
|
||||
([changes objects file-id component-id position page libraries old-id parent-id frame-id params]
|
||||
(generate-instantiate-component changes objects file-id component-id position page libraries old-id parent-id frame-id {} params))
|
||||
([changes objects file-id component-id position page libraries old-id parent-id frame-id ids-map
|
||||
{:keys [force-frame?]
|
||||
:or {force-frame? false}}]
|
||||
|
||||
(let [component (ctf/get-component libraries file-id component-id)
|
||||
library (get libraries file-id)
|
||||
parent (when parent-id (get objects parent-id))
|
||||
|
@ -239,6 +241,9 @@
|
|||
(:data library)
|
||||
position
|
||||
(cond-> {}
|
||||
(contains? ids-map old-id)
|
||||
(assoc :force-id (get ids-map old-id))
|
||||
|
||||
force-frame?
|
||||
(assoc :force-frame-id frame-id)))
|
||||
|
||||
|
@ -260,8 +265,11 @@
|
|||
(cond-> (pcb/add-object changes first-shape {:ignore-touched true})
|
||||
(some? old-id) (pcb/amend-last-change #(assoc % :old-id old-id)))
|
||||
|
||||
duplicated-parent?
|
||||
(->> ids-map vals (some #(= % (:parent-id first-shape))))
|
||||
|
||||
changes
|
||||
(if (ctl/grid-layout? objects (:parent-id first-shape))
|
||||
(if (and (ctl/grid-layout? objects (:parent-id first-shape)) (not duplicated-parent?))
|
||||
(let [target-cell (-> position meta :cell)
|
||||
|
||||
[row column]
|
||||
|
@ -2234,6 +2242,7 @@
|
|||
main-id
|
||||
parent-id
|
||||
frame-id
|
||||
ids-map
|
||||
{})))]
|
||||
changes))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue