mcu_hi3321_watch/tjd/ui/common/TjdUiLabelView.cpp
2025-05-26 20:15:20 +08:00

35 lines
778 B
C++

#include "TjdUiLabelView.h"
#include "TjdUiMultiLanguageExt.h"
using namespace OHOS;
namespace TJD {
TjdUiLabelView::TjdUiLabelView()
{
}
TjdUiLabelView::~TjdUiLabelView()
{
}
void TjdUiLabelView::SetPosition(int16_t x, int16_t y, int16_t width, int16_t height)
{
UIView* view = GetParent();
if (view == nullptr || TjdUiMultiLanguageExt::IsSpecialLanguage() == false) {
UILabelExt::SetPosition(x, y, width, height);
return;
}
int16_t parentWidth = view->GetWidth();
int16_t parentHeight = view->GetHeight();
int16_t parentX = view->GetX();
int16_t parentY = view->GetY();
int16_t newX = parentWidth - x - width;
int16_t newY = parentHeight - y - height;
UILabelExt::SetPosition(newX, newY, width, height);
}
}