0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-11 01:28:30 -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 (defn initialize
"Initialize the workspace state." "Initialize the workspace state."
[projectid pageid] [project page]
(reify (reify
rs/UpdateEvent rs/UpdateEvent
(-apply-update [_ state] (-apply-update [_ state]
(let [s {:project projectid (if-let [workspace (:workspace state)]
:flags #{:layers :element-options} (update state :workspace merge
:drawing nil {:project project
:page page
:selected #{} :selected #{}
:page pageid}] :drawing nil})
(assoc state :workspace s))))) (update state :workspace merge
{:project project
:page page
:flags #{:layers :element-options}
:selected #{}
:drawing nil})))))
(defn toggle-flag (defn toggle-flag
"Toggle the enabled flag of the specified tool." "Toggle the enabled flag of the specified tool."