Need to support text alignment
This commit is contained in:
@ -14,11 +14,9 @@
|
|||||||
|
|
||||||
<child>
|
<child>
|
||||||
<UIRichTextLabel
|
<UIRichTextLabel
|
||||||
alignment="0, 0, 65, 192"
|
alignment="0, 0, 0, 0"
|
||||||
alignUnitLeft="UI_COMPONENT_ALIGN_UNIT_PERCENT"
|
alignX="UI_COMPONENT_ALIGN_STRETCH"
|
||||||
alignUnitRight="UI_COMPONENT_ALIGN_UNIT_PERCENT"
|
alignY="UI_COMPONENT_ALIGN_STRETCH"
|
||||||
alignX="UI_COMPONENT_ALIGN_MIDDLE"
|
|
||||||
alignY="UI_COMPONENT_ALIGN_MIDDLE"
|
|
||||||
ref="uiLabel"
|
ref="uiLabel"
|
||||||
>
|
>
|
||||||
</UIRichTextLabel>
|
</UIRichTextLabel>
|
||||||
|
@ -38,9 +38,8 @@ void UIComponent::updateAlignment() {
|
|||||||
|
|
||||||
assertNotNull(dimensional);
|
assertNotNull(dimensional);
|
||||||
|
|
||||||
float_t parentWidth, parentHeight;
|
parentInnerWidth = dimensional->getContentWidth();
|
||||||
parentWidth = dimensional->getContentWidth();
|
parentInnerHeight = dimensional->getContentHeight();
|
||||||
parentHeight = dimensional->getContentHeight();
|
|
||||||
|
|
||||||
UIComponent::calculateDimensions(
|
UIComponent::calculateDimensions(
|
||||||
this->alignX,
|
this->alignX,
|
||||||
@ -48,7 +47,7 @@ void UIComponent::updateAlignment() {
|
|||||||
this->alignUnitRight,
|
this->alignUnitRight,
|
||||||
&translate.x,
|
&translate.x,
|
||||||
&this->width,
|
&this->width,
|
||||||
parentWidth,
|
parentInnerWidth,
|
||||||
this->getContentWidth(),
|
this->getContentWidth(),
|
||||||
glm::vec2(align[0], align[2])
|
glm::vec2(align[0], align[2])
|
||||||
);
|
);
|
||||||
@ -58,7 +57,7 @@ void UIComponent::updateAlignment() {
|
|||||||
this->alignUnitBottom,
|
this->alignUnitBottom,
|
||||||
&translate.y,
|
&translate.y,
|
||||||
&this->height,
|
&this->height,
|
||||||
parentHeight,
|
parentInnerHeight,
|
||||||
this->getContentHeight(),
|
this->getContentHeight(),
|
||||||
glm::vec2(align[1], align[3])
|
glm::vec2(align[1], align[3])
|
||||||
);
|
);
|
||||||
|
@ -28,6 +28,8 @@ namespace Dawn {
|
|||||||
protected:
|
protected:
|
||||||
float_t width = 1;
|
float_t width = 1;
|
||||||
float_t height = 1;
|
float_t height = 1;
|
||||||
|
float_t parentInnerWidth = 1;
|
||||||
|
float_t parentInnerHeight = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simply returns this UI Components' dimensional parent, used for the
|
* Simply returns this UI Components' dimensional parent, used for the
|
||||||
|
@ -9,7 +9,11 @@ using namespace Dawn;
|
|||||||
|
|
||||||
UIEmpty::UIEmpty(SceneItem *item) : UIComponent(item) { }
|
UIEmpty::UIEmpty(SceneItem *item) : UIComponent(item) { }
|
||||||
|
|
||||||
float_t UIEmpty::getContentWidth() { return 0.0f; }
|
float_t UIEmpty::getContentWidth() {
|
||||||
float_t UIEmpty::getContentHeight() { return 0.0f; }
|
return this->getWidth();
|
||||||
|
}
|
||||||
|
float_t UIEmpty::getContentHeight() {
|
||||||
|
return this->getHeight();
|
||||||
|
}
|
||||||
float_t UIEmpty::getChildOffsetX() { return 0.0f; }
|
float_t UIEmpty::getChildOffsetX() { return 0.0f; }
|
||||||
float_t UIEmpty::getChildOffsetY() { return 0.0f; }
|
float_t UIEmpty::getChildOffsetY() { return 0.0f; }
|
Reference in New Issue
Block a user