mirror of
https://github.com/penpot/penpot.git
synced 2025-07-18 00:17:11 +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 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 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 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)
|
## 2.6.2 (Unreleased)
|
||||||
|
|
||||||
|
|
|
@ -216,10 +216,12 @@
|
||||||
"Generate changes to create a new instance from a component."
|
"Generate changes to create a new instance from a component."
|
||||||
([changes objects file-id component-id position page libraries]
|
([changes objects file-id component-id position page libraries]
|
||||||
(generate-instantiate-component changes objects file-id component-id position page libraries nil nil nil {}))
|
(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 params]
|
||||||
([changes objects file-id component-id position page libraries old-id parent-id frame-id
|
(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?]
|
{:keys [force-frame?]
|
||||||
:or {force-frame? false}}]
|
:or {force-frame? false}}]
|
||||||
|
|
||||||
(let [component (ctf/get-component libraries file-id component-id)
|
(let [component (ctf/get-component libraries file-id component-id)
|
||||||
library (get libraries file-id)
|
library (get libraries file-id)
|
||||||
parent (when parent-id (get objects parent-id))
|
parent (when parent-id (get objects parent-id))
|
||||||
|
@ -239,6 +241,9 @@
|
||||||
(:data library)
|
(:data library)
|
||||||
position
|
position
|
||||||
(cond-> {}
|
(cond-> {}
|
||||||
|
(contains? ids-map old-id)
|
||||||
|
(assoc :force-id (get ids-map old-id))
|
||||||
|
|
||||||
force-frame?
|
force-frame?
|
||||||
(assoc :force-frame-id frame-id)))
|
(assoc :force-frame-id frame-id)))
|
||||||
|
|
||||||
|
@ -260,8 +265,11 @@
|
||||||
(cond-> (pcb/add-object changes first-shape {:ignore-touched true})
|
(cond-> (pcb/add-object changes first-shape {:ignore-touched true})
|
||||||
(some? old-id) (pcb/amend-last-change #(assoc % :old-id old-id)))
|
(some? old-id) (pcb/amend-last-change #(assoc % :old-id old-id)))
|
||||||
|
|
||||||
|
duplicated-parent?
|
||||||
|
(->> ids-map vals (some #(= % (:parent-id first-shape))))
|
||||||
|
|
||||||
changes
|
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)
|
(let [target-cell (-> position meta :cell)
|
||||||
|
|
||||||
[row column]
|
[row column]
|
||||||
|
@ -2234,6 +2242,7 @@
|
||||||
main-id
|
main-id
|
||||||
parent-id
|
parent-id
|
||||||
frame-id
|
frame-id
|
||||||
|
ids-map
|
||||||
{})))]
|
{})))]
|
||||||
changes))
|
changes))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue