Expose ui.cursor and ui.next_widget_position (#1342)
This commit is contained in:
parent
dd9699099f
commit
bc0fdefceb
|
|
@ -783,7 +783,17 @@ impl Ui {
|
|||
&self.placer
|
||||
}
|
||||
|
||||
pub(crate) fn cursor(&self) -> Rect {
|
||||
/// Where the next widget will be put.
|
||||
///
|
||||
/// One side of this will always be infinite: the direction in which new widgets will be added.
|
||||
/// The opposing side is what is incremented.
|
||||
/// The crossing sides are initialized to `max_rect`.
|
||||
///
|
||||
/// So one can think of `cursor` as a constraint on the available region.
|
||||
///
|
||||
/// If something has already been added, this will point to `style.spacing.item_spacing` beyond the latest child.
|
||||
/// The cursor can thus be `style.spacing.item_spacing` pixels outside of the min_rect.
|
||||
pub fn cursor(&self) -> Rect {
|
||||
self.placer.cursor()
|
||||
}
|
||||
|
||||
|
|
@ -792,7 +802,7 @@ impl Ui {
|
|||
}
|
||||
|
||||
/// Where do we expect a zero-sized widget to be placed?
|
||||
pub(crate) fn next_widget_position(&self) -> Pos2 {
|
||||
pub fn next_widget_position(&self) -> Pos2 {
|
||||
self.placer.next_widget_position()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue