Message / GIF: Make small gifs larger (#1506)

This commit is contained in:
Alexander Zinchuk 2021-10-22 02:24:31 +03:00
parent edbfd22759
commit d668e265b5

View File

@ -10,6 +10,7 @@ import { getPhotoInlineDimensions, getVideoDimensions } from '../../../modules/h
export const MEDIA_VIEWER_MEDIA_QUERY = '(max-height: 640px)'; export const MEDIA_VIEWER_MEDIA_QUERY = '(max-height: 640px)';
export const REM = parseInt(getComputedStyle(document.documentElement).fontSize, 10); export const REM = parseInt(getComputedStyle(document.documentElement).fontSize, 10);
export const ROUND_VIDEO_DIMENSIONS = 240; export const ROUND_VIDEO_DIMENSIONS = 240;
export const GIF_MIN_WIDTH = 300;
export const AVATAR_FULL_DIMENSIONS = { width: 640, height: 640 }; export const AVATAR_FULL_DIMENSIONS = { width: 640, height: 640 };
export const LIKE_STICKER_ID = '1258816259753933'; export const LIKE_STICKER_ID = '1258816259753933';
@ -99,8 +100,10 @@ function calculateDimensionsForMessageMedia({
const aspectRatio = height / width; const aspectRatio = height / width;
const availableWidth = getAvailableWidth(fromOwnMessage, isForwarded, isWebPagePhoto, noAvatars); const availableWidth = getAvailableWidth(fromOwnMessage, isForwarded, isWebPagePhoto, noAvatars);
const availableHeight = getAvailableHeight(isGif, aspectRatio); const availableHeight = getAvailableHeight(isGif, aspectRatio);
const mediaWidth = isGif ? Math.max(GIF_MIN_WIDTH, width) : width;
const mediaHeight = isGif ? height * (mediaWidth / width) : height;
return calculateDimensions(availableWidth, availableHeight, width, height); return calculateDimensions(availableWidth, availableHeight, mediaWidth, mediaHeight);
} }
export function getMediaViewerAvailableDimensions(withFooter: boolean, isVideo: boolean): ApiDimensions { export function getMediaViewerAvailableDimensions(withFooter: boolean, isVideo: boolean): ApiDimensions {