mirror of
https://github.com/penpot/penpot.git
synced 2025-08-04 06:38:27 +02:00
Merge remote-tracking branch 'origin/bugfixing' into staging
This commit is contained in:
commit
ae1d5667cc
11 changed files with 137 additions and 108 deletions
|
@ -187,16 +187,18 @@
|
|||
(defn clean-loops
|
||||
"Clean a list of ids from circular references."
|
||||
[objects ids]
|
||||
(loop [ids ids
|
||||
id (first ids)
|
||||
others (rest ids)]
|
||||
(if-not id
|
||||
ids
|
||||
(recur (cond-> ids
|
||||
(some #(contains? ids %) (get-parents id objects))
|
||||
(disj id))
|
||||
(first others)
|
||||
(rest others)))))
|
||||
(let [parent-selected?
|
||||
(fn [id]
|
||||
(let [parents (get-parents id objects)]
|
||||
(some ids parents)))
|
||||
|
||||
add-element
|
||||
(fn [result id]
|
||||
(cond-> result
|
||||
(not (parent-selected? id))
|
||||
(conj id)))]
|
||||
|
||||
(reduce add-element (d/ordered-set) ids)))
|
||||
|
||||
(defn calculate-invalid-targets
|
||||
[shape-id objects]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue