summaryrefslogtreecommitdiff
path: root/indra/llui/llcheckboxctrl.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2021-04-30 03:05:19 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2021-04-30 03:05:19 +0300
commit789be6b93351e6150e5c2167a1ae3a64eed0717c (patch)
treea302168e5b155cfb54ad70d4bfb55c9c4dcd008e /indra/llui/llcheckboxctrl.cpp
parent487685fef1ad4afdb1d6692a4ab6b2980205abd7 (diff)
parentce65bc2f13409d75dbc6502c970030cc5ed2e5ad (diff)
Merge branch 'master' into DRTVWR-520-apple-notarization
Diffstat (limited to 'indra/llui/llcheckboxctrl.cpp')
-rw-r--r--indra/llui/llcheckboxctrl.cpp30
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