Merge e9d3001dbf into dev
This commit is contained in:
@@ -793,21 +793,24 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
}
|
||||
else if(sign == LV_SIGNAL_HIT_TEST) {
|
||||
lv_hit_test_info_t * info = param;
|
||||
if(ext->zoom != 256 && ext->angle == 0) {
|
||||
lv_coord_t origin_width = lv_area_get_width(&img->coords);
|
||||
lv_coord_t origin_height = lv_area_get_height(&img->coords);
|
||||
lv_coord_t scaled_width = (origin_width * ext->zoom + 255) / 256;
|
||||
lv_coord_t scaled_height = (origin_height * ext->zoom + 255) / 256;
|
||||
lv_style_int_t zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
|
||||
zoom = (zoom * ext->zoom) >> 8;
|
||||
|
||||
lv_coord_t width_offset = (origin_width - scaled_width) / 2;
|
||||
lv_coord_t height_offset = (origin_height - scaled_height) / 2;
|
||||
lv_style_int_t angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
|
||||
angle += ext->angle;
|
||||
|
||||
/* If the object is exactly image sized (not cropped, not mosaic) and transformed
|
||||
* perform hit test on it's transformed area */
|
||||
if(ext->w == lv_obj_get_width(img) && ext->h == lv_obj_get_height(img) &&
|
||||
(zoom != LV_IMG_ZOOM_NONE || angle != 0 || ext->pivot.x != ext->w / 2 || ext->pivot.y != ext->h / 2)) {
|
||||
|
||||
lv_area_t coords;
|
||||
lv_area_copy(&coords, &img->coords);
|
||||
coords.x1 += width_offset;
|
||||
coords.x2 -= width_offset;
|
||||
coords.y1 += height_offset;
|
||||
coords.y2 -= height_offset;
|
||||
_lv_img_buf_get_transformed_area(&coords, ext->w, ext->h, angle, zoom, &ext->pivot);
|
||||
coords.x1 += img->coords.x1;
|
||||
coords.y1 += img->coords.y1;
|
||||
coords.x2 += img->coords.x1;
|
||||
coords.y2 += img->coords.y1;
|
||||
|
||||
info->result = _lv_area_is_point_on(&coords, info->point, 0);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -126,7 +126,10 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_label_create(roller, get_label(copy));
|
||||
|
||||
lv_roller_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
lv_roller_set_options(roller, lv_roller_get_options(copy), copy_ext->mode);
|
||||
ext->mode = copy_ext->mode;
|
||||
ext->option_cnt = copy_ext->option_cnt;
|
||||
ext->sel_opt_id = copy_ext->sel_opt_id;
|
||||
ext->sel_opt_id_ori = copy_ext->sel_opt_id;
|
||||
ext->auto_fit = copy_ext->auto_fit;
|
||||
lv_obj_t * scrl = lv_page_get_scrollable(roller);
|
||||
lv_obj_set_signal_cb(scrl, lv_roller_scrl_signal);
|
||||
@@ -188,7 +191,7 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo
|
||||
lv_label_set_text(label, opt_extra);
|
||||
_lv_mem_buf_release(opt_extra);
|
||||
|
||||
ext->sel_opt_id = ((LV_ROLLER_INF_PAGES / 2) + 1) * ext->option_cnt;
|
||||
ext->sel_opt_id = ((LV_ROLLER_INF_PAGES / 2) + 0) * ext->option_cnt;
|
||||
|
||||
ext->option_cnt = ext->option_cnt * LV_ROLLER_INF_PAGES;
|
||||
}
|
||||
@@ -992,11 +995,12 @@ static void inf_normalize(void * scrl)
|
||||
|
||||
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
|
||||
uint16_t real_id_cnt = ext->option_cnt / LV_ROLLER_INF_PAGES;
|
||||
|
||||
ext->sel_opt_id = ext->sel_opt_id % real_id_cnt;
|
||||
|
||||
ext->sel_opt_id += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/
|
||||
|
||||
ext->sel_opt_id_ori = ext->sel_opt_id % real_id_cnt;
|
||||
ext->sel_opt_id_ori += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/
|
||||
|
||||
/*Move to the new id*/
|
||||
const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
|
||||
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
|
||||
|
||||
Reference in New Issue
Block a user