some fixes
This commit is contained in:
parent
4e9766a6ac
commit
4b4f7c2191
@ -5276,7 +5276,7 @@ export default class ChatBubbles {
|
|||||||
const mids = invisible.map(({element}) => +element.dataset.mid);
|
const mids = invisible.map(({element}) => +element.dataset.mid);
|
||||||
|
|
||||||
let scrollSaver: ScrollSaver;
|
let scrollSaver: ScrollSaver;
|
||||||
if(!!invisibleTop.length !== !!invisibleBottom.length && !ignoreScrollSaving) {
|
if(/* !!invisibleTop.length !== !!invisibleBottom.length && */!ignoreScrollSaving) {
|
||||||
scrollSaver = this.createScrollSaver(!!invisibleTop.length);
|
scrollSaver = this.createScrollSaver(!!invisibleTop.length);
|
||||||
scrollSaver.save();
|
scrollSaver.save();
|
||||||
}
|
}
|
||||||
|
@ -713,7 +713,7 @@ export async function onEmojiStickerClick({event, container, managers, peerId, m
|
|||||||
doc,
|
doc,
|
||||||
middleware,
|
middleware,
|
||||||
side: isOut ? 'right' : 'left',
|
side: isOut ? 'right' : 'left',
|
||||||
size: 280,
|
size: 360,
|
||||||
target: container,
|
target: container,
|
||||||
play: true,
|
play: true,
|
||||||
withRandomOffset: true
|
withRandomOffset: true
|
||||||
|
@ -23,12 +23,12 @@ import IS_CUSTOM_EMOJI_SUPPORTED from '../../environment/customEmojiSupport';
|
|||||||
import rootScope from '../rootScope';
|
import rootScope from '../rootScope';
|
||||||
import mediaSizes from '../../helpers/mediaSizes';
|
import mediaSizes from '../../helpers/mediaSizes';
|
||||||
import {wrapSticker} from '../../components/wrappers';
|
import {wrapSticker} from '../../components/wrappers';
|
||||||
import RLottiePlayer, {getLottiePixelRatio} from '../rlottie/rlottiePlayer';
|
import RLottiePlayer from '../rlottie/rlottiePlayer';
|
||||||
import animationIntersector from '../../components/animationIntersector';
|
import animationIntersector from '../../components/animationIntersector';
|
||||||
import type {MyDocument} from '../appManagers/appDocsManager';
|
import type {MyDocument} from '../appManagers/appDocsManager';
|
||||||
import LazyLoadQueue from '../../components/lazyLoadQueue';
|
import LazyLoadQueue from '../../components/lazyLoadQueue';
|
||||||
import {Awaited} from '../../types';
|
import {Awaited} from '../../types';
|
||||||
import sequentialDom from '../../helpers/sequentialDom';
|
// import sequentialDom from '../../helpers/sequentialDom';
|
||||||
import {MediaSize} from '../../helpers/mediaSize';
|
import {MediaSize} from '../../helpers/mediaSize';
|
||||||
import IS_WEBM_SUPPORTED from '../../environment/webmSupport';
|
import IS_WEBM_SUPPORTED from '../../environment/webmSupport';
|
||||||
|
|
||||||
@ -56,6 +56,9 @@ export class CustomEmojiRendererElement extends HTMLElement {
|
|||||||
public middleware: () => boolean;
|
public middleware: () => boolean;
|
||||||
public keys: string[];
|
public keys: string[];
|
||||||
|
|
||||||
|
public lastRect: DOMRect;
|
||||||
|
public isDimensionsSet: boolean;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -126,7 +129,11 @@ export class CustomEmojiRendererElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public render(offsetsMap: ReturnType<CustomEmojiRendererElement['getOffsets']>) {
|
public render(offsetsMap: ReturnType<CustomEmojiRendererElement['getOffsets']>) {
|
||||||
const {context, canvas} = this;
|
const {context, canvas, isDimensionsSet} = this;
|
||||||
|
if(!isDimensionsSet) {
|
||||||
|
this.setDimensionsFromRect();
|
||||||
|
}
|
||||||
|
|
||||||
const {width, height, dpr} = canvas;
|
const {width, height, dpr} = canvas;
|
||||||
for(const [containers, player] of this.players) {
|
for(const [containers, player] of this.players) {
|
||||||
const frame = topFrames.get(player);
|
const frame = topFrames.get(player);
|
||||||
@ -186,17 +193,27 @@ export class CustomEmojiRendererElement extends HTMLElement {
|
|||||||
this.canvas.remove();
|
this.canvas.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setDimensions() {
|
// public setDimensions() {
|
||||||
const {canvas} = this;
|
// const {canvas} = this;
|
||||||
sequentialDom.mutateElement(canvas, () => {
|
// sequentialDom.mutateElement(canvas, () => {
|
||||||
const rect = canvas.getBoundingClientRect();
|
// const rect = canvas.getBoundingClientRect();
|
||||||
this.setDimensionsFromRect(rect);
|
// this.setDimensionsFromRect(rect);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
public setDimensionsFromRect(rect: DOMRect) {
|
public setDimensionsFromRect(rect: DOMRect = this.lastRect) {
|
||||||
const {canvas} = this;
|
const {canvas} = this;
|
||||||
const dpr = canvas.dpr ??= getLottiePixelRatio(rect.width, rect.height);
|
const {dpr} = canvas;
|
||||||
|
|
||||||
|
if(this.lastRect !== rect) {
|
||||||
|
this.lastRect = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!rect || !dpr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isDimensionsSet = true;
|
||||||
canvas.width = Math.round(rect.width * dpr);
|
canvas.width = Math.round(rect.width * dpr);
|
||||||
canvas.height = Math.round(rect.height * dpr);
|
canvas.height = Math.round(rect.height * dpr);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user