Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Alejandro Alonso 2022-08-30 13:09:02 +02:00
commit 24a56f029a
10 changed files with 98 additions and 61 deletions

View file

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