Set an artboard as the file thumbnail

This commit is contained in:
Pablo Alba 2022-03-04 15:36:17 +01:00
parent a588267fc2
commit 0a04a856da
11 changed files with 150 additions and 26 deletions

View file

@ -71,9 +71,10 @@
(update :undo-changes conj (assoc change :operations uops)))))
(defn update-shapes
([ids f] (update-shapes ids f nil))
([ids f {:keys [reg-objects? save-undo? attrs ignore-tree]
:or {reg-objects? false save-undo? true attrs nil}}]
([ids f] (update-shapes ids f nil nil))
([ids f keys] (update-shapes ids f nil keys))
([ids f page-id {:keys [reg-objects? save-undo? attrs ignore-tree]
:or {reg-objects? false save-undo? true attrs nil}}]
(us/assert ::coll-of-uuid ids)
(us/assert fn? f)
@ -81,8 +82,8 @@
(ptk/reify ::update-shapes
ptk/WatchEvent
(watch [it state _]
(let [page-id (:current-page-id state)
objects (wsh/lookup-page-objects state)
(let [page-id (or page-id (:current-page-id state))
objects (wsh/lookup-page-objects state page-id)
changes {:redo-changes []
:undo-changes []
:origin it
@ -91,8 +92,8 @@
ids (into [] (filter some?) ids)
changes (reduce
#(update-shape-changes %1 page-id objects f attrs %2 (get ignore-tree %2))
changes ids)]
#(update-shape-changes %1 page-id objects f attrs %2 (get ignore-tree %2))
changes ids)]
(when-not (empty? (:redo-changes changes))
(let [reg-objs {:type :reg-objects