Draw selection dashed-square when shape is drawing.

This commit is contained in:
Andrey Antukh 2017-02-21 19:39:01 +01:00
parent 9f9bff17e5
commit 12f40744d2
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
2 changed files with 17 additions and 8 deletions

View file

@ -36,16 +36,25 @@
(mx/defc draw-area
{:mixins [mx/static mx/reactive]}
[]
[zoom]
(when-let [shape (mx/react drawing-shape)]
(if (= (:type shape) :path)
(path-draw-area shape)
(generic-draw-area shape))))
(generic-draw-area shape zoom))))
(mx/defc generic-draw-area
[shape]
(-> (assoc shape :drawing? true)
(shapes/render-component)))
[shape zoom]
(let [{:keys [x1 y1 width height]} (geom/size shape)]
[:g
(-> (assoc shape :drawing? true)
(shapes/render-component))
[:rect.main {:x x1 :y y1
:width width
:height height
:stroke-dasharray (str (/ 5.0 zoom) "," (/ 5 zoom))
:style {:stroke "#333" :fill "transparent"
:stroke-opacity "1"}}]]))
(mx/defc path-draw-area
[{:keys [segments] :as shape}]