Browse Source

Minor cleanup around desired_rect

readable-ids
Emil Ernerfeldt 5 years ago
parent
commit
9d1cf77aa7
  1. 2
      emigui/src/input.rs
  2. 14
      emigui/src/region.rs

2
emigui/src/input.rs

@ -185,7 +185,7 @@ impl GuiInput {
region.add(label!("scroll_delta: {:?}", self.scroll_delta));
region.add(label!("screen_size: {:?}", self.screen_size));
region.add(label!("pixels_per_point: {}", self.pixels_per_point));
region.add(label!("time: {}", self.time));
region.add(label!("time: {:.3} s", self.time));
region.add(label!("events: {:?}", self.events));
region.add(label!("dropped_files: {:?}", self.dropped_files));
region.add(label!("hovered_files: {:?}", self.hovered_files));

14
emigui/src/region.rs

@ -186,7 +186,7 @@ impl Region {
/// Size of content
pub fn bounding_size(&self) -> Vec2 {
self.child_bounds.max - self.desired_rect.min
self.child_bounds.max - self.top_left()
}
/// Expand the bounding rect of this region to include a child at the given rect.
@ -218,9 +218,6 @@ impl Region {
/// This how much more space we can take up without overflowing our parent.
/// Shrinks as cursor increments.
pub fn available_space(&self) -> Vec2 {
// self.desired_rect.max - self.cursor
// If a child doesn't fit in desired_rect, we have effectively expanded:
self.bottom_right() - self.cursor
}
@ -278,14 +275,9 @@ impl Region {
// ------------------------------------------------------------------------
// Interaction
/// Check for clicks on this entire region (desired_rect)
/// Check for clicks on this entire region (rect())
pub fn interact_whole(&self) -> InteractInfo {
self.ctx.interact(
self.layer,
&self.clip_rect,
&self.desired_rect,
Some(self.id),
)
self.interact_rect(&self.rect(), self.id)
}
pub fn interact_rect(&self, rect: &Rect, id: Id) -> InteractInfo {

Loading…
Cancel
Save