mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Horizontal scrolling (#663)
* First pass (missing rendering the bar) * Render horizontal bars, and change Window scroll API * emath: add impl Index + IndexMut for Align2 * Scrolling: fix subtle sizing bugs * Add horizontal scrolling to color test * try to wrap content before showing scrollbars, + add auto-shrink option * Add hscroll to the misc demo window * Fix for putting wrapping labels in an infinitely wide layout * Add a egui_asserts to protect against nans in the layout engine * Add line about horizontal scrolling to changelog * Add example to docs of ScrollArea * code cleanup
This commit is contained in:
@@ -172,6 +172,22 @@ impl Align2 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Index<usize> for Align2 {
|
||||
type Output = Align;
|
||||
|
||||
#[inline(always)]
|
||||
fn index(&self, index: usize) -> &Align {
|
||||
&self.0[index]
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::IndexMut<usize> for Align2 {
|
||||
#[inline(always)]
|
||||
fn index_mut(&mut self, index: usize) -> &mut Align {
|
||||
&mut self.0[index]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn center_size_in_rect(size: Vec2, frame: Rect) -> Rect {
|
||||
Align2::CENTER_CENTER.align_size_within_rect(size, frame)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user