mirror of
https://github.com/penpot/penpot.git
synced 2025-08-02 17:38:34 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
a055a31286
46 changed files with 756 additions and 620 deletions
|
@ -41,6 +41,5 @@
|
|||
|
||||
(defn is-in-focus?
|
||||
[objects focus id]
|
||||
(d/seek
|
||||
#(contains? focus %)
|
||||
(cph/get-parents-seq objects id)))
|
||||
(d/seek (partial contains? focus)
|
||||
(cons id (cph/get-parent-ids objects id))))
|
||||
|
|
|
@ -79,16 +79,6 @@
|
|||
[objects id]
|
||||
(-> objects (get id) :parent-id))
|
||||
|
||||
(defn get-parents-seq
|
||||
[objects shape-id]
|
||||
|
||||
(cond
|
||||
(nil? shape-id)
|
||||
nil
|
||||
|
||||
:else
|
||||
(lazy-seq (cons shape-id (get-parents-seq objects (get-in objects [shape-id :parent-id]))))))
|
||||
|
||||
(defn get-parent-ids
|
||||
"Returns a vector of parents of the specified shape."
|
||||
[objects shape-id]
|
||||
|
@ -430,7 +420,7 @@
|
|||
|
||||
(defn is-child?
|
||||
[objects parent-id candidate-child-id]
|
||||
(let [parents (get-parents-seq objects candidate-child-id)]
|
||||
(let [parents (get-parent-ids objects candidate-child-id)]
|
||||
(some? (d/seek #(= % parent-id) parents))))
|
||||
|
||||
(defn reduce-objects
|
||||
|
@ -470,10 +460,9 @@
|
|||
|
||||
(defn get-shape-id-root-frame
|
||||
[objects shape-id]
|
||||
(->> (get-parents-seq objects shape-id)
|
||||
(->> (get-parent-ids objects shape-id)
|
||||
(cons shape-id)
|
||||
(map (d/getf objects))
|
||||
(d/seek #(and (= :frame (:type %))
|
||||
(= uuid/zero (:frame-id %))))
|
||||
|
||||
(d/seek root-frame?)
|
||||
:id))
|
||||
|
||||
|
|
|
@ -132,8 +132,8 @@
|
|||
(defn get-base
|
||||
[objects id-a id-b]
|
||||
|
||||
(let [parents-a (reverse (cph/get-parents-seq objects id-a))
|
||||
parents-b (reverse (cph/get-parents-seq objects id-b))
|
||||
(let [parents-a (reverse (cons id-a (cph/get-parent-ids objects id-a)))
|
||||
parents-b (reverse (cons id-b (cph/get-parent-ids objects id-b)))
|
||||
|
||||
[base base-child-a base-child-b]
|
||||
(loop [parents-a (rest parents-a)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue