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:
parent
1aa236e812
commit
0a70ab9c8c
1 changed files with 19 additions and 17 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue