Skip to content
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

[BasicUI] Fix slider behaviour and implement two different modes #2535

Merged
merged 3 commits into from
Apr 21, 2024

Conversation

lolodomo
Copy link
Contributor

@lolodomo lolodomo commented Apr 19, 2024

Fix #2525
Also related to openhab/openhab-core#4084 and openhab/openhab-core#3430

Two behaviour modes are now supported.

  • If releaseOnly parameter is set, the new value is sent to the item only when the slider is released.
  • If releaseOnly parameter is not set, new values are sent to the item while moving the slider. Events are sent at a certain frequency, this frequency is defined by the sendFrequency parameter if set or every 200 ms by default. Event is not sent when the value is is unchanged (when stopping the move but keeping the mouse pressed).

The brightness slider of the colorpicker widget is also updated to send regular new color commands when moving the slider.

Signed-off-by: Laurent Garnier lg.hc@free.fr

@lolodomo lolodomo added bug Something isn't working enhancement New feature or request basic ui Basic UI labels Apr 19, 2024
@lolodomo lolodomo requested a review from a team as a code owner April 19, 2024 10:02
@lolodomo lolodomo marked this pull request as draft April 19, 2024 10:03
@lolodomo lolodomo force-pushed the slider_fix branch 10 times, most recently from 651099e to 215b026 Compare April 19, 2024 19:11
Fix openhab#2525
Also related to openhab/openhab-core#4084 and openhab/openhab-core#3430

Two behaviour modes are now supported.
- If releaseOnly parameter is set, the new value is sent to the item only when the slider is released.
- If releaseOnly parameter is not set, new values are sent to the item while moving the slider. Events are sent at a certain frequency, this frequency is defined by the sendFrequency parameter if set or every 200 ms by default. Event is not sent when the value is is unchanged (when stopping the move but keeping the mouse pressed).

The brightness slider of the colorpicker widget is also updated to send regular new color commands when moving the slider.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo lolodomo marked this pull request as ready for review April 20, 2024 09:19
@lolodomo
Copy link
Contributor Author

lolodomo commented Apr 20, 2024

Change tested with success using Firefox, Chrome and Edge on Windows 10 and using Chrome on an Android phone.

Note that the previous implementation tries to handle browsers not respecting the standard* but with problems with all browsers respecting this standard.
I can"t test with Safari browser but I read that Safari respects the standard so it should work well.

*Expected behaviour for a browser is to trigger "input" events when the slider is moving but not "change" events. "change" event should be triggered only when the slider is finally released. I read that 10 years ago, browsers like Internet Explorer were triggering "change" events while the slider was moving.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Keep a hardcoded interval of 200ms

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kaikreuzer kaikreuzer merged commit 0c7aa4d into openhab:main Apr 21, 2024
3 checks passed
@kaikreuzer kaikreuzer removed the bug Something isn't working label Apr 21, 2024
@lolodomo lolodomo deleted the slider_fix branch April 21, 2024 14:36
@lolodomo lolodomo added this to the 4.2 milestone May 2, 2024
lolodomo added a commit to lolodomo/openhab-webui that referenced this pull request May 18, 2024
Follow up openhab#2535

The function reloadIcon is already called by the function setValue at line 636 just before calling setValuePrivate.

The icon continues being refreshed while moiving the slider except if releaseOnly parameter is set.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
lolodomo added a commit to lolodomo/openhab-webui that referenced this pull request May 18, 2024
Follow up openhab#2535

The function reloadIcon is already called by the function setValue at line 636 just before calling setValuePrivate.

The icon continues being refreshed while moving the slider except if releaseOnly parameter is set.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
kaikreuzer pushed a commit that referenced this pull request May 18, 2024
#2578)

Follow up #2535

The function reloadIcon is already called by the function setValue at
line 636 just before calling setValuePrivate.

The icon continues being refreshed while moving the slider except if
releaseOnly parameter is set.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
basic ui Basic UI enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BasicUI] Slider not working well, especially in Firefox
3 participants