From d2590c7651edbcfd457a2ed482a59b3041e51056 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Fri, 25 Feb 2022 11:40:25 +0100 Subject: [PATCH] :bug: [Prototype] Prototype mode should not allow edits --- frontend/src/app/main/data/workspace.cljs | 8 ++++++-- frontend/src/app/main/data/workspace/interactions.cljs | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index ebbb1c692..3c896d322 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -754,9 +754,13 @@ ptk/WatchEvent (watch [_ state _] (let [selected (wsh/lookup-selected state) - hover-guides (get-in state [:workspace-guides :hover])] + hover-guides (get-in state [:workspace-guides :hover]) + options-mode (get-in state [:workspace-global :options-mode])] (cond - (d/not-empty? selected) + (and (= options-mode :prototype) (d/not-empty? selected)) + (rx/of (dwi/remove-interactions selected)) + + (and (= options-mode :design) (d/not-empty? selected)) (rx/of (dwc/delete-shapes selected) (dws/deselect-all)) diff --git a/frontend/src/app/main/data/workspace/interactions.cljs b/frontend/src/app/main/data/workspace/interactions.cljs index cf71f907b..93331bd30 100644 --- a/frontend/src/app/main/data/workspace/interactions.cljs +++ b/frontend/src/app/main/data/workspace/interactions.cljs @@ -171,6 +171,15 @@ (update shape :interactions csi/remove-interaction index))))))) +(defn remove-interactions + [ids] + (ptk/reify ::remove-interactions + ptk/WatchEvent + (watch [_ _ _] + (rx/of (dch/update-shapes ids + (fn [shape] + (assoc shape :interactions []))))))) + (defn update-interaction [shape index update-fn] (ptk/reify ::update-interaction