Expand description
Debug inspection helpers.
The properties in this module can be set on a window or widget to visualize layout and render internals.
The INSPECTOR service can be used to configure the inspector window, add custom watchers.
Note that you can use the cmd::INSPECT_CMD command to open the Inspector.
§Examples
The example below registers two custom live updating watchers.
window::inspector::INSPECTOR.register_watcher(|wgt, builder| {
// watch custom info metadata
use zng::markdown::WidgetInfoExt as _;
let watcher = wgt.info().map(|i| formatx!("{:?}", i.anchor()));
builder.insert("markdown.anchor", watcher);
// watch value that can change every layout/render without info rebuild
let watcher = wgt.render_watcher(|i| formatx!("{:?}", i.bounds_info().inline().is_some()));
builder.insert("is_inlined", watcher);
});The closure is called on widget selection change (in the inspector screen), the values are presented in the
/* INFO */ section of the properties panel.
§Full API
See zng_wgt_inspector for the full API.
Structs§
- INSPECTOR
- Service that configures the live inspector.
- Inspected
Info InspectorInfothat can be placed in a variable.- Inspected
Tree - Represents an actively inspected widget tree.
- Inspected
Widget - Represents an actively inspected widget.
- Inspector
Watcher Builder - Builder for
INSPECTOR.register_watcher.
Enums§
- Inspect
Mode - Target of inspection properties.
Functions§
- show_
bounds PDraws a border for every target widget’s outer and inner bounds.- show_
center_ points PDraws a debug dot in target widget’s center point.- show_
directional_ query PDraw the directional query for closest sibling of the hovered focusable widget.- show_
hit_ test PDraws the inner bounds that where tested for the mouse point.- show_
rows PDraws a border over every inlined widget row in the window.