Skip to content

Commit

Permalink
Account for border when determining position to draw SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Dec 20, 2024
1 parent f40316c commit 39a316e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/blitz-renderer-vello/src/renderer/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,12 @@ impl ElementCx<'_> {
let x_scale = width as f64 / svg_size.width() as f64;
let y_scale = height as f64 / svg_size.height() as f64;

let transform = Affine::translate((self.pos.x * self.scale, self.pos.y * self.scale))
.pre_scale_non_uniform(x_scale, y_scale);
let box_inset = self.frame.inner_rect.origin();
let transform = Affine::translate((
self.pos.x * self.scale + box_inset.x,
self.pos.y * self.scale + box_inset.y,
))
.pre_scale_non_uniform(x_scale, y_scale);

let fragment = vello_svg::render_tree(svg);
scene.append(&fragment, Some(transform));
Expand Down

0 comments on commit 39a316e

Please sign in to comment.