mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
small code cleanup
This commit is contained in:
@@ -117,6 +117,10 @@ pub struct Strip<'a, 'b> {
|
||||
|
||||
impl<'a, 'b> Strip<'a, 'b> {
|
||||
fn next_cell_size(&mut self) -> (CellSize, CellSize) {
|
||||
assert!(
|
||||
!self.sizes.is_empty(),
|
||||
"Tried using more strip cells than available."
|
||||
);
|
||||
let size = self.sizes[0];
|
||||
self.sizes = &self.sizes[1..];
|
||||
|
||||
@@ -128,21 +132,11 @@ impl<'a, 'b> Strip<'a, 'b> {
|
||||
|
||||
/// Add empty cell
|
||||
pub fn empty(&mut self) {
|
||||
assert!(
|
||||
!self.sizes.is_empty(),
|
||||
"Tried using more strip cells than available."
|
||||
);
|
||||
|
||||
let (width, height) = self.next_cell_size();
|
||||
self.layout.empty(width, height);
|
||||
}
|
||||
|
||||
fn cell_impl(&mut self, clip: bool, add_contents: impl FnOnce(&mut Ui)) {
|
||||
assert!(
|
||||
!self.sizes.is_empty(),
|
||||
"Tried using more strip cells than available."
|
||||
);
|
||||
|
||||
let (width, height) = self.next_cell_size();
|
||||
self.layout.add(width, height, clip, add_contents);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ use crate::{
|
||||
};
|
||||
|
||||
use egui::{Response, Ui};
|
||||
use std::cmp;
|
||||
|
||||
/// Builder for a [`Table`] with (optional) fixed header and scrolling body.
|
||||
///
|
||||
@@ -226,7 +225,7 @@ impl<'a> TableBody<'a> {
|
||||
|
||||
let max_height = self.end_y - self.start_y;
|
||||
let count = (max_height / height).ceil() as usize;
|
||||
let end = cmp::min(start + count, rows);
|
||||
let end = rows.min(start + count);
|
||||
|
||||
for idx in start..end {
|
||||
row(
|
||||
|
||||
Reference in New Issue
Block a user