0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00

🐛 Fix swap on anidated frames

This commit is contained in:
Alejandro Alonso 2024-03-12 14:14:47 +01:00 committed by Andrés Moya
parent 355af61cda
commit 3f316ca9c9
3 changed files with 11 additions and 5 deletions

View file

@ -901,7 +901,8 @@
libraries
nil
(:parent-id shape)
(:frame-id shape))
(:frame-id shape)
{:force-frame? true})
new-shape (cond-> new-shape
(nil? (ctk/get-swap-slot new-shape))

View file

@ -152,9 +152,11 @@
(defn generate-instantiate-component
"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))
(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
{:keys [force-frame?]
:or {force-frame? false}}]
(let [component (ctf/get-component libraries file-id component-id)
parent (when parent-id (get objects parent-id))
library (get libraries file-id)
@ -166,7 +168,9 @@
component
(:data library)
position
components-v2)
components-v2
(cond-> {}
force-frame? (assoc :force-frame-id frame-id)))
first-shape (cond-> (first new-shapes)
(not (nil? parent-id))

View file

@ -443,7 +443,8 @@
libraries
(:id component-root)
parent-id
frame-id)
frame-id
{})
restore-component
#(let [restore (dwlh/prepare-restore-component changes library-data (:component-id component-root) it page delta (:id component-root) parent-id frame-id)]