0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

🐛 Fix problems with z-index

This commit is contained in:
alonso.torres 2024-01-08 14:43:35 +01:00 committed by Andrey Antukh
parent 790ce27316
commit c43458af1d
2 changed files with 10 additions and 4 deletions

View file

@ -211,14 +211,21 @@
;; Check which index is lower
:else
;; If the base is a layout we should check if the z-index property is set
(let [[z-index-a z-index-b]
(if (ctl/any-layout? objects base-id)
(let [layer-order? (ctl/any-layout? objects base-id)
[z-index-a z-index-b]
(if layer-order?
[(ctl/layout-z-index objects (dm/get-in objects [base-id :shapes index-a]))
(ctl/layout-z-index objects (dm/get-in objects [base-id :shapes index-b]))]
[0 0])]
(if (= z-index-a z-index-b)
(cond
(and (= z-index-a z-index-b) (not layer-order?))
(< index-a index-b)
(and (= z-index-a z-index-b) layer-order?)
(> index-a index-b)
:else
(< z-index-a z-index-b))))))
(defn sort-z-index

View file

@ -208,7 +208,6 @@
(let [objects (:objects data)
shapes (cfh/get-immediate-children objects)
dim (calculate-dimensions objects aspect-ratio)
_ (prn ">>DIM" dim)
vbox (format-viewbox dim)
bgcolor (dm/get-in data [:options :background] default-color)