mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 00:58:26 -05:00
✨ Open artboard at the sidebar when dropping shapes into it
This commit is contained in:
parent
4c1150bf78
commit
ddf0e75a11
3 changed files with 29 additions and 4 deletions
|
@ -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
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue