🐛 Fix you can add a rect into a variant container (#7137)

This commit is contained in:
Pablo Alba 2025-08-18 13:02:27 +02:00 committed by GitHub
parent 7c39e321c4
commit f7a0c4139a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 9 deletions

View File

@ -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?

View File

@ -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)

View File

@ -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)

View File

@ -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))]

View File

@ -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