egui icon indicating copy to clipboard operation
egui copied to clipboard

`Debug` impl for `Vec2` discards important information

Open SludgePhD opened this issue 6 months ago • 1 comments

Describe the bug

Formatting a Vec2 with {:?} leads to its Debug impl to format both coordinates with {:.1}, which discards any decimal digits after the first.

https://github.com/emilk/egui/blob/a085d0b3a5a4aa70d7ca4ddedbcc9ed53c758b7b/crates/emath/src/vec2.rs#L485-L493

To Reproduce Steps to reproduce the behavior:

  1. format!("{:?}", vec2(0.01, -0.01))
  2. "[0.0 -0.0]"

(untested)

Expected behavior

Formatting a value should not discard important information. Debug especially shouldn't be doing that.

Note that the Display impl does not have this problem.

SludgePhD avatar May 25 '25 15:05 SludgePhD

should be fixed in: https://github.com/emilk/egui/pull/7089

bircni avatar May 25 '25 20:05 bircni