Skip to content

Commit

Permalink
Update to egui 0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Mar 31, 2024
1 parent 2a3b432 commit 29c95c1
Show file tree
Hide file tree
Showing 8 changed files with 494 additions and 459 deletions.
918 changes: 478 additions & 440 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ egui_infinite_scroll = { path = "./crates/egui_infinite_scroll", version = "0.2.
egui_thumbhash = { path = "./crates/egui_thumbhash", version = "0.2.0" }
hello_egui = { path = ".", version = "0.3.0" }

egui = { version = "0.26.0", default-features = false }
eframe = { version = "0.26.0", default-features = false }
egui_extras = { version = "0.26.0", default-features = false }
egui = { version = "0.27.0", default-features = false }
eframe = { version = "0.27.0", default-features = false }
egui_extras = { version = "0.27.0", default-features = false }

[patch.crates-io]
taffy = { git = "https://github.com/DioxusLabs/taffy", branch = "main" }
#wry = { path = "../../RustroverProjects/github/wry" }
#
#egui = { path = "../../IdeaProjects/egui/crates/egui" }
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_dnd/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ impl<'a> Item<'a> {
size: Option<Vec2>,
body: impl FnOnce(&mut Ui, Handle, ItemState),
) -> InnerResponse<Rect> {
egui::Area::new("draggable_item")
egui::Area::new(Id::new("draggable_item"))
.interactable(false)
.fixed_pos(pos)
.show(ui.ctx(), |ui| {
Expand Down
12 changes: 6 additions & 6 deletions crates/egui_dnd/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl<'a> Handle<'a> {
None
};

let response = ui.scope(contents);
let response = ui.push_id(self.id.with("handle_ui"), |ui| contents(ui));

if let Some((selectable_labels, multi_widget_text_select)) = disabled {
ui.style_mut().interaction.selectable_labels = selectable_labels;
Expand All @@ -293,9 +293,9 @@ impl<'a> Handle<'a> {
ui.style_mut().interaction.multi_widget_text_select = false;
}
// We somehow have to push a new id here or there will be an id clash at response.interact
ui.push_id(self.id.with("handle"), add_contents)
ui.push_id(self.id.with("handle_ui"), add_contents)
});
self.handle_response(response.response, ui)
self.handle_response(response.inner.response, ui)
}

fn handle_response(&mut self, response: egui::Response, ui: &mut Ui) -> egui::Response {
Expand Down Expand Up @@ -335,9 +335,9 @@ impl<'a> Handle<'a> {
if let DragDetectionState::WaitingForClickThreshold { pressed_at } =
self.state.detection_state
{
// It should be save to stop anything else being dragged here
// It should be safe to stop anything else being dragged here
// This is important so any ScrollArea isn't being dragged while we wait for the click threshold
ui.memory_mut(|mem| mem.stop_dragging());
ui.ctx().stop_dragging();
if is_above_click_threshold
|| pressed_at.elapsed().unwrap_or_default()
> self.state.config(ui).click_tolerance_timeout
Expand Down Expand Up @@ -367,7 +367,7 @@ impl<'a> Handle<'a> {
.unwrap_or_default(),
hovering_last_item: false,
};
ui.memory_mut(|mem| mem.set_dragged_id(self.id));
ui.ctx().set_dragged_id(self.id);
}

response
Expand Down
8 changes: 3 additions & 5 deletions crates/egui_pull_to_refresh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,8 @@ impl PullToRefresh {
if can_refresh && !self.loading {
let sense = ui.interact(content_rect, self.id, Sense::hover());

let is_something_blocking_drag = ui.memory(|memory| {
memory.is_anything_being_dragged()
&& !allow_dragged_id.map_or(false, |id| memory.is_being_dragged(id))
});
let is_something_blocking_drag = ui.ctx().dragged_id().is_some()
&& !allow_dragged_id.map_or(false, |id| ui.ctx().is_being_dragged(id));

if sense.contains_pointer() && !is_something_blocking_drag {
let (delta, any_released) = ui.input(|input| {
Expand Down Expand Up @@ -238,7 +236,7 @@ impl PullToRefresh {
let offset_top = -spinner_size.y + spinner_size.y * anim_progress * 2.0;

if anim_progress > 0.0 {
Area::new("Pull to refresh indicator")
Area::new(Id::new("Pull to refresh indicator"))
.fixed_pos(content_rect.center_top())
.pivot(Align2::CENTER_TOP)
.show(ui.ctx(), |ui| {
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_taffy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ release = false
[dependencies]
egui.workspace = true

taffy = "=0.3.11"
taffy = "0.4.0"

[dev-dependencies]
eframe = {workspace = true, default-features = true}
Expand Down
2 changes: 1 addition & 1 deletion crates/perfect_cursors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ edition = "2021"
web-time = "1"

[dev-dependencies]
eframe = "0.26.2"
eframe = {workspace = true, default-features = true}
2 changes: 1 addition & 1 deletion fancy-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ serde_json = "1"

casey = "0.4.0"

egui_commonmark = { version = "0.12.0", features = [] }
egui_commonmark = { version = "0.14.0", features = [] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1", features = ["time", "rt", "macros"] }
Expand Down

0 comments on commit 29c95c1

Please sign in to comment.