mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
Add zoom shortcuts.
This commit is contained in:
parent
4aaa5c3e7a
commit
25d76d5b88
3 changed files with 9 additions and 7 deletions
|
@ -111,7 +111,7 @@
|
|||
|
||||
(defn- workspace-render
|
||||
[own projectid]
|
||||
(let [{:keys [flags] :as workspace} (rum/react uuwb/workspace-l)
|
||||
(let [{:keys [flags zoom] :as workspace} (rum/react uuwb/workspace-l)
|
||||
left-sidebar? (not (empty? (keep flags [:layers :sitemap
|
||||
:document-history])))
|
||||
right-sidebar? (not (empty? (keep flags [:icons :drawtools
|
||||
|
@ -131,8 +131,8 @@
|
|||
|
||||
[:section.workspace-content {:class classes :on-scroll on-scroll}
|
||||
;; Rules
|
||||
(horizontal-rule)
|
||||
(vertical-rule)
|
||||
(horizontal-rule zoom)
|
||||
(vertical-rule zoom)
|
||||
|
||||
;; Canvas
|
||||
[:section.workspace-canvas {:ref "workspace-canvas"}
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
(when (contains? flags :grid)
|
||||
(grid 1))])))
|
||||
|
||||
|
||||
(def canvas
|
||||
(mx/component
|
||||
{:render canvas-render
|
||||
|
@ -89,7 +88,7 @@
|
|||
(let [workspace (rum/react uuwb/workspace-l)
|
||||
page (rum/react uuwb/page-l)
|
||||
drawing? (:drawing workspace)
|
||||
zoom 1]
|
||||
zoom (:zoom workspace 1)]
|
||||
(letfn [(on-mouse-down [event]
|
||||
(dom/stop-propagation event)
|
||||
(when-not (empty? (:selected workspace))
|
||||
|
@ -110,9 +109,9 @@
|
|||
:on-mouse-up on-mouse-up}
|
||||
[:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
|
||||
(if page
|
||||
(canvas page))
|
||||
(canvas page))]
|
||||
(ruler)
|
||||
(selrect)]]))))
|
||||
(selrect)]))))
|
||||
|
||||
(defn- viewport-did-mount
|
||||
[own]
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
:ctrl+shift+f #(rs/emit! (dw/toggle-flag :drawtools))
|
||||
:ctrl+shift+i #(rs/emit! (dw/toggle-flag :icons))
|
||||
:ctrl+shift+l #(rs/emit! (dw/toggle-flag :layers))
|
||||
:ctrl+p #(rs/emit! (dw/increase-zoom))
|
||||
:ctrl+m #(rs/emit! (dw/decrease-zoom))
|
||||
:ctrl+l #(rs/emit! (dw/reset-zoom))
|
||||
:ctrl+r #(rs/emit! (dw/toggle-flag :ruler))
|
||||
:ctrl+d #(rs/emit! (dw/duplicate-selected))
|
||||
:ctrl+c #(rs/emit! (dw/copy-to-clipboard))
|
||||
|
|
Loading…
Reference in a new issue