mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 16:30:37 -05:00
Add the ability to zoom using mouse wheel.
This commit is contained in:
parent
2c356f9892
commit
18ada6f49f
1 changed files with 9 additions and 1 deletions
|
@ -99,12 +99,20 @@
|
|||
(on-mouse-up [event]
|
||||
(dom/stop-propagation event)
|
||||
(uuc/release-action! "ui.shape"
|
||||
"ui.selrect"))]
|
||||
"ui.selrect"))
|
||||
(on-wheel [event]
|
||||
(when (kbd/ctrl? event)
|
||||
(dom/prevent-default event)
|
||||
(dom/stop-propagation event)
|
||||
(if (pos? (.-deltaY event))
|
||||
(rs/emit! (dw/increase-zoom))
|
||||
(rs/emit! (dw/decrease-zoom)))))]
|
||||
(html
|
||||
[:svg.viewport {:width uuwb/viewport-width
|
||||
:height uuwb/viewport-height
|
||||
:ref "viewport"
|
||||
:class (when drawing? "drawing")
|
||||
:on-wheel on-wheel
|
||||
:on-mouse-down on-mouse-down
|
||||
:on-mouse-up on-mouse-up}
|
||||
[:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
|
||||
|
|
Loading…
Reference in a new issue