[Perf] Composer: Optimize sending animation
This commit is contained in:
parent
02c91fb760
commit
2fca5568f2
@ -33,11 +33,6 @@ export const CUSTOM_BG_CACHE_NAME = 'tt-custom-bg';
|
|||||||
export const LANG_CACHE_NAME = 'tt-lang-packs-v5';
|
export const LANG_CACHE_NAME = 'tt-lang-packs-v5';
|
||||||
export const ASSET_CACHE_NAME = 'tt-assets';
|
export const ASSET_CACHE_NAME = 'tt-assets';
|
||||||
|
|
||||||
export const API_UPDATE_THROTTLE = 300;
|
|
||||||
export const API_THROTTLE_RESET_UPDATES = new Set([
|
|
||||||
'newMessage', 'newScheduledMessage', 'deleteMessages', 'deleteScheduledMessages', 'deleteHistory',
|
|
||||||
]);
|
|
||||||
|
|
||||||
export const DOWNLOAD_WORKERS = 16;
|
export const DOWNLOAD_WORKERS = 16;
|
||||||
export const UPLOAD_WORKERS = 16;
|
export const UPLOAD_WORKERS = 16;
|
||||||
|
|
||||||
@ -97,6 +92,12 @@ export const FAST_SMOOTH_MIN_DURATION = 250;
|
|||||||
export const FAST_SMOOTH_MAX_DURATION = 600;
|
export const FAST_SMOOTH_MAX_DURATION = 600;
|
||||||
export const FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE = 500; // px
|
export const FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE = 500; // px
|
||||||
|
|
||||||
|
// Average duration of message sending animation
|
||||||
|
export const API_UPDATE_THROTTLE = Math.round((FAST_SMOOTH_MIN_DURATION + FAST_SMOOTH_MAX_DURATION) / 2);
|
||||||
|
export const API_THROTTLE_RESET_UPDATES = new Set([
|
||||||
|
'newMessage', 'newScheduledMessage', 'deleteMessages', 'deleteScheduledMessages', 'deleteHistory',
|
||||||
|
]);
|
||||||
|
|
||||||
export const STICKER_SIZE_INLINE_DESKTOP_FACTOR = 13;
|
export const STICKER_SIZE_INLINE_DESKTOP_FACTOR = 13;
|
||||||
export const STICKER_SIZE_INLINE_MOBILE_FACTOR = 11;
|
export const STICKER_SIZE_INLINE_MOBILE_FACTOR = 11;
|
||||||
export const STICKER_SIZE_AUTH = 160;
|
export const STICKER_SIZE_AUTH = 160;
|
||||||
|
|||||||
@ -108,6 +108,12 @@ function scrollWithJs(
|
|||||||
path = Math.min(path, remainingPath);
|
path = Math.min(path, remainingPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path === 0) {
|
||||||
|
isAnimating = false;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const target = container.scrollTop + path;
|
const target = container.scrollTop + path;
|
||||||
|
|
||||||
if (forceDuration === 0) {
|
if (forceDuration === 0) {
|
||||||
|
|||||||
@ -37,6 +37,10 @@ function scrollWithJs(container: HTMLElement, left: number, duration: number) {
|
|||||||
path = Math.min(path, remainingPath);
|
path = Math.min(path, remainingPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const target = container.scrollLeft + path;
|
const target = container.scrollLeft + path;
|
||||||
|
|
||||||
if (duration === 0) {
|
if (duration === 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user