0
Fork 0
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:
Andrey Antukh 2024-03-05 10:58:10 +01:00
parent 6fe85465a1
commit d2059475f0

View file

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