Ensure previewview comment box resizing is triggered.
This commit is contained in:
parent
2ae37525e3
commit
09d32f225b
@ -59,6 +59,14 @@ void Label::SetText(std::string text)
|
||||
}
|
||||
}
|
||||
|
||||
void Label::AutoHeight()
|
||||
{
|
||||
bool oldAH = autoHeight;
|
||||
autoHeight = true;
|
||||
updateMultiline();
|
||||
autoHeight = oldAH;
|
||||
}
|
||||
|
||||
void Label::updateMultiline()
|
||||
{
|
||||
int lines = 1;
|
||||
|
@ -55,6 +55,7 @@ namespace ui
|
||||
|
||||
virtual bool HasSelection();
|
||||
virtual void ClearSelection();
|
||||
virtual void AutoHeight();
|
||||
|
||||
void SetTextColour(Colour textColour) { this->textColour = textColour; }
|
||||
|
||||
|
@ -199,16 +199,21 @@ void PreviewView::commentBoxAutoHeight()
|
||||
if(!addCommentBox)
|
||||
return;
|
||||
int textWidth = Graphics::textwidth(addCommentBox->GetText().c_str());
|
||||
if(textWidth+10 > Size.X-(XRES/2)-48)
|
||||
if(textWidth+15 > Size.X-(XRES/2)-48)
|
||||
{
|
||||
commentBoxHeight = 59;
|
||||
addCommentBox->SetMultiline(true);
|
||||
addCommentBox->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
||||
|
||||
int oldSize = addCommentBox->Size.Y;
|
||||
addCommentBox->AutoHeight();
|
||||
int newSize = addCommentBox->Size.Y+5;
|
||||
addCommentBox->Size.Y = oldSize;
|
||||
|
||||
commentBoxHeight = newSize+22;
|
||||
commentBoxPositionX = (XRES/2)+4;
|
||||
commentBoxPositionY = Size.Y-58;
|
||||
commentBoxPositionY = Size.Y-(newSize+21);
|
||||
commentBoxSizeX = Size.X-(XRES/2)-8;
|
||||
commentBoxSizeY = 37;
|
||||
commentBoxSizeY = newSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user