0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 17:18:21 -05:00

Improve workspace initialization.

This commit is contained in:
Andrey Antukh 2016-02-21 20:30:20 +02:00
parent 9d19acfeb3
commit fd6395fcd4

View file

@ -59,16 +59,22 @@
(defn initialize
"Initialize the workspace state."
[projectid pageid]
[project page]
(reify
rs/UpdateEvent
(-apply-update [_ state]
(let [s {:project projectid
:flags #{:layers :element-options}
:drawing nil
:selected #{}
:page pageid}]
(assoc state :workspace s)))))
(if-let [workspace (:workspace state)]
(update state :workspace merge
{:project project
:page page
:selected #{}
:drawing nil})
(update state :workspace merge
{:project project
:page page
:flags #{:layers :element-options}
:selected #{}
:drawing nil})))))
(defn toggle-flag
"Toggle the enabled flag of the specified tool."