Skip to content

Commit

Permalink
Changes from #1057
Browse files Browse the repository at this point in the history
  • Loading branch information
ForLoveOfCats committed Aug 27, 2020
1 parent c4f8a32 commit 5f7c985
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion druid/src/scroll_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,18 @@ impl ScrollComponent {
if self.scrollbars.opacity > 0.0 {
ctx.request_anim_frame();
}

let viewport = ctx.size().to_rect();
if viewport.width() < self.content_size.width {
ctx.request_paint_rect(
self.calc_horizontal_bar_bounds(viewport, env) - self.scroll_offset,
);
}
if viewport.height() < self.content_size.height {
ctx.request_paint_rect(
self.calc_vertical_bar_bounds(viewport, env) - self.scroll_offset,
);
}
}
}

Expand All @@ -451,7 +463,8 @@ impl ScrollComponent {
ctx.clip(viewport);
ctx.transform(Affine::translate(-self.scroll_offset));

let visible = ctx.region().to_rect() + self.scroll_offset;
let mut visible = ctx.region().clone();
visible += self.scroll_offset;
f(visible.into(), ctx);

self.draw_bars(ctx, viewport, env);
Expand Down

0 comments on commit 5f7c985

Please sign in to comment.