Skip to content
Snippets Groups Projects
Commit f1b1dbab authored by Seth ProductEngine's avatar Seth ProductEngine
Browse files

STORM-250 FIXED "More" link being toggled in expandable textbox after reshaping.

parent 458a063c
No related branches found
No related tags found
No related merge requests found
...@@ -123,10 +123,7 @@ void LLExpandableTextBox::LLTextBoxEx::reshape(S32 width, S32 height, BOOL calle ...@@ -123,10 +123,7 @@ void LLExpandableTextBox::LLTextBoxEx::reshape(S32 width, S32 height, BOOL calle
{ {
LLTextEditor::reshape(width, height, called_from_parent); LLTextEditor::reshape(width, height, called_from_parent);
if (getTextPixelHeight() > getRect().getHeight()) hideOrShowExpandTextAsNeeded();
{
showExpandText();
}
} }
void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text,const LLStyle::Params& input_params) void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text,const LLStyle::Params& input_params)
...@@ -136,17 +133,7 @@ void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text,cons ...@@ -136,17 +133,7 @@ void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text,cons
mExpanderVisible = false; mExpanderVisible = false;
LLTextEditor::setText(text, input_params); LLTextEditor::setText(text, input_params);
// text contents have changed, segments are cleared out hideOrShowExpandTextAsNeeded();
// so hide the expander and determine if we need it
//mExpanderVisible = false;
if (getTextPixelHeight() > getRect().getHeight())
{
showExpandText();
}
else
{
hideExpandText();
}
} }
...@@ -200,6 +187,22 @@ S32 LLExpandableTextBox::LLTextBoxEx::getTextPixelHeight() ...@@ -200,6 +187,22 @@ S32 LLExpandableTextBox::LLTextBoxEx::getTextPixelHeight()
return getTextBoundingRect().getHeight(); return getTextBoundingRect().getHeight();
} }
void LLExpandableTextBox::LLTextBoxEx::hideOrShowExpandTextAsNeeded()
{
// Restore the text box contents to calculate the text height properly,
// otherwise if a part of the text is hidden under "More" link
// getTextPixelHeight() returns only the height of currently visible text
// including the "More" link. See STORM-250.
hideExpandText();
// Show the expander a.k.a. "More" link if we need it, depending on text
// contents height. If not, keep it hidden.
if (getTextPixelHeight() > getRect().getHeight())
{
showExpandText();
}
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
......
...@@ -77,6 +77,12 @@ class LLExpandableTextBox : public LLUICtrl ...@@ -77,6 +77,12 @@ class LLExpandableTextBox : public LLUICtrl
*/ */
void hideExpandText(); void hideExpandText();
/**
* Shows the "More" link if the text is too high to be completely
* visible without expanding the text box. Hides that link otherwise.
*/
void hideOrShowExpandTextAsNeeded();
protected: protected:
LLTextBoxEx(const Params& p); LLTextBoxEx(const Params& p);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment