Disable vertical tab resizing over maximum width

In some situations, the label of tabs changes which caused the tab to
resize.
For example, when using vertical tabs for instant messages in combination
with "Display Names (w/Username)" for chat tabs, the display name does not
instantly load sometimes (when not in the avatar name cache?) and the
username is set. After the display name loads the tab label is set to the
display name which triggered a resizing of the tab and could cause it to
overlap the chat box.
This commit is contained in:
miKaぴょん
2015-10-14 20:48:23 +02:00
parent 2bf0a912fb
commit 1f5a6bb6b6

View File

@@ -1460,10 +1460,18 @@ void LLTabContainer::setPanelTitle(S32 index, const std::string& title)
{
LLTabTuple* tuple = getTab(index);
LLButton* tab_button = tuple->mButton;
const LLFontGL* fontp = LLFontGL::getFontSansSerifSmall();
mTotalTabWidth -= tab_button->getRect().getWidth();
tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
mTotalTabWidth += tab_button->getRect().getWidth();
if (!mIsVertical)
{
const LLFontGL* fontp = LLFontGL::getFontSansSerifSmall();
mTotalTabWidth -= tab_button->getRect().getWidth();
tab_button->reshape(llclamp(fontp->getWidth(title)
+ TAB_PADDING
+ tuple->mPadding,
mMinTabWidth,
mMaxTabWidth),
tab_button->getRect().getHeight());
mTotalTabWidth += tab_button->getRect().getWidth();
}
tab_button->setLabelSelected(title);
tab_button->setLabelUnselected(title);
}