From 23baa32879511dae94c54223752d9673ebf944c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Fri, 23 Dec 2016 12:50:36 +0100 Subject: [PATCH] Improved hack for defcs macro --- .../main/ui/workspace/sidebar/layers.cljs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/frontend/src/uxbox/main/ui/workspace/sidebar/layers.cljs b/frontend/src/uxbox/main/ui/workspace/sidebar/layers.cljs index f67b5f36d..549d6068c 100644 --- a/frontend/src/uxbox/main/ui/workspace/sidebar/layers.cljs +++ b/frontend/src/uxbox/main/ui/workspace/sidebar/layers.cljs @@ -193,6 +193,14 @@ [:div.element-icon (element-icon item)] (shape-name item)]]))) + +;; TODO: Fix this temporary hack (Looks like a problem in defcs macro) +(declare layer-group) +(mx/defc defcs-macro-hack + {:mixins [mx/static mx/reactive (mx/local)]} + [shape selected] + (layer-group shape selected)) + ;; --- Layer Group (Component) (mx/defcs layer-group @@ -202,14 +210,11 @@ selected? (contains? selected (:id item)) collapsed? (:collapsed item true) shapes-map (mx/react wb/shapes-by-id-ref) - ;; TODO: Fix this temporary hack (Looks like a problem in defcs macro) - classes (if (nil? own) - (classnames :selected selected?) - (classnames - :selected selected? - :drag-top (= :top (:over @local)) - :drag-bottom (= :bottom (:over @local)) - :drag-inside (= :middle (:over @local)))) + classes (classnames + :selected selected? + :drag-top (= :top (:over @local)) + :drag-bottom (= :bottom (:over @local)) + :drag-inside (= :middle (:over @local))) select #(select-shape selected item %) toggle-visibility #(toggle-visibility selected item %) toggle-blocking #(toggle-blocking item %)] @@ -284,7 +289,7 @@ :let [key (str (:id shape))]] (if (= (:type shape) :group) ;; TODO: Fix this temporary hack (Looks like a problem in defcs macro) - (-> (layer-group nil shape selected) + (-> (defcs-macro-hack shape selected) (mx/with-key key)) (-> (layer-simple shape selected) (mx/with-key key))))])])))