fix(slider): allow knob update while dragging even if scroll object is active#9906
fix(slider): allow knob update while dragging even if scroll object is active#9906dmd79 wants to merge 1 commit intolvgl:masterfrom
Conversation
…s active When a horizontal slider is being dragged, lv_indev_get_scroll_obj() may return non-NULL causing update_knob_pos() to return early without sending LV_EVENT_VALUE_CHANGED. Skip this check when the slider is already in dragging mode so the knob position updates continuously during drag as documented.
There was a problem hiding this comment.
No issues found across 1 file
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
|
Hi 👋, thank you for your PR! We've run benchmarks in an emulated environment. Here are the results: ARM Emulated 32b - lv_conf_perf32b
Detailed Results Per Scene
ARM Emulated 64b - lv_conf_perf64b
Detailed Results Per Scene
Disclaimer: These benchmarks were run in an emulated environment using QEMU with instruction counting mode. 🤖 This comment was automatically generated by a bot. |
There was a problem hiding this comment.
Pull request overview
Fixes slider drag behavior so knob/value updates continue while dragging even when the active input device reports a non-NULL scroll object, matching the documented “continuous update during drag” expectation.
Changes:
- Update
update_knob_pos()to ignorelv_indev_get_scroll_obj()when the slider is already indraggingmode.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if(lv_indev_get_scroll_obj(indev) != NULL && !slider->dragging) | ||
| return; |
There was a problem hiding this comment.
This change alters behavior when indev->pointer.scroll_obj is non-NULL during an active drag, but there’s no automated coverage for this regression scenario. Consider adding a unit test in tests/src/test_cases/widgets/test_slider.c that starts a pointer drag, then (e.g. via an LV_EVENT_PRESSING | LV_EVENT_PREPROCESS callback) forces lv_indev_active()->pointer.scroll_obj non-NULL while slider->dragging is true, and asserts that the slider value continues updating / LV_EVENT_VALUE_CHANGED still fires.
Problem
When dragging a horizontal slider,
lv_indev_get_scroll_obj()mayreturn non-NULL causing
update_knob_pos()to return early withoutsending
LV_EVENT_VALUE_CHANGED. This prevents the slider fromupdating continuously during drag as documented.
Root cause
In
update_knob_pos(), the check:exits the function even when the slider is already in dragging mode.
Fix
Skip the scroll object check when the slider is already dragging:
Tested
Verified on ESP32-S3 with touchscreen display running ESPHome.