Skip to content

Commit

Permalink
feat: add debug boxes (#308)
Browse files Browse the repository at this point in the history
* feat: Add debug boxes behind debug flag

* fmt
  • Loading branch information
kokoISnoTarget authored Apr 13, 2024
1 parent c0541d7 commit 7793f97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ keywords = ["markdown", "viewer", "gpu"]
default = ["wayland", "x11"]
x11 = ["copypasta/x11", "winit/x11"]
wayland = ["copypasta/wayland", "winit/wayland"]
debug = []

[dependencies]
winit = { version = "0.28.7", default-features = false }
Expand Down
11 changes: 11 additions & 0 deletions src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,17 @@ impl Renderer {
}
}
}
#[cfg(feature = "debug")]
{
let mut rect = element
.bounds
.as_ref()
.context("Element not positioned")?
.clone();
rect.pos.1 -= self.scroll_y;
let color = glyphon::Color::rgb(255, 0, 255).0;
let _ = self.stroke_rectangle(rect, native_color(color, &self.surface_format), 1.0);
}
}
self.draw_scrollbar()?;
Ok(text_areas)
Expand Down

0 comments on commit 7793f97

Please sign in to comment.