1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Change force to be Option<f32> instead of f32 (#3240)

This commit is contained in:
lucasmerlin
2023-08-12 13:50:40 +02:00
committed by GitHub
parent 6633ecce64
commit 1036cb1f7d
4 changed files with 11 additions and 11 deletions

View File

@@ -441,7 +441,7 @@ impl State {
id: egui::TouchId(0),
phase: egui::TouchPhase::Start,
pos,
force: 0.0,
force: None,
});
} else {
self.any_pointer_button_down = false;
@@ -453,7 +453,7 @@ impl State {
id: egui::TouchId(0),
phase: egui::TouchPhase::End,
pos,
force: 0.0,
force: None,
});
};
}
@@ -479,7 +479,7 @@ impl State {
id: egui::TouchId(0),
phase: egui::TouchPhase::Move,
pos: pos_in_points,
force: 0.0,
force: None,
});
}
} else {
@@ -505,13 +505,13 @@ impl State {
touch.location.y as f32 / self.pixels_per_point(),
),
force: match touch.force {
Some(winit::event::Force::Normalized(force)) => force as f32,
Some(winit::event::Force::Normalized(force)) => Some(force as f32),
Some(winit::event::Force::Calibrated {
force,
max_possible_force,
..
}) => (force / max_possible_force) as f32,
None => 0_f32,
}) => Some((force / max_possible_force) as f32),
None => None,
},
});
// If we're not yet translating a touch or we're translating this very