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
|
(defn- workspace-render
|
||||||
[own projectid]
|
[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
|
left-sidebar? (not (empty? (keep flags [:layers :sitemap
|
||||||
:document-history])))
|
:document-history])))
|
||||||
right-sidebar? (not (empty? (keep flags [:icons :drawtools
|
right-sidebar? (not (empty? (keep flags [:icons :drawtools
|
||||||
|
@ -131,8 +131,8 @@
|
||||||
|
|
||||||
[:section.workspace-content {:class classes :on-scroll on-scroll}
|
[:section.workspace-content {:class classes :on-scroll on-scroll}
|
||||||
;; Rules
|
;; Rules
|
||||||
(horizontal-rule)
|
(horizontal-rule zoom)
|
||||||
(vertical-rule)
|
(vertical-rule zoom)
|
||||||
|
|
||||||
;; Canvas
|
;; Canvas
|
||||||
[:section.workspace-canvas {:ref "workspace-canvas"}
|
[:section.workspace-canvas {:ref "workspace-canvas"}
|
||||||
|
|
|
@ -73,7 +73,6 @@
|
||||||
(when (contains? flags :grid)
|
(when (contains? flags :grid)
|
||||||
(grid 1))])))
|
(grid 1))])))
|
||||||
|
|
||||||
|
|
||||||
(def canvas
|
(def canvas
|
||||||
(mx/component
|
(mx/component
|
||||||
{:render canvas-render
|
{:render canvas-render
|
||||||
|
@ -89,7 +88,7 @@
|
||||||
(let [workspace (rum/react uuwb/workspace-l)
|
(let [workspace (rum/react uuwb/workspace-l)
|
||||||
page (rum/react uuwb/page-l)
|
page (rum/react uuwb/page-l)
|
||||||
drawing? (:drawing workspace)
|
drawing? (:drawing workspace)
|
||||||
zoom 1]
|
zoom (:zoom workspace 1)]
|
||||||
(letfn [(on-mouse-down [event]
|
(letfn [(on-mouse-down [event]
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(when-not (empty? (:selected workspace))
|
(when-not (empty? (:selected workspace))
|
||||||
|
@ -110,9 +109,9 @@
|
||||||
:on-mouse-up on-mouse-up}
|
:on-mouse-up on-mouse-up}
|
||||||
[:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
|
[:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
|
||||||
(if page
|
(if page
|
||||||
(canvas page))
|
(canvas page))]
|
||||||
(ruler)
|
(ruler)
|
||||||
(selrect)]]))))
|
(selrect)]))))
|
||||||
|
|
||||||
(defn- viewport-did-mount
|
(defn- viewport-did-mount
|
||||||
[own]
|
[own]
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
:ctrl+shift+f #(rs/emit! (dw/toggle-flag :drawtools))
|
:ctrl+shift+f #(rs/emit! (dw/toggle-flag :drawtools))
|
||||||
:ctrl+shift+i #(rs/emit! (dw/toggle-flag :icons))
|
:ctrl+shift+i #(rs/emit! (dw/toggle-flag :icons))
|
||||||
:ctrl+shift+l #(rs/emit! (dw/toggle-flag :layers))
|
: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+r #(rs/emit! (dw/toggle-flag :ruler))
|
||||||
:ctrl+d #(rs/emit! (dw/duplicate-selected))
|
:ctrl+d #(rs/emit! (dw/duplicate-selected))
|
||||||
:ctrl+c #(rs/emit! (dw/copy-to-clipboard))
|
:ctrl+c #(rs/emit! (dw/copy-to-clipboard))
|
||||||
|
|
Loading…
Reference in a new issue