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