0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-07 15:39:42 -05:00

🐛 Drawing tool will have priority over resize/rotate handlers

This commit is contained in:
alonso.torres 2021-02-24 13:36:47 +01:00
parent 8f4e13072c
commit b79c986fc9
3 changed files with 16 additions and 8 deletions

View file

@ -28,6 +28,7 @@
- Add more improvements to french translation strings [#591](https://github.com/penpot/penpot/pull/591)
- Add some missing database indexes (mainly improves performance on large databases on file-update rpc method, and some background tasks).
- Drawing tool will have priority over resize/rotate handlers [Taiga #1225](https://tree.taiga.io/project/penpot/issue/1225)
- Fix broken bounding box on editing paths [Taiga #1254](https://tree.taiga.io/project/penpot/issue/1254)
- Fix corner cases on invitation/signup flows.
- Fix errors on onboarding file [Taiga #1287](https://tree.taiga.io/project/penpot/issue/1287)

View file

@ -241,6 +241,7 @@
color (obj/get props "color")
on-resize (obj/get props "on-resize")
on-rotate (obj/get props "on-rotate")
disable-handlers (obj/get props "disable-handlers")
current-transform (mf/deref refs/current-transform)
hide? (mf/use-state false)
@ -251,7 +252,8 @@
(hooks/use-stream ms/keyboard-ctrl #(when (= type :group) (reset! hide? %)))
(when (not (#{:move :rotate} current-transform))
[:g.controls {:style {:display (when @hide? "none")}}
[:g.controls {:style {:display (when @hide? "none")}
:pointer-events (when disable-handlers "none")}
;; Selection rect
[:& selection-rect {:rect selrect
@ -294,7 +296,7 @@
:fill "transparent"}}]]))
(mf/defc multiple-selection-handlers
[{:keys [shapes selected zoom color show-distances] :as props}]
[{:keys [shapes selected zoom color show-distances disable-handlers] :as props}]
(let [shape (geom/setup {:type :rect} (geom/selection-rect (->> shapes (map geom/transform-shape))))
shape-center (geom/center-shape shape)
@ -315,6 +317,7 @@
[:& controls {:shape shape
:zoom zoom
:color color
:disable-handlers disable-handlers
:on-resize on-resize
:on-rotate on-rotate}]
@ -328,7 +331,7 @@
[:circle {:cx (:x shape-center) :cy (:y shape-center) :r 5 :fill "yellow"}])]))
(mf/defc single-selection-handlers
[{:keys [shape zoom color show-distances] :as props}]
[{:keys [shape zoom color show-distances disable-handlers] :as props}]
(let [shape-id (:id shape)
shape (geom/transform-shape shape)
@ -353,7 +356,8 @@
:zoom zoom
:color color
:on-rotate on-rotate
:on-resize on-resize}]
:on-resize on-resize
:disable-handlers disable-handlers}]
(when show-distances
[:& msr/measurement {:bounds vbox
@ -364,7 +368,7 @@
(mf/defc selection-handlers
{::mf/wrap [mf/memo]}
[{:keys [selected edition zoom show-distances] :as props}]
[{:keys [selected edition zoom show-distances disable-handlers] :as props}]
(let [;; We need remove posible nil values because on shape
;; deletion many shape will reamin selected and deleted
;; in the same time for small instant of time
@ -385,7 +389,8 @@
:selected selected
:zoom zoom
:color color
:show-distances show-distances}]
:show-distances show-distances
:disable-handlers disable-handlers}]
(and (= type :text)
(= edition (:id shape)))
@ -402,4 +407,5 @@
[:& single-selection-handlers {:shape shape
:zoom zoom
:color color
:show-distances show-distances}])))
:show-distances show-distances
:disable-handlers disable-handlers}])))

View file

@ -794,7 +794,8 @@
[:& selection-handlers {:selected selected
:zoom zoom
:edition edition
:show-distances (and (not transform) @alt?)}])
:show-distances (and (not transform) @alt?)
:disable-handlers (or drawing-tool edition)}])
(when (= (count selected) 1)
[:& gradient-handlers {:id (first selected)