diff options
Diffstat (limited to 'platform/osx/godot_content_view.mm')
-rw-r--r-- | platform/osx/godot_content_view.mm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/osx/godot_content_view.mm b/platform/osx/godot_content_view.mm index e96f0a8098..018b90e629 100644 --- a/platform/osx/godot_content_view.mm +++ b/platform/osx/godot_content_view.mm @@ -42,6 +42,7 @@ ime_input_event_in_progress = false; mouse_down_control = false; ignore_momentum_scroll = false; + last_pen_inverted = false; [self updateTrackingAreas]; if (@available(macOS 10.13, *)) { @@ -377,9 +378,15 @@ ds->update_mouse_pos(wd, mpos); mm->set_position(wd.mouse_pos); mm->set_pressure([event pressure]); - if ([event subtype] == NSEventSubtypeTabletPoint) { + NSEventSubtype subtype = [event subtype]; + if (subtype == NSEventSubtypeTabletPoint) { const NSPoint p = [event tilt]; mm->set_tilt(Vector2(p.x, p.y)); + mm->set_pen_inverted(last_pen_inverted); + } else if (subtype == NSEventSubtypeTabletProximity) { + // Check if using the eraser end of pen only on proximity event. + last_pen_inverted = [event pointingDeviceType] == NSPointingDeviceTypeEraser; + mm->set_pen_inverted(last_pen_inverted); } mm->set_global_position(wd.mouse_pos); mm->set_velocity(Input::get_singleton()->get_last_mouse_velocity()); |