mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 21:11:38 +02:00
Minor code cleaning on assisted path drawing code.
This commit is contained in:
parent
547faa16a9
commit
e95c1c76c0
1 changed files with 15 additions and 9 deletions
|
@ -176,18 +176,24 @@
|
||||||
(swap! counter inc)
|
(swap! counter inc)
|
||||||
(reset! drawing-shape shape)))
|
(reset! drawing-shape shape)))
|
||||||
|
|
||||||
(on-draw [[point ctrl?]]
|
(on-assisted-draw [point]
|
||||||
(if ctrl?
|
|
||||||
(let [center (get-in @drawing-shape [:points (dec @counter)])
|
(let [center (get-in @drawing-shape [:points (dec @counter)])
|
||||||
point (as-> point $
|
point (as-> point $
|
||||||
(gpt/subtract $ center)
|
(gpt/subtract $ center)
|
||||||
(align-position (gpt/angle $) $)
|
(align-position (gpt/angle $) $)
|
||||||
(gpt/add $ center))]
|
(gpt/add $ center))]
|
||||||
(->> (update-point @drawing-shape point @counter)
|
|
||||||
(reset! drawing-shape)))
|
|
||||||
(->> (update-point @drawing-shape point @counter)
|
(->> (update-point @drawing-shape point @counter)
|
||||||
(reset! drawing-shape))))
|
(reset! drawing-shape))))
|
||||||
|
|
||||||
|
(on-free-draw [point]
|
||||||
|
(->> (update-point @drawing-shape point @counter)
|
||||||
|
(reset! drawing-shape)))
|
||||||
|
|
||||||
|
(on-draw [[point ctrl?]]
|
||||||
|
(if ctrl?
|
||||||
|
(on-assisted-draw point)
|
||||||
|
(on-free-draw point)))
|
||||||
|
|
||||||
(on-end []
|
(on-end []
|
||||||
(let [shape (normalize-shape @drawing-shape)]
|
(let [shape (normalize-shape @drawing-shape)]
|
||||||
(rs/emit! (uds/add-shape shape)
|
(rs/emit! (uds/add-shape shape)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue