Skip to content

Commit a19ad9b

Browse files
committed
fix(slider): consider transformation when draging
fixes lvgl#4053
1 parent d400689 commit a19ad9b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/widgets/slider/lv_slider.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
132132
else if(code == LV_EVENT_PRESSED) {
133133
/*Save the pressed coordinates*/
134134
lv_indev_get_point(lv_indev_get_act(), &slider->pressed_point);
135+
lv_obj_transform_point(obj, &slider->pressed_point, true, true);
135136
}
136137
else if(code == LV_EVENT_PRESSING) {
137138
update_knob_pos(obj, true);
@@ -353,6 +354,7 @@ static void drag_start(lv_obj_t * obj)
353354
}
354355
else if(mode == LV_SLIDER_MODE_RANGE) {
355356
lv_indev_get_point(lv_indev_get_act(), &p);
357+
lv_obj_transform_point(obj, &p, true, true);
356358
bool hor = is_slider_horizontal(obj);
357359
lv_base_dir_t base_dir = lv_obj_get_style_base_dir(obj, LV_PART_MAIN);
358360

@@ -419,6 +421,8 @@ static void update_knob_pos(lv_obj_t * obj, bool check_drag)
419421

420422
lv_point_t p;
421423
lv_indev_get_point(indev, &p);
424+
lv_obj_transform_point(obj, &p, true, true);
425+
422426
bool is_hor = is_slider_horizontal(obj);
423427

424428
if(check_drag && !slider->dragging) {

0 commit comments

Comments
 (0)