mirror of
https://github.com/penpot/penpot.git
synced 2025-03-28 15:41:25 -05:00
⚡ Add minor performance enhancement for inside-layout?
helper
This commit is contained in:
parent
6fe85465a1
commit
d2059475f0
1 changed files with 8 additions and 7 deletions
|
@ -267,20 +267,21 @@
|
|||
(defn inside-layout?
|
||||
"Check if the shape is inside a layout"
|
||||
[objects shape]
|
||||
|
||||
(loop [current-id (:id shape)]
|
||||
(let [current (get objects current-id)]
|
||||
(loop [current-id (dm/get-prop shape :id)]
|
||||
(let [current (get objects current-id)
|
||||
parent-id (dm/get-prop current :parent-id)]
|
||||
(cond
|
||||
(or (nil? current) (= current-id (:parent-id current)))
|
||||
(or (nil? current) (= current-id parent-id))
|
||||
false
|
||||
|
||||
(= :frame (:type current))
|
||||
(cfh/frame-shape? current-id)
|
||||
(:layout current)
|
||||
|
||||
:else
|
||||
(recur (:parent-id current))))))
|
||||
(recur parent-id)))))
|
||||
|
||||
(defn wrap? [{:keys [layout-wrap-type]}]
|
||||
(defn wrap?
|
||||
[{:keys [layout-wrap-type]}]
|
||||
(= layout-wrap-type :wrap))
|
||||
|
||||
(defn fill-width?
|
||||
|
|
Loading…
Add table
Reference in a new issue