Skip to main content

egui/data/input/
pointer_button.rs

1/// Mouse button (or similar for touch input)
2#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
4pub enum PointerButton {
5    /// The primary mouse button is usually the left one.
6    Primary = 0,
7
8    /// The secondary mouse button is usually the right one,
9    /// and most often used for context menus or other optional things.
10    Secondary = 1,
11
12    /// The tertiary mouse button is usually the middle mouse button (e.g. clicking the scroll wheel).
13    Middle = 2,
14
15    /// The first extra mouse button on some mice. In web typically corresponds to the Browser back button.
16    Extra1 = 3,
17
18    /// The second extra mouse button on some mice. In web typically corresponds to the Browser forward button.
19    Extra2 = 4,
20}
21
22/// Number of pointer buttons supported by egui, i.e. the number of possible states of [`PointerButton`].
23pub const NUM_POINTER_BUTTONS: usize = 5;