lil-gui
lil-gui copied to clipboard
Stepped number controllers generating extra onChange events
to reproduce:
gui
.add({ count: 1 }, 'count', 1, 5, 1)
.name('count')
.onChange(count => {
console.log('change', count)
})
Originally posted by @Sceat in https://github.com/georgealways/lil-gui/issues/124#issuecomment-1807726827
Thanks for this. I'm able to reproduce, but to confirm, it seems like this only affects number sliders with a step?
most probably yes
I can confirm this right in the off docs example:
https://lil-gui.georgealways.com/#Guide#Numbers-and-Sliders
-
If you put cursor in field
-
scroll mouse wheel in any direction, example up
-
step will be not
10
as set bystep()
method, but1130
-
if scroll mouse wheel backward it will be default value again (i.e. offset / step is not calculated correctly, but calc for + and - is ok)
I can confirm this for number input fields and for sliders too
Hi @psnet, I'm not sure if this was intentional but it appears to be a duplicate of your comment on another issue: https://github.com/georgealways/lil-gui/issues/46#issuecomment-1972019070
As for extra onChange events, there will be a fix for this issue in the next release.
Hi all, this issue is fixed as of 0.19.2