Strange behaviour when the touch event calls a scroller #7197
Replies: 1 comment
-
Posted at 2024-10-23 by @thyttan Hm... I'm responsible for recent changes to I'll take a closer look at your app tomorrow. But I wonder if just chucking a Also what firmware did you have on before you installed this one? Edit: just tried on 2v24.107 (which introduced the updated Edit2: can confirm I also get the scroller/menu bug when on 2v24.125. Posted at 2024-10-23 by Pologram No worries, it's no big deal :) Before upgrading to cutting edge I was using 2v23. Posted at 2024-10-24 by @thyttan Edit: Spoke too soon. See next comment.
espruino/Espruino@445d331
Posted at 2024-10-24 by @thyttan Weird. Now I flashed 2v24.118 again and now I get the bug there as well... 😂 Edit: Now I narrowed it down... 2v24.89 doesn't have the changed behavior: ... while 2v24.93 does: Between the two there were some refactors to the plumbing of registered event listeners. It changes the behavior so the menu's touch listener runs even though it wasn't registered at the time of the touch event. My guess is it has to do with the menu being called from within the touch listener that first act on the event. What tripped me up before was, the change/bug only seem to happen when The relevant commits:
Posted at 2024-10-24 by @gfwilliams Thanks for the report @pologram, and for tracking this down @thyttan! That's a bit of a pain. The change in event handling was to fix some errors other apps/people were having (which made things behave differently depending on whether there was a pre-existing event handler or not). I was trying to make a very basic proof of concept for this, and:
or just
don't seem to trigger it for me on latest firmwares. I even tried with an extra As an easy fix I think just changing DateInteresting! So on one call it's producing a string, and the other a number. The actual change at fault was a seemingly unrelated espruino/Espruino@f09330e but I've managed to get a fix in now! Posted at 2024-10-25 by @thyttan
I did get it to fail like that on 2v24.131. But now on 2v24.132 (and after reinstalling So probably it's fixed - but I'm not 100% sure. Posted at 2024-10-25 by @gfwilliams Well, I take it back about the touch thing - it just happened to me in a settings menu and I'm not 100% sure why, and wasn't able to reproduce it. I just tried putting another touch handler after and voila!
It seems 100% reproducible. So I think what was happening before was we completely re-wrote the list of event handlers when something was added/removed (and it was the list of handlers that got queued for execution). Now, we just modify that list so if you're iterating and you're not at the last entry when it executes it'll carry on. So this needs fixing internally. I guess I'll go back to the old behaviour of making a whole new list of events for every modification - it's not so nice/efficient but I think it's more what people expect. Posted at 2024-10-25 by @gfwilliams Ok, firmware is just fixed - @pologram you could take those fixes out of your app now hopefully! Posted at 2024-10-26 by Pologram Thank you for the fast fix @gfwilliams! Posted at 2024-10-26 by @thyttan
I just thought of a possible way around this - but I don't know if it's better or worse performance-wise. And there is probably some other drawbacks as well. But - if If this was to be adopted I suggest:
A strong argument against this is it breaks spec compliance - if I understand correctly. Posted at 2024-10-28 by @gfwilliams Thanks - that is an interesting thought! It does make some sense, but I think it would break other things - for example don't you have a handler in boot code that changes your touchscreen coordinates? That'd no longer be possible if everything else put the handler in front of it by default... I think the current solution is probably safe/sensible enough for now. Posted at 2024-10-28 by @thyttan
I don't think that case should hold us back. It'd be easy for me to handle that I believe, I'd just make sure to reregister that But I see your point, there are certainly some more apps/bootcode that expects to remain more or less at the fore of listeners and it would maybe become a headache.
Agreed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2024-10-23 by Pologram
Hello,
I recently upgraded my firmware to the cutting edge build
espruino_2v24.125_banglejs2.zip
to have the new Alarm update (long press to toggle alarm) and it introduced two bugs in my Elapsed Time app.The first one: it is not possible anymore to add or substract two dates, as it returns
NaN
. The comparison operators also don't work anymore. The fix is easy : just add.getTime()
.Example from the console:
The second one is more tricky. It seems like when the
touch
event calls a scroller, like this:Then the scroller is displayed, and immediately the menu row located where the touch event was is called. So it immediately goes into whatever menu item that was "under" the touch.
Not sure if I make much sense explaining it but here attached is a video that shows it: I tap the screen and the menu is displayed, and immediately the Date item is called because that's where my finger was.
Do you have any ideas on how to fix this?
Thanks
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions