Add rotatation transformation for rect and circles.

This commit is contained in:
Andrey Antukh 2016-02-19 21:53:25 +02:00
parent 6d980893b9
commit 52f52a5d40
3 changed files with 22 additions and 7 deletions

View file

@ -70,9 +70,10 @@
(defmethod sh/-render :builtin/circle
[{:keys [id] :as shape}]
(let [key (str id)
rfm (sh/-transformation shape)
props (select-keys shape [:cx :cy :rx :ry])
attrs (-> (extract-style-attrs shape)
(merge {:id key :key key})
(merge {:id key :key key :transform (str rfm)})
(merge props))]
(html
[:ellipse attrs])))
@ -80,8 +81,9 @@
(defmethod sh/-render :builtin/rect
[{:keys [id x1 y1 x2 y2] :as shape}]
(let [key (str id)
props {:x x1 :y y1 :id key :key key}
rfm (sh/-transformation shape)
size (sh/-size shape)
props {:x x1 :y y1 :id key :key key :transform (str rfm)}
attrs (-> (extract-style-attrs shape)
(merge props size))]
(html

View file

@ -102,7 +102,7 @@
(mx/component
{:render shape-render
:name "shape"
:mixins [(mx/local {}) rum/reactive mx/static]}))
:mixins [(mx/local {}) rum/reactive]}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Canvas