mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Merge branch 'main' into style_modifier
This commit is contained in:
@@ -319,7 +319,9 @@ pub struct InputState {
|
||||
/// Which modifier keys are down at the start of the frame?
|
||||
pub modifiers: Modifiers,
|
||||
|
||||
// The keys that are currently being held down.
|
||||
/// The keys that are currently being held down.
|
||||
///
|
||||
/// Keys released this frame are NOT considered down.
|
||||
pub keys_down: HashSet<Key>,
|
||||
|
||||
/// In-order events received this frame
|
||||
@@ -765,6 +767,8 @@ impl InputState {
|
||||
}
|
||||
|
||||
/// Is the given key currently held down?
|
||||
///
|
||||
/// Keys released this frame are NOT considered down.
|
||||
pub fn key_down(&self, desired_key: Key) -> bool {
|
||||
self.keys_down.contains(&desired_key)
|
||||
}
|
||||
@@ -1018,6 +1022,7 @@ pub struct PointerState {
|
||||
/// Used for calculating velocity of pointer.
|
||||
pos_history: History<Pos2>,
|
||||
|
||||
/// Buttons currently down, excluding those released this frame.
|
||||
down: [bool; NUM_POINTER_BUTTONS],
|
||||
|
||||
/// Where did the current click/drag originate?
|
||||
@@ -1405,6 +1410,8 @@ impl PointerState {
|
||||
}
|
||||
|
||||
/// Is any pointer button currently down?
|
||||
///
|
||||
/// Buttons released this frame are NOT considered down.
|
||||
pub fn any_down(&self) -> bool {
|
||||
self.down.iter().any(|&down| down)
|
||||
}
|
||||
@@ -1460,6 +1467,8 @@ impl PointerState {
|
||||
}
|
||||
|
||||
/// Is this button currently down?
|
||||
///
|
||||
/// Buttons released this frame are NOT considered down.
|
||||
#[inline(always)]
|
||||
pub fn button_down(&self, button: PointerButton) -> bool {
|
||||
self.down[button as usize]
|
||||
@@ -1516,18 +1525,24 @@ impl PointerState {
|
||||
}
|
||||
|
||||
/// Is the primary button currently down?
|
||||
///
|
||||
/// Buttons released this frame are NOT considered down.
|
||||
#[inline(always)]
|
||||
pub fn primary_down(&self) -> bool {
|
||||
self.button_down(PointerButton::Primary)
|
||||
}
|
||||
|
||||
/// Is the secondary button currently down?
|
||||
///
|
||||
/// Buttons released this frame are NOT considered down.
|
||||
#[inline(always)]
|
||||
pub fn secondary_down(&self) -> bool {
|
||||
self.button_down(PointerButton::Secondary)
|
||||
}
|
||||
|
||||
/// Is the middle button currently down?
|
||||
///
|
||||
/// Buttons released this frame are NOT considered down.
|
||||
#[inline(always)]
|
||||
pub fn middle_down(&self) -> bool {
|
||||
self.button_down(PointerButton::Middle)
|
||||
|
||||
@@ -721,11 +721,14 @@ impl<State> Harness<'_, State> {
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
// Close temp file so it isn't locked when `open` tries to launch it (on Windows)
|
||||
let path = temp_file.into_temp_path();
|
||||
|
||||
#[expect(clippy::print_stdout)]
|
||||
{
|
||||
println!("Wrote debug snapshot to: {}", path.display());
|
||||
}
|
||||
let result = open::that(path);
|
||||
let result = open::that(&path);
|
||||
if let Err(err) = result {
|
||||
#[expect(clippy::print_stderr)]
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c419519f1cddb37c54e30071a3a9519106807e8ae3fe812649c12ee5a1b7c5db
|
||||
size 2729
|
||||
oid sha256:845acb34152fb829dc24c606b1741e250f1d1fa645236ef57fce0cbda104c465
|
||||
size 2121
|
||||
|
||||
Reference in New Issue
Block a user