lil-gui icon indicating copy to clipboard operation
lil-gui copied to clipboard

Stepped number controllers generating extra onChange events

Open Sceat opened this issue 1 year ago • 4 comments

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

Sceat avatar Nov 13 '23 09:11 Sceat

Thanks for this. I'm able to reproduce, but to confirm, it seems like this only affects number sliders with a step?

georgealways avatar Nov 13 '23 13:11 georgealways

most probably yes

Sceat avatar Nov 15 '23 06:11 Sceat

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 by step() method, but 1130

  • 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) зображення

psnet avatar Feb 29 '24 21:02 psnet

I can confirm this for number input fields and for sliders too

psnet avatar Feb 29 '24 22:02 psnet

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.

georgealways avatar Mar 02 '24 11:03 georgealways

Hi all, this issue is fixed as of 0.19.2

georgealways avatar Mar 03 '24 15:03 georgealways