diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 706cc303fc..f0ba804c4d 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -1145,10 +1145,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; - 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); - pivot.y = obj->coords.y1 + 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; + } + + pivot.x = obj->coords.x1 + pivot.x; + pivot.y = obj->coords.y1 + pivot.y; if(inv) { angle = -angle; diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index e5b75c394b..c48ec8bc11 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -927,6 +927,13 @@ void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj) .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_init(&draw_dsc); draw_dsc.opa = opa;