diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index caef66abb6..456e8cec66 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -166,6 +166,30 @@ bool LLPreviewNotecard::postBuild() onFontChanged(); // + // + // Get the resize bars and add a resize listener to the onResizeFloater method. + LLResizeBar* resizebar_left = getChild("resizebar_left"); + if (resizebar_left) + { + resizebar_left->setResizeListener(boost::bind(&LLPreviewNotecard::onResizeFloater, this)); + } + LLResizeBar* resizebar_right = getChild("resizebar_right"); + if (resizebar_right) + { + resizebar_right->setResizeListener(boost::bind(&LLPreviewNotecard::onResizeFloater, this)); + } + LLResizeBar* resizebar_top = getChild("resizebar_top"); + if (resizebar_top) + { + resizebar_top->setResizeListener(boost::bind(&LLPreviewNotecard::onResizeFloater, this)); + } + LLResizeBar* resizebar_bottom = getChild("resizebar_bottom"); + if (resizebar_bottom) + { + resizebar_bottom->setResizeListener(boost::bind(&LLPreviewNotecard::onResizeFloater, this)); + } + // + return LLPreview::postBuild(); } @@ -210,9 +234,21 @@ void LLPreviewNotecard::updateByteCounter() ui_text.setArg("[MAX]", std::to_string(MAX_BYTES)); mByteCounter->setText(ui_text.getString()); + // Update the visiblity state of the mByteCounter if there is not enough space. + onResizeFloater(); } // +// +// Callback method for the resizebar so the byte counter can become invisible if overlapped by the buttons +void LLPreviewNotecard::onResizeFloater() +{ + // Set the visiblity flag of the byte counter to true if the right side of the byte counter text is less then the left side of the save button. + S32 text_right = mByteCounter->getRect().mLeft + mByteCounter->getTextPixelWidth(); + mByteCounter->setVisible(text_right < mSaveBtn->getRect().mLeft); +} +// + void LLPreviewNotecard::setEnabled(bool enabled) { if (mEditor) diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index 3ffa268b5d..a2cbfa6cdd 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -132,6 +132,10 @@ protected: boost::signals2::connection mFontSizeChangedCallbackConnection; void onFontChanged(); // + // + // Callback method for the resizebar so the byte counter can become invisible if overlapped by the buttons + void onResizeFloater(); + // protected: LLViewerTextEditor* mEditor = nullptr;