Order debug JSON and allow elements to be named; copy to clipboard

This commit is contained in:
Nathan Sobo
2021-04-07 21:54:14 -06:00
parent cbb23a93a6
commit 9f6f27f305
15 changed files with 104 additions and 32 deletions
+5 -5
View File
@@ -244,7 +244,7 @@ impl Pane {
.with_max_width(264.0)
.boxed(),
)
.boxed(),
.named("tab"),
);
}
@@ -263,10 +263,10 @@ impl Pane {
.with_border(Border::bottom(1.0, border_color))
.boxed(),
)
.boxed(),
.named("filler"),
);
row.boxed()
row.named("tabs")
}
fn render_modified_icon(is_modified: bool) -> ElementBox {
@@ -304,9 +304,9 @@ impl View for Pane {
Flex::column()
.with_child(self.render_tabs(app))
.with_child(Expanded::new(1.0, ChildView::new(active_item.id()).boxed()).boxed())
.boxed()
.named("pane")
} else {
Empty::new().boxed()
Empty::new().named("pane")
}
}
+6 -2
View File
@@ -258,7 +258,11 @@ impl WorkspaceView {
pub fn debug_elements(&mut self, _: &(), ctx: &mut ViewContext<Self>) {
match to_string_pretty(&ctx.debug_elements()) {
Ok(json) => {
log::info!("{}", json);
ctx.app_mut().copy(&json);
log::info!(
"copied {:.1} KiB of element debug JSON to the clipboard",
json.len() as f32 / 1024.
);
}
Err(error) => {
log::error!("error debugging elements: {}", error);
@@ -373,7 +377,7 @@ impl View for WorkspaceView {
.boxed(),
)
.with_background_color(rgbu(0xea, 0xea, 0xeb))
.boxed()
.named("workspace")
}
fn on_focus(&mut self, ctx: &mut ViewContext<Self>) {