summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorKitty Barnett <develop@catznip.com>2022-10-23 16:37:10 +0200
committerKitty Barnett <develop@catznip.com>2022-10-23 16:29:03 +0200
commit8d08f417dc1f5b2681774f000951993e0f0cf79f (patch)
treea31a769fac1ebdad324d0953ff69e22e0814d716 /indra/llui
parentf6f52d327be5f03265d66a95df6fc0716f91ca07 (diff)
Show tooltip when hovering over an emoji text segment (currently will show its shortcode)
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltextbase.cpp14
-rw-r--r--indra/llui/lltextbase.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 2a6e6901e4..693dcb7b8d 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -3557,6 +3557,20 @@ LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end
{
}
+BOOL LLEmojiTextSegment::handleToolTip(S32 x, S32 y, MASK mask)
+{
+ if (mTooltip.empty())
+ {
+ LLWString emoji = getWText().substr(getStart(), getEnd() - getStart());
+ if (!emoji.empty())
+ {
+ mTooltip = LLEmojiHelper::instance().getToolTip(emoji[0]);
+ }
+ }
+
+ return LLNormalTextSegment::handleToolTip(x, y, mask);
+}
+
//
// LLOnHoverChangeableTextSegment
//
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index fc999c4cca..31e9f16110 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -187,6 +187,7 @@ public:
LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE);
bool canEdit() const override { return false; }
+ BOOL handleToolTip(S32 x, S32 y, MASK mask);
};
// Text segment that changes it's style depending of mouse pointer position ( is it inside or outside segment)