mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
hardcoded list of BTTV's christmas emotes
This commit is contained in:
parent
bcc53c9aa7
commit
2d3fb8950e
|
@ -103,6 +103,10 @@ enum class MessageElementFlag {
|
|||
LowercaseLink = (1 << 29),
|
||||
OriginalLink = (1 << 30),
|
||||
|
||||
// ZeroWidthEmotes are emotes that are supposed to overlay over any pre-existing emotes
|
||||
// e.g. BTTV's SoSnowy during christmas season
|
||||
ZeroWidthEmote = (1 << 31),
|
||||
|
||||
Default = Timestamp | Badges | Username | BitsStatic | FfzEmoteImage |
|
||||
BttvEmoteImage | TwitchEmoteImage | BitsAmount | Text |
|
||||
AlwaysShow,
|
||||
|
|
|
@ -115,15 +115,27 @@ void MessageLayoutContainer::_addElement(MessageLayoutElement *element,
|
|||
// update line height
|
||||
this->lineHeight_ = std::max(this->lineHeight_, newLineHeight);
|
||||
|
||||
auto xOffset = 0;
|
||||
|
||||
if (element->getCreator().getFlags().has(
|
||||
MessageElementFlag::ZeroWidthEmote))
|
||||
{
|
||||
xOffset -= element->getRect().width() + this->spaceWidth_;
|
||||
}
|
||||
|
||||
// set move element
|
||||
element->setPosition(
|
||||
QPoint(this->currentX_, this->currentY_ - element->getRect().height()));
|
||||
element->setPosition(QPoint(this->currentX_ + xOffset,
|
||||
this->currentY_ - element->getRect().height()));
|
||||
|
||||
// add element
|
||||
this->elements_.push_back(std::unique_ptr<MessageLayoutElement>(element));
|
||||
|
||||
// set current x
|
||||
if (!element->getCreator().getFlags().has(
|
||||
MessageElementFlag::ZeroWidthEmote))
|
||||
{
|
||||
this->currentX_ += element->getRect().width();
|
||||
}
|
||||
|
||||
if (element->hasTrailingSpace())
|
||||
{
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
|
||||
namespace {
|
||||
|
||||
const QStringList zeroWidthEmotes{
|
||||
"SoSnowy", "IceCold", "SantaHat", "TopHat", "ReinDeer", "CandyCane",
|
||||
};
|
||||
|
||||
QColor getRandomColor(const QVariant &userId)
|
||||
{
|
||||
static const std::vector<QColor> twitchUsernameColors = {
|
||||
|
@ -1162,6 +1166,11 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
|||
else if ((emote = globalBttvEmotes.emote(name)))
|
||||
{
|
||||
flags = MessageElementFlag::BttvEmote;
|
||||
|
||||
if (zeroWidthEmotes.contains(name.string))
|
||||
{
|
||||
flags.set(MessageElementFlag::ZeroWidthEmote);
|
||||
}
|
||||
}
|
||||
|
||||
if (emote)
|
||||
|
|
Loading…
Reference in a new issue