diff options
| author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-10-05 14:17:50 +0200 | 
|---|---|---|
| committer | Guru <alexandrgproductengine@lindenlab.com> | 2023-10-05 14:25:26 +0200 | 
| commit | da783d1750ec8a03d62ddf81a0b44bba1b2f565b (patch) | |
| tree | 5f2edfb723dcd7f4be567720f29d3446296a0f54 /indra | |
| parent | 98214577c36d9c8dd0e13c7b678a399b35450bd3 (diff) | |
SL-20389 Emoji Completion floater - highlight the entered part of the shortcode
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llpanelemojicomplete.cpp | 38 | 
1 files changed, 31 insertions, 7 deletions
diff --git a/indra/newview/llpanelemojicomplete.cpp b/indra/newview/llpanelemojicomplete.cpp index 22cac8ad88..29e1a29ed3 100644 --- a/indra/newview/llpanelemojicomplete.cpp +++ b/indra/newview/llpanelemojicomplete.cpp @@ -108,10 +108,10 @@ void LLPanelEmojiComplete::draw()          mSelectedImage->draw(x, y, width, height);      } -    S32 iconCenterX = mRenderRect.mLeft + mEmojiWidth / 2; -    S32 iconCenterY = mRenderRect.mTop - mEmojiHeight / 2; -    S32 textLeft = mVertical ? mRenderRect.mLeft + mEmojiWidth + mPadding : 0; -    S32 textWidth = mVertical ? getRect().getWidth() - textLeft - mPadding : 0; +    F32 iconCenterX = mRenderRect.mLeft + (F32)mEmojiWidth / 2; +    F32 iconCenterY = mRenderRect.mTop - (F32)mEmojiHeight / 2; +    F32 textLeft = mVertical ? mRenderRect.mLeft + mEmojiWidth + mPadding : 0; +    F32 textWidth = mVertical ? getRect().getWidth() - textLeft - mPadding : 0;      for (U32 curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++)      { @@ -122,9 +122,33 @@ void LLPanelEmojiComplete::draw()          if (mVertical)          {              const std::string& shortCode = mEmojis[curIdx].String; -            mTextFont->renderUTF8(shortCode, 0, textLeft, iconCenterY, LLColor4::white, -                LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -                shortCode.size(), textWidth, NULL, FALSE, FALSE); +            F32 x0 = textLeft; +            F32 x1 = textWidth; +            if (mEmojis[curIdx].Begin) +            { +                std::string text = shortCode.substr(0, mEmojis[curIdx].Begin); +                mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, +                    LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, +                    text.size(), x1, NULL, FALSE, FALSE); +                x0 += mTextFont->getWidthF32(text); +                x1 = textLeft + textWidth - x0; +            } +            if (x1 > 0 && mEmojis[curIdx].End > mEmojis[curIdx].Begin) +            { +                std::string text = shortCode.substr(mEmojis[curIdx].Begin, mEmojis[curIdx].End - mEmojis[curIdx].Begin); +                mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::yellow6, +                    LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, +                    text.size(), x1, NULL, FALSE, FALSE); +                x0 += mTextFont->getWidthF32(text); +                x1 = textLeft + textWidth - x0; +            } +            if (x1 > 0 && mEmojis[curIdx].End < shortCode.size()) +            { +                std::string text = shortCode.substr(mEmojis[curIdx].End); +                mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, +                    LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, +                    text.size(), x1, NULL, FALSE, FALSE); +            }              iconCenterY -= mEmojiHeight;          }          else  | 
