mirror of
https://github.com/lvgl/lvgl.git
synced 2025-02-04 07:13:00 +08:00
Co-authored-by: rdegliesposti <riccardo.degliesposti@powersoft.com>
This commit is contained in:
parent
d316710b3f
commit
fa69216d4c
@ -435,6 +435,11 @@ void lv_image_set_inner_align(lv_obj_t * obj, lv_image_align_t align)
|
||||
lv_image_t * img = (lv_image_t *)obj;
|
||||
if(align == img->align) return;
|
||||
|
||||
/*If we're removing STRETCH, reset the scale*/
|
||||
if(img->align == LV_IMAGE_ALIGN_STRETCH) {
|
||||
lv_image_set_scale(obj, LV_SCALE_NONE);
|
||||
}
|
||||
|
||||
img->align = align;
|
||||
update_align(obj);
|
||||
|
||||
@ -849,9 +854,11 @@ static void update_align(lv_obj_t * obj)
|
||||
if(img->align == LV_IMAGE_ALIGN_STRETCH) {
|
||||
lv_image_set_rotation(obj, 0);
|
||||
lv_image_set_pivot(obj, 0, 0);
|
||||
int32_t scale_x = lv_obj_get_width(obj) * LV_SCALE_NONE / img->w;
|
||||
int32_t scale_y = lv_obj_get_height(obj) * LV_SCALE_NONE / img->h;
|
||||
scale_update(obj, scale_x, scale_y);
|
||||
if(img->w != 0 && img->h != 0) {
|
||||
int32_t scale_x = lv_obj_get_width(obj) * LV_SCALE_NONE / img->w;
|
||||
int32_t scale_y = lv_obj_get_height(obj) * LV_SCALE_NONE / img->h;
|
||||
scale_update(obj, scale_x, scale_y);
|
||||
}
|
||||
}
|
||||
else if(img->align == LV_IMAGE_ALIGN_TILE) {
|
||||
lv_image_set_rotation(obj, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user