Skip to content

Commit 4f47226

Browse files
committed
ios: fix usb-c apple pencil support
1 parent 31eb28f commit 4f47226

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

base/sources/backends/ios_system.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
322322
iron_internal_mouse_trigger_move(x, y);
323323
}
324324
iron_internal_surface_trigger_move(index, x, y);
325+
if (touch.type == UITouchTypePencil) {
326+
if (!(touch.estimatedProperties & UITouchPropertyForce)) {
327+
// usb-c pencil with no pressure
328+
iron_internal_pen_trigger_move(x, y, touch.force);
329+
}
330+
}
325331
}
326332
}
327333
}
@@ -332,6 +338,7 @@ - (void)touchesEstimatedPropertiesUpdated:(NSSet<UITouch *> *)touches {
332338
CGPoint point = [touch locationInView:self];
333339
float x = point.x * self.contentScaleFactor;
334340
float y = point.y * self.contentScaleFactor;
341+
// pencil with pressure
335342
iron_internal_pen_trigger_move(x, y, touch.force);
336343
}
337344
}

0 commit comments

Comments
 (0)