mirror of
https://github.com/lvgl/lvgl.git
synced 2025-02-04 07:13:00 +08:00
fix(style): add the missing support for pct pivot in tranasform style properties
This commit is contained in:
parent
d2d886aae5
commit
c8e584f879
@ -1160,10 +1160,20 @@ static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv)
|
|||||||
|
|
||||||
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) return;
|
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) return;
|
||||||
|
|
||||||
lv_point_t pivot;
|
lv_point_t pivot = {
|
||||||
|
.x = lv_obj_get_style_transform_pivot_x(obj, 0),
|
||||||
|
.y = lv_obj_get_style_transform_pivot_y(obj, 0)
|
||||||
|
};
|
||||||
|
|
||||||
pivot.x = obj->coords.x1 + lv_obj_get_style_transform_pivot_x(obj, 0);
|
if(LV_COORD_IS_PCT(pivot.x)) {
|
||||||
pivot.y = obj->coords.y1 + lv_obj_get_style_transform_pivot_y(obj, 0);
|
pivot.x = (LV_COORD_GET_PCT(pivot.x) * lv_area_get_width(&obj->coords)) / 100;
|
||||||
|
}
|
||||||
|
if(LV_COORD_IS_PCT(pivot.y)) {
|
||||||
|
pivot.y = (LV_COORD_GET_PCT(pivot.y) * lv_area_get_height(&obj->coords)) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
pivot.x = obj->coords.x1 + pivot.x;
|
||||||
|
pivot.y = obj->coords.y1 + pivot.y;
|
||||||
|
|
||||||
if(inv) {
|
if(inv) {
|
||||||
angle = -angle;
|
angle = -angle;
|
||||||
|
@ -914,6 +914,13 @@ void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
|||||||
.y = lv_obj_get_style_transform_pivot_y(obj, 0)
|
.y = lv_obj_get_style_transform_pivot_y(obj, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(LV_COORD_IS_PCT(pivot.x)) {
|
||||||
|
pivot.x = (LV_COORD_GET_PCT(pivot.x) * lv_area_get_width(&obj->coords)) / 100;
|
||||||
|
}
|
||||||
|
if(LV_COORD_IS_PCT(pivot.y)) {
|
||||||
|
pivot.y = (LV_COORD_GET_PCT(pivot.y) * lv_area_get_height(&obj->coords)) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
lv_draw_img_dsc_t draw_dsc;
|
lv_draw_img_dsc_t draw_dsc;
|
||||||
lv_draw_img_dsc_init(&draw_dsc);
|
lv_draw_img_dsc_init(&draw_dsc);
|
||||||
draw_dsc.opa = opa;
|
draw_dsc.opa = opa;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user