Add ability to debug element trees as JSON

This commit is contained in:
Nathan Sobo
2021-04-07 21:54:14 -06:00
parent 57a3207897
commit 0664321125
25 changed files with 554 additions and 41 deletions
+14 -3
View File
@@ -2,9 +2,10 @@ use gpui::{
color::ColorU,
fonts::{Properties, Weight},
platform::{current as platform, Runner},
Element as _, Quad,
DebugContext, Element as _, Quad,
};
use log::LevelFilter;
use pathfinder_geometry::rect::RectF;
use simplelog::SimpleLogger;
fn main() {
@@ -59,7 +60,7 @@ impl gpui::Element for TextElement {
fn paint(
&mut self,
bounds: pathfinder_geometry::rect::RectF,
bounds: RectF,
_: &mut Self::LayoutState,
ctx: &mut gpui::PaintContext,
) -> Self::PaintState {
@@ -109,11 +110,21 @@ impl gpui::Element for TextElement {
fn dispatch_event(
&mut self,
_: &gpui::Event,
_: pathfinder_geometry::rect::RectF,
_: RectF,
_: &mut Self::LayoutState,
_: &mut Self::PaintState,
_: &mut gpui::EventContext,
) -> bool {
false
}
fn debug(
&self,
_: RectF,
_: &Self::LayoutState,
_: &Self::PaintState,
_: &DebugContext,
) -> gpui::json::Value {
todo!()
}
}