mirror of
https://github.com/penpot/penpot.git
synced 2025-02-02 20:39:09 -05:00
📚 Document visual debug utlities
This commit is contained in:
parent
85b17442de
commit
0512a8dc5f
2 changed files with 31 additions and 2 deletions
|
@ -3,7 +3,36 @@
|
||||||
This guide intends to explain the essential details of the frontend
|
This guide intends to explain the essential details of the frontend
|
||||||
application.
|
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
|
## Icons & Assets
|
||||||
|
|
|
@ -35,5 +35,5 @@
|
||||||
(logjs "state" @store/state))
|
(logjs "state" @store/state))
|
||||||
|
|
||||||
(defn dump-objects []
|
(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]))))
|
(logjs "state" (get-in @store/state [:workspace-data page-id :objects]))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue