0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Better workespace state re/initialization.

This commit is contained in:
Andrey Antukh 2017-03-08 19:50:37 +01:00
parent 1aa236e812
commit 0a70ab9c8c
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -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]