📎 Allow to debug touched attibute

This commit is contained in:
Andrés Moya 2020-09-30 13:46:45 +02:00 committed by Alonso Torres
parent e26ba1fabd
commit d5e70e51ba

View file

@ -76,7 +76,9 @@
(let [page-id (get @state :current-page-id)] (let [page-id (get @state :current-page-id)]
(logjs "state" (get-in @state [:workspace-data :pages-index page-id :objects])))) (logjs "state" (get-in @state [:workspace-data :pages-index page-id :objects]))))
(defn ^:export dump-tree [] (defn ^:export dump-tree
([] (dump-tree false))
([show-touched]
(let [page-id (get @state :current-page-id) (let [page-id (get @state :current-page-id)
objects (get-in @state [:workspace-data :pages-index page-id :objects]) objects (get-in @state [:workspace-data :pages-index page-id :objects])
components (get-in @state [:workspace-data :components]) components (get-in @state [:workspace-data :components])
@ -90,6 +92,10 @@
{:length 20 {:length 20
:type :right}) :type :right})
(show-component shape objects)) (show-component shape objects))
(when (and show-touched (seq (:touched shape)))
(println (str (str/repeat " " level)
" "
(str (:touched shape)))))
(when (:shapes shape) (when (:shapes shape)
(dorun (for [shape-id (:shapes shape)] (dorun (for [shape-id (:shapes shape)]
(show-shape shape-id (inc level) objects)))))) (show-shape shape-id (inc level) objects))))))
@ -121,5 +127,5 @@
(do (do
(println) (println)
(println (str/format "[%s]" (:name component))) (println (str/format "[%s]" (:name component)))
(show-shape (:id component) 0 (:objects component)))))))) (show-shape (:id component) 0 (:objects component)))))))))