Minor cleanup around desired_rect
This commit is contained in:
parent
fade508c15
commit
9d1cf77aa7
2 changed files with 4 additions and 12 deletions
|
@ -185,7 +185,7 @@ impl GuiInput {
|
||||||
region.add(label!("scroll_delta: {:?}", self.scroll_delta));
|
region.add(label!("scroll_delta: {:?}", self.scroll_delta));
|
||||||
region.add(label!("screen_size: {:?}", self.screen_size));
|
region.add(label!("screen_size: {:?}", self.screen_size));
|
||||||
region.add(label!("pixels_per_point: {}", self.pixels_per_point));
|
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!("events: {:?}", self.events));
|
||||||
region.add(label!("dropped_files: {:?}", self.dropped_files));
|
region.add(label!("dropped_files: {:?}", self.dropped_files));
|
||||||
region.add(label!("hovered_files: {:?}", self.hovered_files));
|
region.add(label!("hovered_files: {:?}", self.hovered_files));
|
||||||
|
|
|
@ -186,7 +186,7 @@ impl Region {
|
||||||
|
|
||||||
/// Size of content
|
/// Size of content
|
||||||
pub fn bounding_size(&self) -> Vec2 {
|
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.
|
/// 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.
|
/// This how much more space we can take up without overflowing our parent.
|
||||||
/// Shrinks as cursor increments.
|
/// Shrinks as cursor increments.
|
||||||
pub fn available_space(&self) -> Vec2 {
|
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
|
self.bottom_right() - self.cursor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,14 +275,9 @@ impl Region {
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// Interaction
|
// Interaction
|
||||||
|
|
||||||
/// Check for clicks on this entire region (desired_rect)
|
/// Check for clicks on this entire region (rect())
|
||||||
pub fn interact_whole(&self) -> InteractInfo {
|
pub fn interact_whole(&self) -> InteractInfo {
|
||||||
self.ctx.interact(
|
self.interact_rect(&self.rect(), self.id)
|
||||||
self.layer,
|
|
||||||
&self.clip_rect,
|
|
||||||
&self.desired_rect,
|
|
||||||
Some(self.id),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn interact_rect(&self, rect: &Rect, id: Id) -> InteractInfo {
|
pub fn interact_rect(&self, rect: &Rect, id: Id) -> InteractInfo {
|
||||||
|
|
Loading…
Reference in a new issue