🐛 Fix issues with Alt key in distance measurement

This commit is contained in:
alonso.torres 2021-03-09 17:50:22 +01:00
parent e1df3efd6e
commit 6d427cdc9c
6 changed files with 26 additions and 6 deletions

View file

@ -24,6 +24,7 @@
- Fix issue with typographies panel cannot be collapsed [#707](https://github.com/penpot/penpot/issues/707) - Fix issue with typographies panel cannot be collapsed [#707](https://github.com/penpot/penpot/issues/707)
- Fix problem with middle mouse button press moving the canvas when not moving mouse [#717](https://github.com/penpot/penpot/issues/717) - Fix problem with middle mouse button press moving the canvas when not moving mouse [#717](https://github.com/penpot/penpot/issues/717)
- Fix problem with masks interactions outside bounds [#718](https://github.com/penpot/penpot/issues/718) - Fix problem with masks interactions outside bounds [#718](https://github.com/penpot/penpot/issues/718)
- Fix issues with Alt key in distance measurement [#672](https://github.com/penpot/penpot/issues/672)
### :heart: Community contributions by (Thank you!) ### :heart: Community contributions by (Thank you!)

View file

@ -50,12 +50,12 @@
(c-mod (a-mod shortcut))) (c-mod (a-mod shortcut)))
(defn bind-shortcuts [shortcuts bind-fn cb-fn] (defn bind-shortcuts [shortcuts bind-fn cb-fn]
(doseq [[key {:keys [command disabled fn]}] shortcuts] (doseq [[key {:keys [command disabled fn type]}] shortcuts]
(when-not disabled (when-not disabled
(if (vector? command) (if (vector? command)
(doseq [cmd (seq command)] (doseq [cmd (seq command)]
(bind-fn cmd (cb-fn key fn))) (bind-fn cmd (cb-fn key fn) type))
(bind-fn command (cb-fn key fn)))))) (bind-fn command (cb-fn key fn) type)))))
(defn meta [key] (defn meta [key]
(str (str

View file

@ -1726,6 +1726,13 @@
:data [image]}] :data [image]}]
(rx/of (dwp/upload-media-workspace params @ms/mouse-position)))))) (rx/of (dwp/upload-media-workspace params @ms/mouse-position))))))
(defn toggle-distances-display [value]
(ptk/reify ::toggle-distances-display
ptk/UpdateEvent
(update [_ state]
(assoc-in state [:workspace-local :show-distances?] value))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Interactions ;; Interactions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -260,6 +260,16 @@
:start-editing {:tooltip (ds/enter) :start-editing {:tooltip (ds/enter)
:command "enter" :command "enter"
:fn #(st/emit! (dw/start-editing-selected))} :fn #(st/emit! (dw/start-editing-selected))}
:start-measure {:tooltip (ds/alt "")
:command ["alt" "."]
:type "keydown"
:fn #(st/emit! (dw/toggle-distances-display true))}
:stop-measure {:tooltip (ds/alt "")
:command ["alt" "."]
:type "keyup"
:fn #(st/emit! (dw/toggle-distances-display false))}
}) })
(defn get-tooltip [shortcut] (defn get-tooltip [shortcut]

View file

@ -69,7 +69,8 @@
:transform :transform
:hover :hover
:modifiers :modifiers
:selrect]) :selrect
:show-distances?])
workspace-local =)) workspace-local =))
(def selected-zoom (def selected-zoom

View file

@ -350,7 +350,8 @@
transform transform
hover hover
modifiers modifiers
selrect]} local selrect
show-distances?]} local
page-id (mf/use-ctx ctx/current-page-id) page-id (mf/use-ctx ctx/current-page-id)
@ -797,7 +798,7 @@
[:& selection-handlers {:selected selected [:& selection-handlers {:selected selected
:zoom zoom :zoom zoom
:edition edition :edition edition
:show-distances (and (not transform) @alt?) :show-distances (and (not transform) show-distances?)
:disable-handlers (or drawing-tool edition)}]) :disable-handlers (or drawing-tool edition)}])
(when (= (count selected) 1) (when (= (count selected) 1)