-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyboardDragListener accumulates remainder errors in the long run #1531
Comments
@jessegreenberg please note the above stop gap for the bug fix. What do you think? |
The main issue makes sense to me, thanks. The next step from #1520 will be to re-implement KeyboardDragListener with KeyboardListener, which uses CallbackTimer and might address this for us. While reviewing b7829bd I noticed that the Adding this to the "alt input" project board for when KeyboardListener/KeyboardDragListener gets work again. EDIT: Just confirming that CallbackTimer (uses Timer) would fix this EDIT2: As shown in that github reference, it would be fixed by using Timer.setInterval (not just by using Timer). |
This was fixed as part of #1570 because KeyboardDragListener now uses CallbackTimer. Closing. |
Discovered by me and @zepumph while working on #1530 and phetsims/friction#322, we observed that the "press a key and hold" quantized behavior may be inaccurately ignoring remainders as it looks. These errors could accumulate so that the long-term behavior is not as expected. @zepumph and I experimented with tracking the remainders and subtracting them from the next cycle, but it was complicated because there were 2 places calling
updatePosition
.We also observed that Animation.ts in twixt already has support for this behavior: passing in dts, having a start-up delay, and then firing events at a given rate. I'm also recalling maybe there is something in phet-core for this? Perhaps EventTimer.ts would be very appropriate here and easy to use.
Anyways, we thought it may be good to bring to @jessegreenberg attention. When we are developing more sims with the quantized drag listener, this may be good to investigate.
The text was updated successfully, but these errors were encountered: