mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 13:51:30 +11:00
Fix touch force for Apple Pencil
This commit is contained in:
parent
dc973883c9
commit
778d70c001
|
@ -61,6 +61,7 @@ And please only add new entries to the top of this list, right below the `# Unre
|
||||||
- Added `AboutToWait` event which is emitted when the event loop is about to block and wait for new events ([#2900](https://github.com/rust-windowing/winit/issues/2900))
|
- Added `AboutToWait` event which is emitted when the event loop is about to block and wait for new events ([#2900](https://github.com/rust-windowing/winit/issues/2900))
|
||||||
- **Breaking:** `with_x11_visual` now takes the visual ID instead of the bare pointer.
|
- **Breaking:** `with_x11_visual` now takes the visual ID instead of the bare pointer.
|
||||||
- On X11, add a `with_embedded_parent_window` function to the window builder to allow embedding a window into another window.
|
- On X11, add a `with_embedded_parent_window` function to the window builder to allow embedding a window into another window.
|
||||||
|
- On iOS, add force data to touch events when using the Apple Pencil.
|
||||||
|
|
||||||
# 0.29.0-beta.0
|
# 0.29.0-beta.0
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,9 @@ impl WinitView {
|
||||||
let trait_collection = unsafe { self.traitCollection() };
|
let trait_collection = unsafe { self.traitCollection() };
|
||||||
let touch_capability = trait_collection.forceTouchCapability();
|
let touch_capability = trait_collection.forceTouchCapability();
|
||||||
// Both the OS _and_ the device need to be checked for force touch support.
|
// Both the OS _and_ the device need to be checked for force touch support.
|
||||||
if touch_capability == UIForceTouchCapability::Available {
|
if touch_capability == UIForceTouchCapability::Available
|
||||||
|
|| touch_type == UITouchType::Pencil
|
||||||
|
{
|
||||||
let force = touch.force();
|
let force = touch.force();
|
||||||
let max_possible_force = touch.maximumPossibleForce();
|
let max_possible_force = touch.maximumPossibleForce();
|
||||||
let altitude_angle: Option<f64> = if touch_type == UITouchType::Pencil {
|
let altitude_angle: Option<f64> = if touch_type == UITouchType::Pencil {
|
||||||
|
|
Loading…
Reference in a new issue