diff --git a/frontend/src/app/main/data/workspace/common.cljs b/frontend/src/app/main/data/workspace/common.cljs index 594c00f03..78e69567d 100644 --- a/frontend/src/app/main/data/workspace/common.cljs +++ b/frontend/src/app/main/data/workspace/common.cljs @@ -188,6 +188,29 @@ (recur (inc counter)) candidate))))) +;; --- Shape attrs (Layers Sidebar) + +(defn toggle-collapse + [id] + (ptk/reify ::toggle-collapse + ptk/UpdateEvent + (update [_ state] + (update-in state [:workspace-local :expanded id] not)))) + +(defn expand-collapse + [id] + (ptk/reify ::expand-collapse + ptk/UpdateEvent + (update [_ state] + (assoc-in state [:workspace-local :expanded id] true)))) + +(def collapse-all + (ptk/reify ::collapse-all + ptk/UpdateEvent + (update [_ state] + (update state :workspace-local dissoc :expanded)))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Undo / Redo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 6c203d643..c74221e31 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -266,7 +266,8 @@ (when-not (empty? rch) (rx/of dwc/pop-undo-into-transaction (dwc/commit-changes rch uch {:commit-local? true}) - dwc/commit-undo-transaction)))))) + dwc/commit-undo-transaction + (dwc/expand-collapse frame-id))))))) (defn start-move ([from-position] (start-move from-position nil)) diff --git a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs index 9bf828715..bd9e012af 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs @@ -14,6 +14,7 @@ [app.common.pages-helpers :as cph] [app.common.uuid :as uuid] [app.main.data.workspace :as dw] + [app.main.data.workspace.common :as dwc] [app.main.refs :as refs] [app.main.store :as st] [app.main.ui.hooks :as hooks] @@ -112,8 +113,8 @@ (fn [event] (dom/stop-propagation event) (if (and expanded? (kbd/shift? event)) - (st/emit! dw/collapse-all) - (st/emit! (dw/toggle-collapse id)))) + (st/emit! dwc/collapse-all) + (st/emit! (dwc/toggle-collapse id)))) toggle-blocking (fn [event] @@ -173,7 +174,7 @@ on-hold (fn [] (when-not expanded? - (st/emit! (dw/toggle-collapse (:id item))))) + (st/emit! (dwc/toggle-collapse (:id item))))) [dprops dref] (hooks/use-sortable :data-type "app/layer"