Made Region::clip_rect private

This commit is contained in:
Emil Ernerfeldt 2020-05-05 02:33:27 +02:00
parent 24ce7b4145
commit be93d5b0e0
3 changed files with 5 additions and 3 deletions

View file

@ -113,7 +113,9 @@ impl CollapsingHeader {
)
};
region.clip_rect.max.y = region.clip_rect.max.y.min(region.cursor().y + max_height);
let mut clip_rect = region.clip_rect();
clip_rect.max.y = clip_rect.max.y.min(region.cursor().y + max_height);
region.set_clip_rect(clip_rect);
add_contents(region);

View file

@ -216,7 +216,7 @@ impl Painting {
region.add_custom_contents(vec2(f32::INFINITY, 200.0), |region| {
let canvas_corner = region.cursor();
let interact = region.reserve_space(region.available_space(), Some(region.id()));
region.clip_rect = region.clip_rect.intersect(&interact.rect); // Make sure we don't paint out of bounds
region.set_clip_rect(region.clip_rect().intersect(&interact.rect)); // Make sure we don't paint out of bounds
if self.lines.is_empty() {
self.lines.push(vec![]);

View file

@ -22,7 +22,7 @@ pub struct Region {
/// Everything painte in this rect will be clipped against this.
/// This means nothing outside of this rectangle will be visible on screen.
pub(crate) clip_rect: Rect,
clip_rect: Rect,
/// The `rect` represents where in space the region is
/// and its max size (original available_space).