Add ability to debug element trees as JSON
This commit is contained in:
parent
57a3207897
commit
0664321125
25 changed files with 554 additions and 41 deletions
|
@ -6,10 +6,12 @@ use gpui::{
|
|||
vector::{vec2f, Vector2F},
|
||||
PathBuilder,
|
||||
},
|
||||
json::{self, ToJson},
|
||||
text_layout::{self, TextLayoutCache},
|
||||
AfterLayoutContext, AppContext, Border, Element, Event, EventContext, FontCache, LayoutContext,
|
||||
PaintContext, Quad, Scene, SizeConstraint, ViewHandle,
|
||||
};
|
||||
use json::json;
|
||||
use smallvec::SmallVec;
|
||||
use std::cmp::Ordering;
|
||||
use std::{
|
||||
|
@ -477,6 +479,19 @@ impl Element for BufferElement {
|
|||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn debug(
|
||||
&self,
|
||||
bounds: RectF,
|
||||
_: &Self::LayoutState,
|
||||
_: &Self::PaintState,
|
||||
_: &gpui::DebugContext,
|
||||
) -> json::Value {
|
||||
json!({
|
||||
"type": "BufferElement",
|
||||
"bounds": bounds.to_json()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LayoutState {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue