Update egui/wgpu one major version

This commit is contained in:
2025-08-03 14:11:33 -04:00
parent 052e3e5c03
commit 43288fc71f
5 changed files with 162 additions and 102 deletions
+18 -24
View File
@@ -6,8 +6,8 @@ use std::{
use atoi::FromRadix16;
use egui::{
Align, Color32, CursorIcon, Event, Frame, Key, Layout, Margin, Rect, Response, RichText,
Rounding, Sense, Shape, Stroke, TextEdit, Ui, UiBuilder, Vec2, Widget, WidgetText,
Align, Color32, CornerRadius, CursorIcon, Event, Frame, Key, Layout, Margin, Rect, Response,
RichText, Sense, Shape, Stroke, StrokeKind, TextEdit, Ui, UiBuilder, Vec2, Widget, WidgetText,
ecolor::HexColor,
};
use num_traits::{CheckedAdd, CheckedSub, One};
@@ -37,8 +37,8 @@ impl UiExt for Ui {
fn section(&mut self, title: impl Into<String>, add_contents: impl FnOnce(&mut Ui)) {
let title: String = title.into();
let mut frame = Frame::group(self.style());
frame.outer_margin.top += 10.0;
frame.inner_margin.top += 2.0;
frame.outer_margin.top += 10;
frame.inner_margin.top += 2;
let res = self.push_id(&title, |ui| {
frame.show(ui, |ui| {
ui.set_max_width(ui.available_width());
@@ -73,7 +73,8 @@ impl UiExt for Ui {
self.painter().rect_filled(right_rect, 0.0, right);
let style = self.style().interact(&response);
self.painter().rect_stroke(rect, 0.0, style.fg_stroke);
self.painter()
.rect_stroke(rect, 0.0, style.fg_stroke, StrokeKind::Inside);
response
}
@@ -265,10 +266,10 @@ impl<T: Number> Widget for NumberEdit<'_, T> {
.id(id)
.desired_width(desired_width)
.margin(Margin {
left: 4.0,
right: if self.arrows { 20.0 } else { 4.0 },
top: 2.0,
bottom: 2.0,
left: 4,
right: if self.arrows { 20 } else { 4 },
top: 2,
bottom: 2,
});
let mut res = if valid {
ui.add(text)
@@ -337,7 +338,7 @@ impl<T: Number> Widget for NumberEdit<'_, T> {
}
str = to_string(self.value);
stale = true;
} else if res.changed {
} else if res.changed() {
if let Some(new_value) = from_string(&str).filter(in_range) {
if *self.value != new_value {
res.mark_changed();
@@ -355,27 +356,20 @@ impl<T: Number> Widget for NumberEdit<'_, T> {
fn draw_arrow(ui: &mut Ui, rect: Rect, up: bool) -> Response {
let arrow_res = ui
.allocate_rect(
rect,
Sense {
click: true,
drag: true,
focusable: false,
},
)
.allocate_rect(rect, Sense::all())
.on_hover_cursor(CursorIcon::Default);
let visuals = ui.style().visuals.widgets.style(&arrow_res);
let painter = ui.painter_at(arrow_res.rect);
let rounding = if up {
Rounding {
ne: 2.0,
..Rounding::ZERO
CornerRadius {
ne: 2,
..CornerRadius::ZERO
}
} else {
Rounding {
se: 2.0,
..Rounding::ZERO
CornerRadius {
se: 2,
..CornerRadius::ZERO
}
};
painter.rect_filled(arrow_res.rect, rounding, visuals.bg_fill);