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

View file

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

View file

@ -73,6 +73,15 @@
(rx/subscribe-with ob sub) (rx/subscribe-with ob sub)
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 (defonce mouse-position-alt
(let [sub (rx/behavior-subject nil) (let [sub (rx/behavior-subject nil)
ob (->> st/stream ob (->> st/stream

View file

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