From e6fcb418b10e7d6dbf6ab8647f2afcd0060964a5 Mon Sep 17 00:00:00 2001 From: Aitor Date: Wed, 17 Jan 2024 15:46:17 +0100 Subject: [PATCH] :bug: Fix toolbar hidden after unfinished path --- frontend/src/app/main/data/workspace/path/drawing.cljs | 5 +++-- frontend/src/app/main/data/workspace/path/edition.cljs | 6 +++--- frontend/src/app/main/data/workspace/path/shortcuts.cljs | 6 +++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/data/workspace/path/drawing.cljs b/frontend/src/app/main/data/workspace/path/drawing.cljs index 2e926e315..c5760e99f 100644 --- a/frontend/src/app/main/data/workspace/path/drawing.cljs +++ b/frontend/src/app/main/data/workspace/path/drawing.cljs @@ -276,7 +276,8 @@ (cond-> (some? 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/UpdateEvent (update [_ state] @@ -293,7 +294,7 @@ ptk/WatchEvent (watch [_ state _] (let [content (get-in state [:workspace-drawing :object :content] [])] - (if (seq content) + (if (and (seq content) (> (count content) 1)) (rx/of (setup-frame) (dwdc/handle-finish-drawing) (dwe/start-edition-mode shape-id) diff --git a/frontend/src/app/main/data/workspace/path/edition.cljs b/frontend/src/app/main/data/workspace/path/edition.cljs index 8f83f67ee..7053aab62 100644 --- a/frontend/src/app/main/data/workspace/path/edition.cljs +++ b/frontend/src/app/main/data/workspace/path/edition.cljs @@ -319,9 +319,9 @@ (= (ptk/type %) ::start-path-edit)))) interrupt (->> stream (rx/filter #(= % :interrupt)) (rx/take 1))] (rx/concat - (rx/of (dwc/hide-toolbar)) - (rx/of (undo/start-path-undo)) - (rx/of (drawing/change-edit-mode mode)) + (rx/of (dwc/hide-toolbar) + (undo/start-path-undo) + (drawing/change-edit-mode mode)) (->> interrupt (rx/map #(stop-path-edit id)) (rx/take-until stopper))))))) diff --git a/frontend/src/app/main/data/workspace/path/shortcuts.cljs b/frontend/src/app/main/data/workspace/path/shortcuts.cljs index ffbf36578..74e095468 100644 --- a/frontend/src/app/main/data/workspace/path/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/path/shortcuts.cljs @@ -8,6 +8,7 @@ (:require [app.main.data.shortcuts :as ds] [app.main.data.workspace :as dw] + [app.main.data.workspace.common :as dwc] [app.main.data.workspace.path :as drp] [app.main.store :as st] [beicon.v2.core :as rx] @@ -26,10 +27,13 @@ ;; Not interrupt when we're editing a path (let [edition-id (or (get-in state [:workspace-drawing :object :id]) (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])] (if-not (= :draw path-edit-mode) (rx/of :interrupt) - (rx/empty)))))) + (if (<= (count content) 1) + (rx/of (dwc/show-toolbar)) + (rx/empty))))))) (def shortcuts {:move-nodes {:tooltip "M"