1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Use IdSalt everywhere

This commit is contained in:
lucasmerlin
2026-03-24 14:10:06 +01:00
parent 0686107840
commit 0953c8c285
13 changed files with 43 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
use egui::{Id, Pos2, Rect, Response, Sense, Ui, UiBuilder, emath::GuiRounding as _};
use egui::{Pos2, Rect, Response, Sense, Ui, UiBuilder, emath::GuiRounding as _};
#[derive(Clone, Copy)]
pub(crate) enum CellSize {
@@ -117,7 +117,7 @@ impl<'l> StripLayout<'l> {
flags: StripLayoutFlags,
width: CellSize,
height: CellSize,
child_ui_id_salt: Id,
child_ui_id_salt: egui::IdSalt,
add_cell_contents: impl FnOnce(&mut Ui),
) -> (Rect, Response) {
let max_rect = self.cell_rect(&width, &height);
@@ -201,7 +201,7 @@ impl<'l> StripLayout<'l> {
&mut self,
flags: StripLayoutFlags,
max_rect: Rect,
child_ui_id_salt: egui::Id,
child_ui_id_salt: egui::IdSalt,
add_cell_contents: impl FnOnce(&mut Ui),
) -> Ui {
let mut ui_builder = UiBuilder::new()

View File

@@ -198,7 +198,7 @@ impl Strip<'_, '_> {
flags,
width,
height,
egui::Id::new(self.size_index),
egui::IdSalt::new(self.size_index),
add_contents,
);
}

View File

@@ -4,7 +4,7 @@
//! Takes all available height, so if you want something below the table, put it in a strip.
use egui::{
Align, Id, NumExt as _, Rangef, Rect, Response, ScrollArea, Ui, Vec2, Vec2b,
Align, NumExt as _, Rangef, Rect, Response, ScrollArea, Ui, Vec2, Vec2b,
scroll_area::{ScrollAreaOutput, ScrollBarVisibility, ScrollSource},
};
@@ -246,7 +246,7 @@ impl Default for TableScrollOptions {
/// ```
pub struct TableBuilder<'a> {
ui: &'a mut Ui,
id_salt: Id,
id_salt: egui::IdSalt,
columns: Vec<Column>,
striped: Option<bool>,
resizable: bool,
@@ -260,7 +260,7 @@ impl<'a> TableBuilder<'a> {
let cell_layout = *ui.layout();
Self {
ui,
id_salt: Id::new("__table_state"),
id_salt: egui::IdSalt::from("__table_state"),
columns: Default::default(),
striped: None,
resizable: false,
@@ -284,7 +284,7 @@ impl<'a> TableBuilder<'a> {
/// This is required if you have multiple tables in the same [`Ui`].
#[inline]
pub fn id_salt(mut self, id_salt: impl Into<egui::IdSalt>) -> Self {
self.id_salt = id_salt.into().id();
self.id_salt = id_salt.into();
self
}
@@ -1314,7 +1314,7 @@ impl TableRow<'_, '_> {
flags,
width,
height,
egui::Id::new((self.row_index, col_index)),
egui::IdSalt::new((self.row_index, col_index)),
add_cell_contents,
);