xjjak / LapCal

Building gloves that enable typing on a 34-key keyboard without an actual physical keyboard using IMUs and machine learning.
Other
2 stars 0 forks source link

Fix virtual keyboard release event #11

Closed palisn closed 7 months ago

palisn commented 7 months ago

This fixes most release events. The only release events that are still not properly tracked are when one leaves the app while a touch is active, which is something we probably don't need to worry about.

To fix the issue, the change keeps track of all current touches, mapping every internal touch identifier to the touch's starting position. The starting position is then used as a reference when releasing a touch, ensuring that every touch ends at the same key it started, at least in the log. The internal identifier is provided by the p5.js API, which assigns every touch an identifier that is unique while the touch is still active.