Skip to main content

egui/data/input/
safe_area_insets.rs

1use epaint::MarginF32;
2
3use crate::emath::Rect;
4
5/// The 'safe area' insets of the screen
6///
7/// This represents the area taken up by the status bar, navigation controls, notches,
8/// or any other items that obscure parts of the screen.
9#[derive(Debug, PartialEq, Copy, Clone, Default)]
10#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
11pub struct SafeAreaInsets(pub MarginF32);
12
13impl core::ops::Sub<SafeAreaInsets> for Rect {
14    type Output = Self;
15
16    fn sub(self, rhs: SafeAreaInsets) -> Self::Output {
17        self - rhs.0
18    }
19}