🐛 Fix problem ordering layers in html markup

This commit is contained in:
alonso.torres 2024-04-04 16:11:59 +02:00 committed by Andrés Moya
parent b1e226cdc6
commit e420be5e51
3 changed files with 19 additions and 14 deletions

View file

@ -168,9 +168,10 @@
[props]
(let [shape (unchecked-get props "shape")
childs (unchecked-get props "childs")
reverse? (and (ctl/flex-layout? shape) (ctl/reverse? shape))
childs (cond-> childs
(ctl/any-layout? shape)
(ctl/sort-layout-children-z-index))]
(ctl/sort-layout-children-z-index reverse?))]
[:> frame-container props
[:g.frame-children

View file

@ -25,7 +25,6 @@
([objects shape level]
(when (and (some? shape) (some? (:selrect shape)))
(let [indent (str/repeat " " level)
maybe-reverse (if (ctl/any-layout? shape) reverse identity)
shape-html
(cond
@ -65,15 +64,18 @@
indent)
:else
(dm/fmt "%<div class=\"%\">\n%\n%</div>"
indent
(dm/str (d/name (:type shape)) " "
(cgc/shape->selector shape))
(->> (:shapes shape)
(maybe-reverse)
(map #(generate-html objects (get objects %) (inc level)))
(str/join "\n"))
indent))
(let [children (->> shape :shapes (map #(get objects %)))
reverse? (ctl/any-layout? shape)
;; The order for layout elements is the reverse of SVG order
children (cond-> children reverse? reverse)]
(dm/fmt "%<div class=\"%\">\n%\n%</div>"
indent
(dm/str (d/name (:type shape)) " "
(cgc/shape->selector shape))
(->> children
(map #(generate-html objects % (inc level)))
(str/join "\n"))
indent)))
shape-html
(if (cgc/has-wrapper? objects shape)