diff --git a/frameworks/bridge/cj_frontend/interfaces/cj_ffi/cj_view_abstract_ffi.cpp b/frameworks/bridge/cj_frontend/interfaces/cj_ffi/cj_view_abstract_ffi.cpp index 67a71da21fe..10cdcbd4fe9 100644 --- a/frameworks/bridge/cj_frontend/interfaces/cj_ffi/cj_view_abstract_ffi.cpp +++ b/frameworks/bridge/cj_frontend/interfaces/cj_ffi/cj_view_abstract_ffi.cpp @@ -19,6 +19,7 @@ #include "cj_lambda.h" #include "bridge/cj_frontend/interfaces/cj_ffi/matrix4/cj_matrix4_ffi.h" +#include "bridge/cj_frontend/interfaces/cj_ffi/cj_pixel_unit_convert_ffi.h" #include "bridge/common/utils/utils.h" #include "core/common/container.h" #include "core/components/theme/theme_manager.h" @@ -592,13 +593,19 @@ void FfiOHOSAceFrameworkViewAbstractSetBackgroundImagePositionXY(double x, int32 DimensionUnit typeX = xDime.Unit(); DimensionUnit typeY = yDime.Unit(); - double valueX = xDime.Value(); - double valueY = yDime.Value(); + double valueX = xDime.ConvertToPx(); + double valueY = yDime.ConvertToPx(); + if (xDime.Unit() == DimensionUnit::LPX) { + valueX = FfiOHOSAceFrameworkLpx2Px(xDime.Value()); + } + if (yDime.Unit() == DimensionUnit::LPX) { + valueY = FfiOHOSAceFrameworkLpx2Px(yDime.Value()); + } if (xDime.Unit() == DimensionUnit::PERCENT) { - valueX = xDime.Value() * FULL_DIMENSION; + valueX = xDime.Value(); } if (yDime.Unit() == DimensionUnit::PERCENT) { - valueY = yDime.Value() * FULL_DIMENSION; + valueY = yDime.Value(); } UpdateBackgroundImagePosition(typeX, typeY, valueX, valueY, bgImgPosition);