mirror of
https://github.com/penpot/penpot.git
synced 2025-07-18 22:47:30 +02:00
✨ Add more workspace shortcuts
This commit is contained in:
parent
d5568fcc25
commit
8072caeff1
4 changed files with 61 additions and 10 deletions
|
@ -41,7 +41,15 @@
|
|||
|
||||
:prev-frame {:tooltip ds/right-arrow
|
||||
:command "right"
|
||||
:fn (st/emitf dv/select-next-frame)}})
|
||||
:fn (st/emitf dv/select-next-frame)}
|
||||
|
||||
:open-handoff {:tooltip "G H"
|
||||
:command "g h"
|
||||
:fn #(st/emit! (dv/go-to-section :handoff))}
|
||||
|
||||
:open-comments {:tooltip "G C"
|
||||
:command "g c"
|
||||
:fn #(st/emit! (dv/go-to-section :comments))}})
|
||||
|
||||
(defn get-tooltip [shortcut]
|
||||
(assert (contains? shortcuts shortcut) (str shortcut))
|
||||
|
|
|
@ -1198,6 +1198,14 @@
|
|||
(gpr/assign-proportions))))]
|
||||
(rx/of (dch/update-shapes [id] assign-proportions))))))
|
||||
|
||||
(defn toggle-proportion-lock
|
||||
[]
|
||||
(ptk/reify ::toggle-propotion-lock
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [selected (wsh/lookup-selected state)]
|
||||
(rx/of (dch/update-shapes selected #(update % :proportion-lock not)))))))
|
||||
|
||||
;; --- Update Shape Flags
|
||||
|
||||
(defn update-shape-flags
|
||||
|
@ -1217,6 +1225,21 @@
|
|||
ids (into [id] (cp/get-children id objects))]
|
||||
(rx/of (dch/update-shapes ids update-fn))))))
|
||||
|
||||
(defn toggle-visibility-selected
|
||||
[]
|
||||
(ptk/reify ::toggle-visibility-selected
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [selected (wsh/lookup-selected state)]
|
||||
(rx/of (dch/update-shapes selected #(update % :hidden not)))))))
|
||||
|
||||
(defn toggle-lock-selected
|
||||
[]
|
||||
(ptk/reify ::toggle-lock-selected
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [selected (wsh/lookup-selected state)]
|
||||
(rx/of (dch/update-shapes selected #(update % :blocked not)))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Navigation
|
||||
|
@ -1282,13 +1305,13 @@
|
|||
|
||||
(defn go-to-viewer
|
||||
([] (go-to-viewer {}))
|
||||
([{:keys [file-id page-id]}]
|
||||
([{:keys [file-id page-id section]}]
|
||||
(ptk/reify ::go-to-viewer
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [{:keys [current-file-id current-page-id]} state
|
||||
pparams {:file-id (or file-id current-file-id)}
|
||||
qparams {:page-id (or page-id current-page-id)}]
|
||||
qparams {:page-id (or page-id current-page-id) :section section}]
|
||||
(rx/of ::dwp/force-persist
|
||||
(rt/nav-new-window* {:rname :viewer
|
||||
:path-params pparams
|
||||
|
|
|
@ -239,6 +239,14 @@
|
|||
:command "g v"
|
||||
:fn #(st/emit! (dw/go-to-viewer))}
|
||||
|
||||
:open-handoff {:tooltip "G H"
|
||||
:command "g h"
|
||||
:fn #(st/emit! (dw/go-to-viewer {:section :handoff}))}
|
||||
|
||||
:open-comments {:tooltip "G C"
|
||||
:command "g c"
|
||||
:fn #(st/emit! (dw/go-to-viewer {:section :comments}))}
|
||||
|
||||
:open-dashboard {:tooltip "G D"
|
||||
:command "g d"
|
||||
:fn #(st/emit! (dw/go-to-dashboard))}
|
||||
|
@ -301,13 +309,25 @@
|
|||
:command "alt+s"
|
||||
:fn #(st/emit! (dw/align-objects :vbottom))}
|
||||
|
||||
:h-distribute {:tooltip (ds/meta-shift (ds/alt "H"))
|
||||
:command (ds/c-mod "shift+alt+h")
|
||||
:fn #(st/emit! (dw/distribute-objects :horizontal))}
|
||||
:h-distribute {:tooltip (ds/meta-shift (ds/alt "H"))
|
||||
:command (ds/c-mod "shift+alt+h")
|
||||
:fn #(st/emit! (dw/distribute-objects :horizontal))}
|
||||
|
||||
:v-distribute {:tooltip (ds/meta-shift (ds/alt "V"))
|
||||
:command (ds/c-mod "shift+alt+v")
|
||||
:fn #(st/emit! (dw/distribute-objects :vertical))}})
|
||||
:v-distribute {:tooltip (ds/meta-shift (ds/alt "V"))
|
||||
:command (ds/c-mod "shift+alt+v")
|
||||
:fn #(st/emit! (dw/distribute-objects :vertical))}
|
||||
|
||||
:toggle-visibility {:tooltip (ds/meta-shift "H")
|
||||
:command (ds/c-mod "shift+h")
|
||||
:fn #(st/emit! (dw/toggle-visibility-selected))}
|
||||
|
||||
:toggle-lock {:tooltip (ds/meta-shift "L")
|
||||
:command (ds/c-mod "shift+l")
|
||||
:fn #(st/emit! (dw/toggle-lock-selected))}
|
||||
|
||||
:toggle-lock-size {:tooltip (ds/meta (ds/alt "L"))
|
||||
:command (ds/c-mod "alt+l")
|
||||
:fn #(st/emit! (dw/toggle-proportion-lock))}})
|
||||
|
||||
(defn get-tooltip [shortcut]
|
||||
(assert (contains? shortcuts shortcut) (str shortcut))
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
(ns app.main.ui.workspace.sidebar.options.menus.align
|
||||
(:require
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.data.workspace.shortcuts :as sc]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue