Reading Apple Pencil Pressure in the Browser — PointerEvent, getCoalescedEvents(), and the e.pressure Trap

Reading Apple Pencil Pressure in the Browser — PointerEvent, getCoalescedEvents(), and the e.pressure Trap

Building a sketch pad in a browser sounds like a one-evening job. Then someone tries it with an Apple Pencil and the pressure data is gone, because the code listens for mousemove. Or with a mouse and the line is half as thick as it should be, because it reads e.pressure blindly and a mouse reports 0.5. Or with a fast hand on an iPad and the line is jagged, because the browser only emits one pointermove per 60 Hz frame and the Apple Pencil samples at 240 Hz. This 300-line page solves all three....

📰 Original Source

Read full article at Dev →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.