Skip to content

Commit

Permalink
added suffix which when used mirrors emote
Browse files Browse the repository at this point in the history
  • Loading branch information
nirajacharya2 committed Jul 27, 2023
1 parent f7c7d6c commit 2925ef1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Fixed an issue which squished tooltips when hovering an emote on the far right side of chat
- Fixed an issue which hid historical messages on Kick
- Increased the default value for Message Batching from 150 to 250
- Added a feature to horizontal flip emotes with a suffix character modifier

### Version 3.0.13

Expand Down
12 changes: 11 additions & 1 deletion src/app/chat/Emote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class="seventv-chat-emote"
:srcset="unload ? '' : processSrcSet(emote)"
:alt="emote.name"
:class="{ blur: hideUnlisted && emote.data?.listed === false }"
:class="{ blur: hideUnlisted && emote.data?.listed === false, mirror: isMirrorEmote(emote) === true }"
loading="lazy"
decoding="async"
@load="onImageLoad"
Expand Down Expand Up @@ -135,6 +135,12 @@ const { show, hide } = useTooltip(EmoteTooltip, {
width: baseWidth,
height: baseHeight,
});
const isMirrorEmote = (emote: SevenTV.ActiveEmote): boolean => {
const mirror: boolean = emote.name.slice(-2) === "_M";
if (emote.data) emote.data.mirrored = mirror;
return mirror;
};
</script>
<style scoped lang="scss">
Expand Down Expand Up @@ -165,6 +171,10 @@ img.blur {
overflow: clip;
}
img.mirror {
transform: scaleX(-1);
}
img.zero-width-emote {
pointer-events: none;
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/chat/EmoteTooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<div v-if="isChannel" class="label-channel">Channel Emote</div>
<div v-if="isPersonal" class="label-sub-feature">Personal Emote</div>
<div v-if="isZeroWidth" class="label-sub-feature">Zero-Width</div>
<div v-if="isMirrorEmote">Mirrored</div>
</div>

<!-- Emoji Data -->
Expand Down Expand Up @@ -120,6 +121,7 @@ const isSubscriber = props.emote.scope === "SUB";
const isChannel = props.emote.scope === "CHANNEL";
const isPersonal = props.emote.scope === "PERSONAL";
const isZeroWidth = (props.emote.flags || 0 & 256) !== 0;
const isMirrorEmote = props.emote.data?.mirrored;

Check failure on line 124 in src/app/chat/EmoteTooltip.vue

View workflow job for this annotation

GitHub Actions / WebExtension Lint, Build, Test

Getting a value from the `props` in root scope of `<script setup>` will cause the value to lose reactivity

const emojiData = ref<Emoji | null>(null);
if (props.emote.unicode) {
Expand Down
1 change: 1 addition & 0 deletions src/types/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ declare namespace SevenTV {
owner: User | null;
host: ImageHost;
versions?: EmoteVersion[];
mirrored?: boolean;
}

interface EmoteVersion {
Expand Down

0 comments on commit 2925ef1

Please sign in to comment.