diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-04-29 21:00:25 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-04-29 21:00:25 +0300 |
commit | 3f31901640b11740da43b23f0d9902407ee9313d (patch) | |
tree | e9e8671a242831d736580423913603627e25775b /indra/llui/llcheckboxctrl.cpp | |
parent | 8ce21268a1723738aaded551812d71e5ec29c707 (diff) | |
parent | ce65bc2f13409d75dbc6502c970030cc5ed2e5ad (diff) |
Merge master (DRTVWR-515) into DRTVWR-516-maint
# Conflicts:
# autobuild.xml
# doc/contributions.txt
# indra/llcommon/llcoros.cpp
# indra/llmessage/llcoproceduremanager.cpp
# indra/newview/llfloaterfixedenvironment.cpp
# indra/newview/llfloaterimsessiontab.cpp
Diffstat (limited to 'indra/llui/llcheckboxctrl.cpp')
-rw-r--r-- | indra/llui/llcheckboxctrl.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 6a51c4240b..08da599ef2 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -187,10 +187,32 @@ void LLCheckBoxCtrl::clear() void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) { - S32 label_top = mLabel->getRect().mTop; - mLabel->reshapeToFitText(); + LLRect rect = getRect(); + S32 delta_width = width - rect.getWidth(); + S32 delta_height = height - rect.getHeight(); - LLRect label_rect = mLabel->getRect(); + if (delta_width || delta_height) + { + // adjust our rectangle + rect.mRight = getRect().mLeft + width; + rect.mTop = getRect().mBottom + height; + setRect(rect); + } + + // reshapeToFitText reshapes label to minimal size according to last bounding box + // it will work fine in case of decrease of space, but if we get more space or text + // becomes longer, label will fail to grow so reinit label's dimentions. + + static LLUICachedControl<S32> llcheckboxctrl_hpad("UICheckboxctrlHPad", 0); + LLRect label_rect = mLabel->getRect(); + S32 new_width = getRect().getWidth() - label_rect.mLeft - llcheckboxctrl_hpad; + label_rect.mRight = label_rect.mLeft + new_width; + mLabel->setRect(label_rect); + + S32 label_top = label_rect.mTop; + mLabel->reshapeToFitText(TRUE); + + label_rect = mLabel->getRect(); if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN) { // reshapeToFitText uses LLView::reshape() which always reshapes @@ -210,6 +232,8 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) llmax(btn_rect.getWidth(), label_rect.mRight - btn_rect.mLeft), llmax(label_rect.mTop - btn_rect.mBottom, btn_rect.getHeight())); mButton->setShape(btn_rect); + + updateBoundingRect(); } //virtual |