Skip to content

Commit 5322f9e

Browse files
committed
show brush circle
1 parent b59f32c commit 5322f9e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/renderer/tool/draw/brush.cljs

+16
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
(assoc :cursor "crosshair")
4343
(h/set-message [:div "Click and drag to draw."])))
4444

45+
(defmethod tool/deactivate :measure
46+
[db]
47+
(element.h/clear-temp db))
48+
4549
(defonce options
4650
[::size ::thinning ::smoothing ::streamline])
4751

@@ -82,6 +86,18 @@
8286
[]
8387
"How much to streamline the stroke.")
8488

89+
(defmethod tool/pointer-move :brush
90+
[{:keys [adjusted-pointer-pos] :as db} {:keys [pressure]}]
91+
(let [[x y] adjusted-pointer-pos
92+
r (* (/ 16 2) (if (zero? pressure) 1 pressure))
93+
stroke (get-in db [:documents (:active-document db) :stroke])]
94+
(element.h/set-temp db {:type :element
95+
:tag :circle
96+
:attrs {:cx x
97+
:cy y
98+
:r r
99+
:fill stroke}})))
100+
85101
(defmethod tool/drag :brush
86102
[{:keys [active-document
87103
adjusted-pointer-pos] :as db} {:keys [pressure]}]

0 commit comments

Comments
 (0)