0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 16:00:19 -05:00

🐛 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 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 issues with Alt key in distance measurement [#672](https://github.com/penpot/penpot/issues/672)
### :heart: Community contributions by (Thank you!)

View file

@ -50,12 +50,12 @@
(c-mod (a-mod shortcut)))
(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
(if (vector? command)
(doseq [cmd (seq command)]
(bind-fn cmd (cb-fn key fn)))
(bind-fn command (cb-fn key fn))))))
(bind-fn cmd (cb-fn key fn) type))
(bind-fn command (cb-fn key fn) type)))))
(defn meta [key]
(str

View file

@ -1726,6 +1726,13 @@
:data [image]}]
(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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -260,6 +260,16 @@
:start-editing {:tooltip (ds/enter)
:command "enter"
: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]

View file

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

View file

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