mirror of
https://github.com/penpot/penpot.git
synced 2025-05-16 12:06:09 +02:00
🐛 Fix resize/rotate with mouse buttons different than left
This commit is contained in:
parent
7b9b3dabbe
commit
73a08fd119
3 changed files with 28 additions and 12 deletions
|
@ -286,12 +286,17 @@
|
|||
|
||||
shape-center (geom/center-shape shape)
|
||||
|
||||
on-resize (fn [current-position _initial-position event]
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dw/start-resize current-position selected shape)))
|
||||
on-resize
|
||||
(fn [current-position _initial-position event]
|
||||
(when (dom/left-mouse? event)
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dw/start-resize current-position selected shape))))
|
||||
|
||||
on-rotate #(do (dom/stop-propagation %)
|
||||
(st/emit! (dw/start-rotate shapes)))]
|
||||
on-rotate
|
||||
(fn [event]
|
||||
(when (dom/left-mouse? event)
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dw/start-rotate shapes))))]
|
||||
|
||||
[:*
|
||||
[:& controls {:shape shape
|
||||
|
@ -311,13 +316,19 @@
|
|||
shape (geom/transform-shape shape {:round-coords? false})
|
||||
|
||||
shape' (if (debug? :simple-selection) (geom/setup {:type :rect} (geom/selection-rect [shape])) shape)
|
||||
on-resize (fn [current-position _initial-position event]
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dw/start-resize current-position #{shape-id} shape')))
|
||||
|
||||
on-resize
|
||||
(fn [current-position _initial-position event]
|
||||
(when (dom/left-mouse? event)
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dw/start-resize current-position #{shape-id} shape'))))
|
||||
|
||||
on-rotate
|
||||
#(do (dom/stop-propagation %)
|
||||
(st/emit! (dw/start-rotate [shape])))]
|
||||
(fn [event]
|
||||
(when (dom/left-mouse? event)
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dw/start-rotate [shape]))))]
|
||||
|
||||
[:& controls {:shape shape'
|
||||
:zoom zoom
|
||||
:color color
|
||||
|
|
|
@ -375,3 +375,7 @@
|
|||
(trigger-download-uri filename mtype uri)))))
|
||||
|
||||
(trigger-download-uri filename mtype uri)))
|
||||
|
||||
(defn left-mouse? [bevent]
|
||||
(let [event (.-nativeEvent bevent)]
|
||||
(= 1 (.-which event))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue