mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 12:50:04 -04:00
Use the minus character instead of "dash" (#3271)
* Use the minus character instead of "dash" See https://github.com/rerun-io/rerun/issues/3053 * docstring * fix
This commit is contained in:
@@ -788,7 +788,7 @@ impl Key {
|
||||
Key::ArrowLeft => "⏴",
|
||||
Key::ArrowRight => "⏵",
|
||||
Key::ArrowUp => "⏶",
|
||||
Key::Minus => "-",
|
||||
Key::Minus => crate::MINUS_CHAR_STR,
|
||||
Key::PlusEquals => "+",
|
||||
_ => self.name(),
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//! fn ui_counter(ui: &mut egui::Ui, counter: &mut i32) {
|
||||
//! // Put the buttons and label on the same row:
|
||||
//! ui.horizontal(|ui| {
|
||||
//! if ui.button("-").clicked() {
|
||||
//! if ui.button("−").clicked() {
|
||||
//! *counter -= 1;
|
||||
//! }
|
||||
//! ui.label(counter.to_string());
|
||||
@@ -467,6 +467,9 @@ macro_rules! egui_assert {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// The minus character: <https://www.compart.com/en/unicode/U+2212>
|
||||
pub(crate) const MINUS_CHAR_STR: &str = "−";
|
||||
|
||||
/// The default egui fonts supports around 1216 emojis in total.
|
||||
/// Here are some of the most useful:
|
||||
/// ∞⊗⎗⎘⎙⏏⏴⏵⏶⏷
|
||||
|
||||
@@ -271,7 +271,7 @@ impl<'a> DragValue<'a> {
|
||||
self.custom_formatter(move |n, _| format!("{:0>min_width$b}", n as i64))
|
||||
} else {
|
||||
self.custom_formatter(move |n, _| {
|
||||
let sign = if n < 0.0 { "-" } else { "" };
|
||||
let sign = if n < 0.0 { MINUS_CHAR_STR } else { "" };
|
||||
format!("{sign}{:0>min_width$b}", n.abs() as i64)
|
||||
})
|
||||
}
|
||||
@@ -306,7 +306,7 @@ impl<'a> DragValue<'a> {
|
||||
self.custom_formatter(move |n, _| format!("{:0>min_width$o}", n as i64))
|
||||
} else {
|
||||
self.custom_formatter(move |n, _| {
|
||||
let sign = if n < 0.0 { "-" } else { "" };
|
||||
let sign = if n < 0.0 { MINUS_CHAR_STR } else { "" };
|
||||
format!("{sign}{:0>min_width$o}", n.abs() as i64)
|
||||
})
|
||||
}
|
||||
@@ -345,11 +345,11 @@ impl<'a> DragValue<'a> {
|
||||
self.custom_formatter(move |n, _| format!("{:0>min_width$x}", n as i64))
|
||||
}
|
||||
(false, true) => self.custom_formatter(move |n, _| {
|
||||
let sign = if n < 0.0 { "-" } else { "" };
|
||||
let sign = if n < 0.0 { MINUS_CHAR_STR } else { "" };
|
||||
format!("{sign}{:0>min_width$X}", n.abs() as i64)
|
||||
}),
|
||||
(false, false) => self.custom_formatter(move |n, _| {
|
||||
let sign = if n < 0.0 { "-" } else { "" };
|
||||
let sign = if n < 0.0 { MINUS_CHAR_STR } else { "" };
|
||||
format!("{sign}{:0>min_width$x}", n.abs() as i64)
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ impl<'a> Slider<'a> {
|
||||
self.custom_formatter(move |n, _| format!("{:0>min_width$b}", n as i64))
|
||||
} else {
|
||||
self.custom_formatter(move |n, _| {
|
||||
let sign = if n < 0.0 { "-" } else { "" };
|
||||
let sign = if n < 0.0 { MINUS_CHAR_STR } else { "" };
|
||||
format!("{sign}{:0>min_width$b}", n.abs() as i64)
|
||||
})
|
||||
}
|
||||
@@ -430,7 +430,7 @@ impl<'a> Slider<'a> {
|
||||
self.custom_formatter(move |n, _| format!("{:0>min_width$o}", n as i64))
|
||||
} else {
|
||||
self.custom_formatter(move |n, _| {
|
||||
let sign = if n < 0.0 { "-" } else { "" };
|
||||
let sign = if n < 0.0 { MINUS_CHAR_STR } else { "" };
|
||||
format!("{sign}{:0>min_width$o}", n.abs() as i64)
|
||||
})
|
||||
}
|
||||
@@ -469,11 +469,11 @@ impl<'a> Slider<'a> {
|
||||
self.custom_formatter(move |n, _| format!("{:0>min_width$x}", n as i64))
|
||||
}
|
||||
(false, true) => self.custom_formatter(move |n, _| {
|
||||
let sign = if n < 0.0 { "-" } else { "" };
|
||||
let sign = if n < 0.0 { MINUS_CHAR_STR } else { "" };
|
||||
format!("{sign}{:0>min_width$X}", n.abs() as i64)
|
||||
}),
|
||||
(false, false) => self.custom_formatter(move |n, _| {
|
||||
let sign = if n < 0.0 { "-" } else { "" };
|
||||
let sign = if n < 0.0 { MINUS_CHAR_STR } else { "" };
|
||||
format!("{sign}{:0>min_width$x}", n.abs() as i64)
|
||||
}),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user