mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Make Debug format of Vec2/Pos2/Rot2 respect user precision (#4671)
* closes #4665 pretty self explanatory, i opted for 3 instead of 2 since i think that's what display does
This commit is contained in:
@@ -468,7 +468,11 @@ impl Div<f32> for Vec2 {
|
||||
|
||||
impl fmt::Debug for Vec2 {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "[{:.1} {:.1}]", self.x, self.y)
|
||||
if let Some(precision) = f.precision() {
|
||||
write!(f, "[{1:.0$} {2:.0$}]", precision, self.x, self.y)
|
||||
} else {
|
||||
write!(f, "[{:.1} {:.1}]", self.x, self.y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user