Add pivot_x and pivot_y to image objects

This commit is contained in:
fvanroie 2021-10-07 15:01:18 +02:00
parent 93b6de6108
commit 2ed8af5a49
2 changed files with 30 additions and 0 deletions

View File

@ -1353,6 +1353,8 @@ static hasp_attribute_type_t specific_coord_attribute(lv_obj_t* obj, uint16_t at
hasp_attr_update_lv_coord_t list[] = {
{LV_HASP_IMAGE, ATTR_OFFSET_X, lv_img_set_offset_x, lv_img_get_offset_x},
{LV_HASP_IMAGE, ATTR_OFFSET_Y, lv_img_set_offset_y, lv_img_get_offset_y},
{LV_HASP_IMAGE, ATTR_PIVOT_X, my_img_set_pivot_x, my_img_get_pivot_x},
{LV_HASP_IMAGE, ATTR_PIVOT_Y, my_img_set_pivot_y, my_img_get_pivot_y},
{LV_HASP_DROPDOWN, ATTR_MAX_HEIGHT, lv_dropdown_set_max_height, my_dropdown_get_max_height}};
if(do_attribute(list, obj, attr_hash, val, update)) return HASP_ATTR_TYPE_INT;
}

View File

@ -11,6 +11,34 @@ const char* my_tabview_get_tab_name(const lv_obj_t* tabview, uint16_t id)
return ext->tab_name_ptr[id];
}
static void my_img_set_pivot_x(lv_obj_t* obj, lv_coord_t x)
{
lv_point_t point;
lv_img_get_pivot(obj, &point);
lv_img_set_pivot(obj, x, point.y);
}
static void my_img_set_pivot_y(lv_obj_t* obj, lv_coord_t y)
{
lv_point_t point;
lv_img_get_pivot(obj, &point);
lv_img_set_pivot(obj, point.x, y);
}
static lv_coord_t my_img_get_pivot_x(lv_obj_t* obj)
{
lv_point_t point;
lv_img_get_pivot(obj, &point);
return point.x;
}
static lv_coord_t my_img_get_pivot_y(lv_obj_t* obj)
{
lv_point_t point;
lv_img_get_pivot(obj, &point);
return point.y;
}
// OK - this function is missing in lvgl
static uint8_t my_roller_get_visible_row_count(const lv_obj_t* roller)
{