0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

🔧 Improve debug utility

This commit is contained in:
Andrés Moya 2024-06-13 16:09:51 +02:00
parent 7a05580df3
commit b5477c4e30

View file

@ -277,15 +277,23 @@
(let [page-id (get state :current-page-id)
file (assoc (get state :workspace-file)
:data (get state :workspace-data))
libraries (get state :workspace-libraries)]
(ctf/dump-subtree file page-id shape-id libraries {:show-ids show-ids
:show-touched show-touched
:show-modified show-modified}))))
libraries (get state :workspace-libraries)
shape-id (if (some? shape-id)
(uuid/uuid shape-id)
(let [objects (get-in state [:workspace-data :pages-index page-id :objects])
selected (get-in state [:workspace-local :selected])]
(->> selected (map (d/getf objects)) first :id)))]
(if (some? shape-id)
(ctf/dump-subtree file page-id shape-id libraries {:show-ids show-ids
:show-touched show-touched
:show-modified show-modified})
(println "no selected shape")))))
(defn ^:export dump-subtree
([shape-id] (dump-subtree' @st/state (uuid/uuid shape-id)))
([shape-id show-ids] (dump-subtree' @st/state (uuid/uuid shape-id) show-ids false false))
([shape-id show-ids show-touched] (dump-subtree' @st/state (uuid/uuid shape-id) show-ids show-touched false))
([shape-id show-ids show-touched show-modified] (dump-subtree' @st/state (uuid/uuid shape-id) show-ids show-touched show-modified)))
([shape-id] (dump-subtree' @st/state shape-id))
([shape-id show-ids] (dump-subtree' @st/state shape-id show-ids false false))
([shape-id show-ids show-touched] (dump-subtree' @st/state shape-id show-ids show-touched false))
([shape-id show-ids show-touched show-modified] (dump-subtree' @st/state shape-id show-ids show-touched show-modified)))
(when *assert*
(defonce debug-subscription