Convert rect-shape component to use new defc macro.

This commit is contained in:
Andrey Antukh 2016-07-09 21:31:17 +03:00
parent 9b078e19a8
commit 6d82194f9f
No known key found for this signature in database
GPG Key ID: 4DFEBCB8316A8B95

View File

@ -9,7 +9,7 @@
[rum.core :as rum] [rum.core :as rum]
[uxbox.main.ui.shapes.common :as common] [uxbox.main.ui.shapes.common :as common]
[uxbox.main.ui.shapes.attrs :as attrs] [uxbox.main.ui.shapes.attrs :as attrs]
[uxbox.util.mixins :as mx] [uxbox.util.mixins :as mx :include-macros true]
[uxbox.main.geom :as geom] [uxbox.main.geom :as geom]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))
@ -38,19 +38,12 @@
;; --- Rect Shape ;; --- Rect Shape
(defn- rect-shape-render (mx/defc rect-shape
[own {:keys [id x1 y1 x2 y2] :as shape}] [{:keys [id x1 y1 x2 y2] :as shape}]
(let [key (str id) (let [key (str id)
rfm (geom/transformation-matrix shape) rfm (geom/transformation-matrix shape)
size (geom/size shape) size (geom/size shape)
props {:x x1 :y y1 :id key :key key :transform (str rfm)} props {:x x1 :y y1 :id key :key key :transform (str rfm)}
attrs (-> (attrs/extract-style-attrs shape) attrs (-> (attrs/extract-style-attrs shape)
(merge props size))] (merge props size))]
(html [:rect attrs]))
[:rect attrs])))
(def rect-shape
(mx/component
{:render rect-shape-render
:name "rect-shape"
:mixins [mx/static]}))