mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix(app): stop animating emoji and stickers that have no animation (#1867)
This commit is contained in:
1 parent
62f40116be
commit
677e6e5d6e
2 files changed
+5
-2
No files matched your search
@@ -6,6 +6,7 @@ import {useState} from 'react';
|
|||||||
interface UseStickerAnimationOptions {
|
interface UseStickerAnimationOptions {
|
||||||
respectUserSettings?: boolean;
|
respectUserSettings?: boolean;
|
||||||
isInteracting?: boolean;
|
isInteracting?: boolean;
|
||||||
|
isAnimated?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UseStickerAnimationResult {
|
interface UseStickerAnimationResult {
|
||||||
@@ -19,11 +20,12 @@ interface UseStickerAnimationResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useStickerAnimation(options: UseStickerAnimationOptions = {}): UseStickerAnimationResult {
|
export function useStickerAnimation(options: UseStickerAnimationOptions = {}): UseStickerAnimationResult {
|
||||||
const {respectUserSettings = true, isInteracting: isInteractingOverride} = options;
|
const {respectUserSettings = true, isInteracting: isInteractingOverride, isAnimated = true} = options;
|
||||||
const [isInteracting, setIsInteracting] = useState(false);
|
const [isInteracting, setIsInteracting] = useState(false);
|
||||||
const effectiveInteraction = isInteractingOverride ?? isInteracting;
|
const effectiveInteraction = isInteractingOverride ?? isInteracting;
|
||||||
const shouldAnimate = useShouldAnimate({
|
const shouldAnimate = useShouldAnimate({
|
||||||
kind: 'sticker',
|
kind: 'sticker',
|
||||||
|
isAnimated,
|
||||||
isHovering: respectUserSettings ? effectiveInteraction : true,
|
isHovering: respectUserSettings ? effectiveInteraction : true,
|
||||||
isFocused: respectUserSettings ? effectiveInteraction : true,
|
isFocused: respectUserSettings ? effectiveInteraction : true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export const EditGuildStickerModal = observer(function EditGuildStickerModal({
|
|||||||
onUpdate,
|
onUpdate,
|
||||||
}: EditGuildStickerModalProps) {
|
}: EditGuildStickerModalProps) {
|
||||||
const {i18n} = useLingui();
|
const {i18n} = useLingui();
|
||||||
const {shouldAnimate} = useStickerAnimation();
|
const {shouldAnimate} = useStickerAnimation({isAnimated: sticker.animated});
|
||||||
const form = useForm<FormInputs>({
|
const form = useForm<FormInputs>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: sticker.name,
|
name: sticker.name,
|
||||||
@@ -86,6 +86,7 @@ export const EditGuildStickerModal = observer(function EditGuildStickerModal({
|
|||||||
const stickerUrl = AvatarUtils.getStickerURL({
|
const stickerUrl = AvatarUtils.getStickerURL({
|
||||||
id: sticker.id,
|
id: sticker.id,
|
||||||
animated: shouldAnimate,
|
animated: shouldAnimate,
|
||||||
|
isAnimatable: sticker.animated,
|
||||||
size: 320,
|
size: 320,
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in new issue
Block a user