0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-18 02:32:13 -05:00

Change some keyboard shortcuts

This commit is contained in:
Andrés Moya 2020-07-21 09:31:26 +02:00
parent 37351744cd
commit 835c958972
4 changed files with 20 additions and 10 deletions

View file

@ -1442,12 +1442,12 @@
"ctrl+shift+'" #(st/emit! (toggle-layout-flags :snap-grid))
"+" #(st/emit! (increase-zoom nil))
"-" #(st/emit! (decrease-zoom nil))
"g" #(st/emit! group-selected)
"ctrl+g" #(st/emit! group-selected)
"shift+g" #(st/emit! ungroup-selected)
"shift+0" #(st/emit! reset-zoom)
"shift+1" #(st/emit! zoom-to-fit-all)
"shift+2" #(st/emit! zoom-to-selected-shape)
"d" #(st/emit! duplicate-selected)
"ctrl+d" #(st/emit! duplicate-selected)
"ctrl+z" #(st/emit! dwc/undo)
"ctrl+shift+z" #(st/emit! dwc/redo)
"ctrl+y" #(st/emit! dwc/redo)
@ -1460,6 +1460,7 @@
"ctrl+v" #(st/emit! paste)
"escape" #(st/emit! :interrupt deselect-all)
"del" #(st/emit! delete-selected)
"backspace" #(st/emit! delete-selected)
"ctrl+up" #(st/emit! (vertical-order-selected :up))
"ctrl+down" #(st/emit! (vertical-order-selected :down))
"ctrl+shift+up" #(st/emit! (vertical-order-selected :top))

View file

@ -112,11 +112,11 @@
false))))
;; Unifies the instantaneous proportion lock modifier
;; activated by Ctrl key and the shapes own proportion
;; activated by Shift key and the shapes own proportion
;; lock flag that can be activated on element options.
(normalize-proportion-lock [[point ctrl?]]
(normalize-proportion-lock [[point shift?]]
(let [proportion-lock? (:proportion-lock shape)]
[point (or proportion-lock? ctrl?)]))
[point (or proportion-lock? shift?)]))
;; Applies alginment to point if it is currently
;; activated on the current workspace
@ -141,7 +141,7 @@
layout (get state :workspace-layout)]
(rx/concat
(->> ms/mouse-position
(rx/with-latest vector ms/mouse-position-ctrl)
(rx/with-latest vector ms/mouse-position-shift)
(rx/map normalize-proportion-lock)
(rx/switch-map (fn [[point :as current]]
(->> (snap/closest-snap-point page-id resizing-shapes layout point)
@ -171,10 +171,10 @@
calculate-angle (fn [pos ctrl?]
(let [angle (- (gpt/angle pos group-center) initial-angle)
angle (if (neg? angle) (+ 360 angle) angle)
modval (mod angle 90)
modval (mod angle 45)
angle (if ctrl?
(if (< 50 modval)
(+ angle (- 90 modval))
(if (< 22.5 modval)
(+ angle (- 45 modval))
(- angle modval))
angle)
angle (if (= angle 360)

View file

@ -73,6 +73,15 @@
(rx/subscribe-with ob sub)
sub))
(defonce mouse-position-shift
(let [sub (rx/behavior-subject nil)
ob (->> st/stream
(rx/filter pointer-event?)
(rx/map :shift)
(rx/dedupe))]
(rx/subscribe-with ob sub)
sub))
(defonce mouse-position-alt
(let [sub (rx/behavior-subject nil)
ob (->> st/stream

View file

@ -87,7 +87,7 @@
(when (> (count selected) 1)
[:& menu-entry {:title "Group"
:shortcut "g"
:shortcut "Ctrl + g"
:on-click do-create-group}])
(when (and (= (count selected) 1) (= (:type shape) :group))