From 0a70ab9c8c0e4528fabb6f9d201379d429c6c6a3 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 8 Mar 2017 19:50:37 +0100 Subject: [PATCH] Better workespace state re/initialization. --- frontend/src/uxbox/main/data/workspace.cljs | 36 +++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/frontend/src/uxbox/main/data/workspace.cljs b/frontend/src/uxbox/main/data/workspace.cljs index 5ada86f28..ee4239935 100644 --- a/frontend/src/uxbox/main/data/workspace.cljs +++ b/frontend/src/uxbox/main/data/workspace.cljs @@ -50,23 +50,25 @@ (defrecord InitializeWorkspace [project page] ptk/UpdateEvent (update [_ state] - (if (:workspace state) - (update state :workspace merge - {:project project - :page page - :selected #{} - :drawing nil - :drawing-tool nil - :tooltip nil}) - (assoc state :workspace - {:project project - :zoom 1 - :page page - :flags #{:sitemap :drawtools :layers :element-options :rules} - :selected #{} - :drawing nil - :drawing-tool nil - :tooltip nil}))) + (let [default-flags #{:sitemap :drawtools :layers :element-options :rules :ruler}] + (if (:workspace state) + (update state :workspace merge + {:project project + :page page + :selected #{} + :flags default-flags + :drawing nil + :drawing-tool nil + :tooltip nil}) + (assoc state :workspace + {:project project + :zoom 1 + :page page + :flags default-flags + :selected #{} + :drawing nil + :drawing-tool nil + :tooltip nil})))) ptk/WatchEvent (watch [_ state s]