mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Change force to be Option<f32> instead of f32 (#3240)
This commit is contained in:
@@ -274,10 +274,10 @@ pub enum Event {
|
||||
/// Position of the touch (or where the touch was last detected)
|
||||
pos: Pos2,
|
||||
|
||||
/// Describes how hard the touch device was pressed. May always be `0` if the platform does
|
||||
/// Describes how hard the touch device was pressed. May always be `None` if the platform does
|
||||
/// not support pressure sensitivity.
|
||||
/// The value is in the range from 0.0 (no pressure) to 1.0 (maximum pressure).
|
||||
force: f32,
|
||||
force: Option<f32>,
|
||||
},
|
||||
|
||||
/// A raw mouse wheel event as sent by the backend (minus the z coordinate),
|
||||
|
||||
@@ -118,7 +118,7 @@ struct ActiveTouch {
|
||||
///
|
||||
/// Note that a value of 0.0 either indicates a very light touch, or it means that the device
|
||||
/// is not capable of measuring the touch force.
|
||||
force: f32,
|
||||
force: Option<f32>,
|
||||
}
|
||||
|
||||
impl TouchState {
|
||||
@@ -249,7 +249,7 @@ impl TouchState {
|
||||
|
||||
// first pass: calculate force and center of touch positions:
|
||||
for touch in self.active_touches.values() {
|
||||
state.avg_force += touch.force;
|
||||
state.avg_force += touch.force.unwrap_or(0.0);
|
||||
state.avg_pos.x += touch.pos.x;
|
||||
state.avg_pos.y += touch.pos.y;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user