Skip to content

Commit

Permalink
Account for viewport scroll in debug overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Sep 17, 2024
1 parent 5eb9fba commit 110b6a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/blitz/src/renderer/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ impl<'dom> VelloSceneGenerator<'dom> {
fn render_debug_overlay(&self, scene: &mut Scene, node_id: usize) {
let scale = self.scale;

let viewport_scroll = self.dom.as_ref().viewport_scroll();
let mut node = &self.dom.as_ref().tree()[node_id];

let taffy::Layout {
Expand Down Expand Up @@ -172,6 +173,9 @@ impl<'dom> VelloSceneGenerator<'dom> {
abs_y += y;
}

abs_x -= viewport_scroll.x as f32;
abs_y -= viewport_scroll.y as f32;

// Hack: scale factor
let abs_x = f64::from(abs_x) * scale;
let abs_y = f64::from(abs_y) * scale;
Expand Down

0 comments on commit 110b6a4

Please sign in to comment.