0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-26 08:45:34 -05:00

🐛 Fix toolbar hidden after unfinished path

This commit is contained in:
Aitor 2024-01-17 15:46:17 +01:00
parent ff72a9ce70
commit e6fcb418b1
3 changed files with 11 additions and 6 deletions

View file

@ -276,7 +276,8 @@
(cond-> (some? drop-index) (cond-> (some? drop-index)
(with-meta {:index drop-index}))))))))) (with-meta {:index drop-index})))))))))
(defn handle-new-shape-result [shape-id] (defn handle-new-shape-result
[shape-id]
(ptk/reify ::handle-new-shape-result (ptk/reify ::handle-new-shape-result
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
@ -293,7 +294,7 @@
ptk/WatchEvent ptk/WatchEvent
(watch [_ state _] (watch [_ state _]
(let [content (get-in state [:workspace-drawing :object :content] [])] (let [content (get-in state [:workspace-drawing :object :content] [])]
(if (seq content) (if (and (seq content) (> (count content) 1))
(rx/of (setup-frame) (rx/of (setup-frame)
(dwdc/handle-finish-drawing) (dwdc/handle-finish-drawing)
(dwe/start-edition-mode shape-id) (dwe/start-edition-mode shape-id)

View file

@ -319,9 +319,9 @@
(= (ptk/type %) ::start-path-edit)))) (= (ptk/type %) ::start-path-edit))))
interrupt (->> stream (rx/filter #(= % :interrupt)) (rx/take 1))] interrupt (->> stream (rx/filter #(= % :interrupt)) (rx/take 1))]
(rx/concat (rx/concat
(rx/of (dwc/hide-toolbar)) (rx/of (dwc/hide-toolbar)
(rx/of (undo/start-path-undo)) (undo/start-path-undo)
(rx/of (drawing/change-edit-mode mode)) (drawing/change-edit-mode mode))
(->> interrupt (->> interrupt
(rx/map #(stop-path-edit id)) (rx/map #(stop-path-edit id))
(rx/take-until stopper))))))) (rx/take-until stopper)))))))

View file

@ -8,6 +8,7 @@
(:require (:require
[app.main.data.shortcuts :as ds] [app.main.data.shortcuts :as ds]
[app.main.data.workspace :as dw] [app.main.data.workspace :as dw]
[app.main.data.workspace.common :as dwc]
[app.main.data.workspace.path :as drp] [app.main.data.workspace.path :as drp]
[app.main.store :as st] [app.main.store :as st]
[beicon.v2.core :as rx] [beicon.v2.core :as rx]
@ -26,10 +27,13 @@
;; Not interrupt when we're editing a path ;; Not interrupt when we're editing a path
(let [edition-id (or (get-in state [:workspace-drawing :object :id]) (let [edition-id (or (get-in state [:workspace-drawing :object :id])
(get-in state [:workspace-local :edition])) (get-in state [:workspace-local :edition]))
content (get-in state [:workspace-drawing :object :content])
path-edit-mode (get-in state [:workspace-local :edit-path edition-id :edit-mode])] path-edit-mode (get-in state [:workspace-local :edit-path edition-id :edit-mode])]
(if-not (= :draw path-edit-mode) (if-not (= :draw path-edit-mode)
(rx/of :interrupt) (rx/of :interrupt)
(rx/empty)))))) (if (<= (count content) 1)
(rx/of (dwc/show-toolbar))
(rx/empty)))))))
(def shortcuts (def shortcuts
{:move-nodes {:tooltip "M" {:move-nodes {:tooltip "M"