Browse Source

Made Region::clip_rect private

readable-ids
Emil Ernerfeldt 5 years ago
parent
commit
be93d5b0e0
  1. 4
      emigui/src/containers/collapsing_header.rs
  2. 2
      emigui/src/example_app.rs
  3. 2
      emigui/src/region.rs

4
emigui/src/containers/collapsing_header.rs

@ -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);

2
emigui/src/example_app.rs

@ -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![]);

2
emigui/src/region.rs

@ -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).

Loading…
Cancel
Save