Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions events.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ typedef struct {
float scale, rotation; // Incremental scale factor and clockwise radians.
} ax_gesture_t;

enum { AX_POINTER_STYLUS = 1u << 0 };
enum { AX_POINTER_STYLUS = 1u << 0, AX_POINTER_TOUCH = 1u << 1 };
typedef struct {
uint32_t flags; /**< AX_POINTER_STYLUS when the sample is a stylus / Apple Pencil. */
uint32_t flags; /**< AX_POINTER_STYLUS for a stylus / Apple Pencil, AX_POINTER_TOUCH for a finger. */
float altitude; /**< Radians: 0 = parallel to the surface, 蟺/2 = perpendicular. */
uint32_t time; /**< Sample time in milliseconds for touch samples; 0 when unknown. */
} ax_pointer_t;

#endif
3 changes: 3 additions & 0 deletions ios/ios_window.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ static ax_pointer_t ios_pointer(UITouch *touch) {
if (touch.type == UITouchTypePencil) {
p.flags = AX_POINTER_STYLUS;
p.altitude = (float)touch.altitudeAngle;
} else if (touch.type == UITouchTypeDirect) {
p.flags = AX_POINTER_TOUCH;
}
p.time = (uint32_t)(uint64_t)(touch.timestamp * 1000);
return p;
}

Expand Down
Loading