mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
Fix tooltips sometimes changing position each frame (#7304)
There was a bug in how we decide where to place a `Tooltip` (or other `Popup`), which could lead to tooltips jumping around every frame, especially if it changed size slightly. The new code is simpler and bug-free.
This commit is contained in:
@@ -146,7 +146,7 @@ impl Align {
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// Two-dimension alignment, e.g. [`Align2::LEFT_TOP`].
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct Align2(pub [Align; 2]);
|
||||
|
||||
@@ -298,3 +298,9 @@ impl std::ops::IndexMut<usize> for Align2 {
|
||||
pub fn center_size_in_rect(size: Vec2, frame: Rect) -> Rect {
|
||||
Align2::CENTER_CENTER.align_size_within_rect(size, frame)
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Align2 {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "Align2({:?}, {:?})", self.x(), self.y())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user