diff --git a/src/uxbox/main/ui/shapes/icon.cljs b/src/uxbox/main/ui/shapes/icon.cljs index 5fe5dd44fa..42af6777c1 100644 --- a/src/uxbox/main/ui/shapes/icon.cljs +++ b/src/uxbox/main/ui/shapes/icon.cljs @@ -13,6 +13,7 @@ ;; --- Icon Component (declare icon-shape) +(declare icon-raw-shape) (mx/defc icon-component {:mixins [mx/static mx/reactive]} @@ -24,18 +25,44 @@ :on-mouse-down on-mouse-down} (icon-shape shape identity)])) +(mx/defc icon-raw-component + {:mixins [mx/static mx/reactive]} + [{:keys [id] :as shape}] + (let [selected (mx/react common/selected-ref) + selected? (contains? selected id) + on-mouse-down #(common/on-mouse-down % shape selected)] + [:g.shape {:class (when selected? "selected") + :on-mouse-down on-mouse-down} + (icon-raw-shape shape identity)])) + ;; --- Icon Shape (mx/defc icon-shape {:mixins [mx/static]} [{:keys [data id] :as shape} factory] - (let [key (str "shape-" id) + (let [key (str "shape-icon-" id) rfm (geom/transformation-matrix shape) attrs (merge {:id key :key key :transform (str rfm)} (attrs/extract-style-attrs shape) (attrs/make-debug-attrs shape))] [:g attrs data])) +(mx/defc icon-raw-shape + {:mixins [mx/static]} + [{:keys [x1 y1 content id metadata] :as shape} factory] + (let [key (str "shape-icon-raw-" id) + ;; rfm (geom/transformation-matrix shape) + view-box (apply str (interpose " " (:view-box metadata))) + size (geom/size shape) + attrs (merge {:id key :key key ;; :transform (str rfm) + :x x1 :y y1 :view-box view-box + :preserve-aspect-ratio "none" + :dangerouslySetInnerHTML {:__html content}} + size + (attrs/extract-style-attrs shape) + (attrs/make-debug-attrs shape))] + [:svg attrs])) + ;; --- Icon SVG (mx/defc icon-svg