diff --git a/frontend/src/app/main/data/workspace/path.cljs b/frontend/src/app/main/data/workspace/path.cljs index 33a5c2b52..57f2af43b 100644 --- a/frontend/src/app/main/data/workspace/path.cljs +++ b/frontend/src/app/main/data/workspace/path.cljs @@ -18,6 +18,7 @@ (d/export drawing/start-path-from-point) (d/export drawing/close-path-drag-start) (d/export drawing/change-edit-mode) +(d/export drawing/reset-last-handler) ;; Edition (d/export edition/start-move-handler) diff --git a/frontend/src/app/main/data/workspace/path/drawing.cljs b/frontend/src/app/main/data/workspace/path/drawing.cljs index 08fdad18e..e44cf9e92 100644 --- a/frontend/src/app/main/data/workspace/path/drawing.cljs +++ b/frontend/src/app/main/data/workspace/path/drawing.cljs @@ -359,3 +359,13 @@ (and id (= :move mode)) (rx/of (common/finish-path "change-edit-mode")) (and id (= :draw mode)) (rx/of (start-draw-mode)) :else (rx/empty)))))) + +(defn reset-last-handler + [] + (ptk/reify ::reset-last-handler + ptk/UpdateEvent + (update [_ state] + (let [id (st/get-path-id state)] + (-> state + (assoc-in [:workspace-local :edit-path id :prev-handler] nil)))))) + diff --git a/frontend/src/app/main/data/workspace/path/shortcuts.cljs b/frontend/src/app/main/data/workspace/path/shortcuts.cljs index 2470f2bb3..b88ee5268 100644 --- a/frontend/src/app/main/data/workspace/path/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/path/shortcuts.cljs @@ -40,8 +40,8 @@ :command "p" :fn #(st/emit! (drp/change-edit-mode :draw))} - :add-node {:tooltip "+" - :command "+" + :add-node {:tooltip (ds/shift "+") + :command "shift++" :fn #(st/emit! (drp/add-node))} :delete-node {:tooltip (ds/supr) @@ -88,7 +88,30 @@ :command [(ds/c-mod "shift+z") (ds/c-mod "y")] :fn #(st/emit! (drp/redo-path))} + ;; ZOOM + + :increase-zoom {:tooltip "+" + :command "+" + :fn #(st/emit! (dw/increase-zoom nil))} + + :decrease-zoom {:tooltip "-" + :command "-" + :fn #(st/emit! (dw/decrease-zoom nil))} + + :reset-zoom {:tooltip (ds/shift "0") + :command "shift+0" + :fn #(st/emit! dw/reset-zoom)} + + :fit-all {:tooltip (ds/shift "1") + :command "shift+1" + :fn #(st/emit! dw/zoom-to-fit-all)} + + :zoom-selected {:tooltip (ds/shift "2") + :command "shift+2" + :fn #(st/emit! dw/zoom-to-selected-shape)} + ;; Arrow movement + :move-fast-up {:tooltip (ds/shift ds/up-arrow) :command "shift+up" :fn #(st/emit! (drp/move-selected :up true))} diff --git a/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs b/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs index 16101feca..88cc10114 100644 --- a/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs @@ -30,12 +30,14 @@ (let [{:keys [x y]} position on-enter - (fn [event] - (st/emit! (drp/path-pointer-enter position))) + (mf/use-callback + (fn [event] + (st/emit! (drp/path-pointer-enter position)))) on-leave - (fn [event] - (st/emit! (drp/path-pointer-leave position))) + (mf/use-callback + (fn [event] + (st/emit! (drp/path-pointer-leave position)))) on-mouse-down (fn [event] @@ -48,6 +50,9 @@ (let [shift? (kbd/shift? event) ctrl? (kbd/ctrl? event)] (cond + last-p? + (st/emit! (drp/reset-last-handler)) + (and (= edit-mode :move) ctrl? (not curve?)) (st/emit! (drp/make-curve position)) @@ -81,8 +86,7 @@ :on-mouse-down on-mouse-down :on-mouse-enter on-enter :on-mouse-leave on-leave - :style {:pointer-events (when last-p? "none") - :cursor (cond + :style {:cursor (cond (= edit-mode :draw) cur/pen-node (= edit-mode :move) cur/pointer-node) :fill "transparent"}}]]))