From bbdf2a41d5533436b2a667ddd6b9e6a58f55afd5 Mon Sep 17 00:00:00 2001 From: Etienne Date: Thu, 4 Jul 2024 11:13:06 +0200 Subject: [PATCH] Update egui to 0.28 and glam to 0.28 --- Cargo.toml | 12 ++++++------ crates/transform-gizmo/src/shape.rs | 27 ++++++++++++++++----------- examples/egui/src/main.rs | 4 ++-- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2afec62..17c2429 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,12 +16,12 @@ transform-gizmo = { version = "0.2.0", path = "crates/transform-gizmo" } transform-gizmo-egui = { version = "0.2.0", path = "crates/transform-gizmo-egui" } transform-gizmo-bevy = { version = "0.2.0", path = "crates/transform-gizmo-bevy" } -egui = "0.27.2" -eframe = "0.27.2" -emath = "0.27.2" -epaint = "0.27.2" -ecolor = "0.27.2" -glam = { version = "0.27.0", features = ["mint"] } +egui = "0.28.0" +eframe = "0.28.0" +emath = "0.28.0" +epaint = "0.28.0" +ecolor = "0.28.0" +glam = { version = "0.28.0", features = ["mint"] } mint = "0.5" enum_dispatch = "0.3.12" ahash = "0.8.7" diff --git a/crates/transform-gizmo/src/shape.rs b/crates/transform-gizmo/src/shape.rs index e1c0c01..e70c3da 100644 --- a/crates/transform-gizmo/src/shape.rs +++ b/crates/transform-gizmo/src/shape.rs @@ -3,7 +3,7 @@ use std::f64::consts::TAU; use crate::math::{Pos2, Rect}; use ecolor::Color32; use epaint::{Mesh, TessellationOptions, Tessellator, TextureId}; -pub(crate) use epaint::{Shape, Stroke}; +pub(crate) use epaint::{PathStroke, Shape, Stroke}; use glam::{DMat4, DVec3}; use crate::math::world_to_screen; @@ -69,7 +69,7 @@ impl ShapeBuidler { radius: f64, start_angle: f64, end_angle: f64, - stroke: impl Into, + stroke: impl Into, ) -> Mesh { let mut points = self.arc_points(radius, start_angle, end_angle); @@ -81,13 +81,13 @@ impl ShapeBuidler { self.tessellate_shape(if closed { points.pop(); - Shape::closed_line(points, stroke) + Shape::closed_line(points, stroke.into()) } else { - Shape::line(points, stroke) + Shape::line(points, stroke.into()) }) } - pub(crate) fn circle(&self, radius: f64, stroke: impl Into) -> Mesh { + pub(crate) fn circle(&self, radius: f64, stroke: impl Into) -> Mesh { self.arc(radius, 0.0, TAU, stroke) } @@ -95,7 +95,7 @@ impl ShapeBuidler { &self, radius: f64, color: Color32, - stroke: impl Into, + stroke: impl Into, ) -> Mesh { let mut points = self.arc_points(radius, 0.0, TAU); points.pop(); @@ -103,7 +103,12 @@ impl ShapeBuidler { self.tessellate_shape(Shape::convex_polygon(points, color, stroke.into())) } - pub(crate) fn line_segment(&self, from: DVec3, to: DVec3, stroke: impl Into) -> Mesh { + pub(crate) fn line_segment( + &self, + from: DVec3, + to: DVec3, + stroke: impl Into, + ) -> Mesh { let mut points: [Pos2; 2] = Default::default(); for (i, point) in points.iter_mut().enumerate() { @@ -131,7 +136,7 @@ impl ShapeBuidler { Shape::convex_polygon( vec![start - cross, start + cross, end], stroke.color, - Stroke::NONE, + PathStroke::NONE, ) } else { Shape::Noop @@ -142,7 +147,7 @@ impl ShapeBuidler { &self, points: &[DVec3], fill: impl Into, - stroke: impl Into, + stroke: impl Into, ) -> Mesh { let points = points .iter() @@ -156,7 +161,7 @@ impl ShapeBuidler { }) } - pub(crate) fn polyline(&self, points: &[DVec3], stroke: impl Into) -> Mesh { + pub(crate) fn polyline(&self, points: &[DVec3], stroke: impl Into) -> Mesh { let points = points .iter() .filter_map(|pos| world_to_screen(self.viewport, self.mvp, *pos)) @@ -175,7 +180,7 @@ impl ShapeBuidler { start_angle: f64, end_angle: f64, fill: impl Into, - stroke: impl Into, + stroke: impl Into, ) -> Mesh { let angle_delta = end_angle - start_angle; let step_count = steps(angle_delta.abs()); diff --git a/examples/egui/src/main.rs b/examples/egui/src/main.rs index 458f6ea..3209b07 100644 --- a/examples/egui/src/main.rs +++ b/examples/egui/src/main.rs @@ -162,10 +162,10 @@ impl eframe::App for ExampleApp { } } -fn main() -> eframe::Result<()> { +fn main() -> eframe::Result { eframe::run_native( "transform_gizmo_egui example", NativeOptions::default(), - Box::new(|_| Box::new(ExampleApp::new())), + Box::new(|_| Ok(Box::new(ExampleApp::new()))), ) }