mirror of
https://github.com/penpot/penpot.git
synced 2025-05-31 17:06:10 +02: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))
|
(recur (inc counter))
|
||||||
candidate)))))
|
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
|
;; Undo / Redo
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -266,7 +266,8 @@
|
||||||
(when-not (empty? rch)
|
(when-not (empty? rch)
|
||||||
(rx/of dwc/pop-undo-into-transaction
|
(rx/of dwc/pop-undo-into-transaction
|
||||||
(dwc/commit-changes rch uch {:commit-local? true})
|
(dwc/commit-changes rch uch {:commit-local? true})
|
||||||
dwc/commit-undo-transaction))))))
|
dwc/commit-undo-transaction
|
||||||
|
(dwc/expand-collapse frame-id)))))))
|
||||||
|
|
||||||
(defn start-move
|
(defn start-move
|
||||||
([from-position] (start-move from-position nil))
|
([from-position] (start-move from-position nil))
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
[app.common.pages-helpers :as cph]
|
[app.common.pages-helpers :as cph]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.main.data.workspace :as dw]
|
[app.main.data.workspace :as dw]
|
||||||
|
[app.main.data.workspace.common :as dwc]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.hooks :as hooks]
|
[app.main.ui.hooks :as hooks]
|
||||||
|
@ -112,8 +113,8 @@
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(if (and expanded? (kbd/shift? event))
|
(if (and expanded? (kbd/shift? event))
|
||||||
(st/emit! dw/collapse-all)
|
(st/emit! dwc/collapse-all)
|
||||||
(st/emit! (dw/toggle-collapse id))))
|
(st/emit! (dwc/toggle-collapse id))))
|
||||||
|
|
||||||
toggle-blocking
|
toggle-blocking
|
||||||
(fn [event]
|
(fn [event]
|
||||||
|
@ -173,7 +174,7 @@
|
||||||
on-hold
|
on-hold
|
||||||
(fn []
|
(fn []
|
||||||
(when-not expanded?
|
(when-not expanded?
|
||||||
(st/emit! (dw/toggle-collapse (:id item)))))
|
(st/emit! (dwc/toggle-collapse (:id item)))))
|
||||||
|
|
||||||
[dprops dref] (hooks/use-sortable
|
[dprops dref] (hooks/use-sortable
|
||||||
:data-type "app/layer"
|
:data-type "app/layer"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue