0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

📚 Document visual debug utlities

This commit is contained in:
Andrés Moya 2020-04-28 11:54:10 +02:00
parent 85b17442de
commit 0512a8dc5f
2 changed files with 31 additions and 2 deletions

View file

@ -3,7 +3,36 @@
This guide intends to explain the essential details of the frontend
application.
**TODO**
## Visual debug mode and utilities
Debugging a problem in the viewport algorithms for grouping and rotating
is difficult. We have set a visual debug mode that displays some
annotations on screen, to help understanding what's happening.
To activate it, open the REPL (`shadow-cljs cljs-repl main`) and type
```clojure
(ns uxbox.util.debug)
(debug-all!) ; to enable all visual aids
(debug! <option>) ; current options are :bounding-boxes :group :events :rotation-handler
```
Then you need to refresh the screen, for example by selecting some shape
with the mouse.
You can deactivate debug mode with
```clojure
(debug-none!) ; to disable all visual aids
(-debug! <option>) ; to disable only one
```
There are also some useful functions:
```clojure
(dump-state) ; to print in console all the global state
(dump-objects) ; to print in console all objects in workspace
(logjs <msg> <var>) ; to print the value of a variable
(tap <fn>) ; to include a function with side effect (e.g. logjs) in a transducer.
```
## Icons & Assets

View file

@ -35,5 +35,5 @@
(logjs "state" @store/state))
(defn dump-objects []
(let [page-id (get @store/state :page-id)]
(let [page-id (get @store/state :current-page-id)]
(logjs "state" (get-in @store/state [:workspace-data page-id :objects]))))