feat(point): add helpers to operate point and precise point (#4867)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu
2023-11-27 13:26:55 +08:00
committed by GitHub
parent 976a01c0da
commit 5c11abc859
14 changed files with 101 additions and 120 deletions

View File

@@ -18,8 +18,7 @@ static bool enc_pressed;
void lv_test_mouse_read_cb(lv_indev_t * indev, lv_indev_data_t * data)
{
LV_UNUSED(indev);
data->point.x = x_act;
data->point.y = y_act;
lv_point_set(&data->point, x_act, y_act);
data->state = mouse_pressed ? LV_INDEV_STATE_PRESSED : LV_INDEV_STATE_RELEASED;
}

View File

@@ -255,10 +255,8 @@ static void draw_to_canvas(lv_obj_t * canvas)
line_draw_dsc.width = 8;
line_draw_dsc.round_end = 1;
line_draw_dsc.round_start = 1;
line_draw_dsc.p1.x = 150;
line_draw_dsc.p1.y = 30;
line_draw_dsc.p2.x = 350;
line_draw_dsc.p2.y = 55;
lv_point_precise_set(&line_draw_dsc.p1, 150, 30);
lv_point_precise_set(&line_draw_dsc.p2, 350, 55);
lv_draw_line(&layer, &line_draw_dsc);
lv_canvas_finish_layer(canvas, &layer);