diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-04-30 03:04:47 +0300 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-04-30 03:04:47 +0300 |
| commit | 0fa5fc47a2069a2c151536baa917b9c6978480e4 (patch) | |
| tree | 2964096f28a6a5e7f08e5a0aa83f2ffe76d42421 /indra/llui/llcheckboxctrl.cpp | |
| parent | 498b72aacd6d10dfcd4f15e1d16532dc138f0461 (diff) | |
| parent | ce65bc2f13409d75dbc6502c970030cc5ed2e5ad (diff) | |
Merge branch 'master' into DRTVWR-527-maint
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 |
