Allow each layered image to retain its own flags (#4460)

This fixes an issue where context-menu items for zero-width emotes displayed the wrong provider.
This commit is contained in:
nerix
2023-03-19 11:26:30 +01:00
committed by GitHub
parent 0acbc0d2c3
commit a777a227d4
6 changed files with 58 additions and 29 deletions
@@ -1076,17 +1076,20 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
// Need to remove EmoteElement and replace with LayeredEmoteElement
auto baseEmoteElement = this->releaseBack();
std::vector<EmotePtr> layers = {baseEmote, emote.get()};
this->emplace<LayeredEmoteElement>(std::move(layers),
baseEmoteElement->getFlags(),
this->textColor_);
std::vector<LayeredEmoteElement::Emote> layers = {
{baseEmote, baseEmoteElement->getFlags()},
{emote.get(), flags}};
this->emplace<LayeredEmoteElement>(
std::move(layers), baseEmoteElement->getFlags() | flags,
this->textColor_);
return Success;
}
auto asLayered = dynamic_cast<LayeredEmoteElement *>(&this->back());
if (asLayered)
{
asLayered->addEmoteLayer(emote.get());
asLayered->addEmoteLayer({emote.get(), flags});
asLayered->addFlags(flags);
return Success;
}