mirror of
https://github.com/penpot/penpot.git
synced 2025-08-04 05:48:27 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
24a56f029a
10 changed files with 98 additions and 61 deletions
|
@ -151,23 +151,18 @@
|
|||
"Check if `parent-candidate` is parent of `shape-id`"
|
||||
[objects shape-id parent-candidate]
|
||||
|
||||
(loop [current (get objects parent-candidate)
|
||||
done #{}
|
||||
pending (:shapes current)]
|
||||
|
||||
(loop [current-id shape-id]
|
||||
(cond
|
||||
(contains? done (:id current))
|
||||
(recur (get objects (first pending))
|
||||
done
|
||||
(rest pending))
|
||||
(= current-id parent-candidate)
|
||||
true
|
||||
|
||||
(empty? pending) false
|
||||
(and current (contains? (set (:shapes current)) shape-id)) true
|
||||
(or (nil? current-id)
|
||||
(= current-id uuid/zero)
|
||||
(= current-id (get-in objects [current-id :parent-id])))
|
||||
false
|
||||
|
||||
:else
|
||||
(recur (get objects (first pending))
|
||||
(conj done (:id current))
|
||||
(concat (rest pending) (:shapes current))))))
|
||||
(recur (get-in objects [current-id :parent-id])))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; COMPONENTS HELPERS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue