mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Change force to be Option<f32> instead of f32 (#3240)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user