diff --git a/common/src/app/common/files/helpers.cljc b/common/src/app/common/files/helpers.cljc index 296d4da83..5b31328e6 100644 --- a/common/src/app/common/files/helpers.cljc +++ b/common/src/app/common/files/helpers.cljc @@ -12,7 +12,6 @@ [app.common.schema :as sm] [app.common.types.components-list :as ctkl] [app.common.types.pages-list :as ctpl] - [app.common.types.shape.layout :as ctl] [app.common.uuid :as uuid] [clojure.set :as set] [cuerdas.core :as str])) @@ -741,22 +740,6 @@ (d/seek root-frame?) :id)) -(defn comparator-layout-z-index - [[idx-a child-a] [idx-b child-b]] - (cond - (> (ctl/layout-z-index child-a) (ctl/layout-z-index child-b)) 1 - (< (ctl/layout-z-index child-a) (ctl/layout-z-index child-b)) -1 - (< idx-a idx-b) 1 - (> idx-a idx-b) -1 - :else 0)) - -(defn sort-layout-children-z-index - [children] - (->> children - (d/enumerate) - (sort comparator-layout-z-index) - (mapv second))) - (defn common-parent-frame "Search for the common frame for the selected shapes. Otherwise returns the root frame" [objects selected] diff --git a/common/src/app/common/types/shape/layout.cljc b/common/src/app/common/types/shape/layout.cljc index 7c60ad412..b65f7b83b 100644 --- a/common/src/app/common/types/shape/layout.cljc +++ b/common/src/app/common/types/shape/layout.cljc @@ -536,6 +536,22 @@ ([shape] (or (:layout-item-z-index shape) 0))) +(defn- comparator-layout-z-index + [[idx-a child-a] [idx-b child-b]] + (cond + (> (layout-z-index child-a) (layout-z-index child-b)) 1 + (< (layout-z-index child-a) (layout-z-index child-b)) -1 + (< idx-a idx-b) 1 + (> idx-a idx-b) -1 + :else 0)) + +(defn sort-layout-children-z-index + [children] + (->> children + (d/enumerate) + (sort comparator-layout-z-index) + (mapv second))) + (defn change-h-sizing? [frame-id objects children-ids] (and (flex-layout? objects frame-id) diff --git a/frontend/src/app/main/ui/shapes/frame.cljs b/frontend/src/app/main/ui/shapes/frame.cljs index 705ce3233..64bd709f9 100644 --- a/frontend/src/app/main/ui/shapes/frame.cljs +++ b/frontend/src/app/main/ui/shapes/frame.cljs @@ -168,7 +168,7 @@ childs (unchecked-get props "childs") childs (cond-> childs (ctl/any-layout? shape) - (cfh/sort-layout-children-z-index))] + (ctl/sort-layout-children-z-index))] [:> frame-container props [:g.frame-children {:opacity (:opacity shape)}