mirror of
https://github.com/penpot/penpot.git
synced 2026-05-01 14:18:07 +00:00
🐛 Fix you can add a rect into a variant container (#7137)
This commit is contained in:
parent
7c39e321c4
commit
f7a0c4139a
@ -389,12 +389,13 @@
|
||||
[(remap-ids new-shape)
|
||||
(map remap-ids new-shapes)])))
|
||||
|
||||
(defn get-first-not-copy-parent
|
||||
"Go trough the parents until we find a shape that is not a copy of a component."
|
||||
(defn get-first-valid-parent
|
||||
"Go trough the parents until we find a shape that is not a copy of a component nor
|
||||
a variant container."
|
||||
[objects id]
|
||||
(let [shape (get objects id)]
|
||||
(if (ctk/in-component-copy? shape)
|
||||
(get-first-not-copy-parent objects (:parent-id shape))
|
||||
(if (or (ctk/in-component-copy? shape) (ctk/is-variant-container? shape))
|
||||
(get-first-valid-parent objects (:parent-id shape))
|
||||
shape)))
|
||||
|
||||
(defn has-any-copy-parent?
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
focus (:workspace-focus-selected state)
|
||||
|
||||
fid (->> (ctst/top-nested-frame objects initial)
|
||||
(ctn/get-first-not-copy-parent objects) ;; We don't want to change the structure of component copies
|
||||
(ctn/get-first-valid-parent objects) ;; We don't want to change the structure of component copies
|
||||
:id)
|
||||
|
||||
flex-layout? (ctl/flex-layout? objects fid)
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
position (path.segment/get-handler-point content 0 nil)
|
||||
|
||||
frame-id (->> (ctst/top-nested-frame objects position)
|
||||
(ctn/get-first-not-copy-parent objects) ;; We don't want to change the structure of component copies
|
||||
(ctn/get-first-valid-parent objects) ;; We don't want to change the structure of component copies
|
||||
:id)
|
||||
|
||||
flex-layout? (ctl/flex-layout? objects frame-id)
|
||||
|
||||
@ -286,7 +286,7 @@
|
||||
(gpt/point))
|
||||
|
||||
frame-id (->> (ctst/top-nested-frame objects position)
|
||||
(ctn/get-first-not-copy-parent objects) ;; We don't want to change the structure of component copies
|
||||
(ctn/get-first-valid-parent objects) ;; We don't want to change the structure of component copies
|
||||
:id)
|
||||
flex-layout? (ctl/flex-layout? objects frame-id)
|
||||
drop-index (when flex-layout? (gsl/get-drop-index frame-id objects position))]
|
||||
|
||||
@ -232,8 +232,8 @@
|
||||
(:parent-id base))
|
||||
|
||||
;; If the parent-id or the frame-id are component-copies, we need to get the first not copy parent
|
||||
parent-id (:id (ctn/get-first-not-copy-parent objects parent-id)) ;; We don't want to change the structure of component copies
|
||||
frame-id (:id (ctn/get-first-not-copy-parent objects frame-id))
|
||||
parent-id (:id (ctn/get-first-valid-parent objects parent-id)) ;; We don't want to change the structure of component copies
|
||||
frame-id (:id (ctn/get-first-valid-parent objects frame-id))
|
||||
|
||||
|
||||
shape (cts/setup-shape
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user