0
Fork 0
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:
Andrey Antukh 2016-04-05 18:39:40 +03:00
parent 2c356f9892
commit 18ada6f49f

View file

@ -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 ")")}