Browse Source

Fixed main stickers (monkey, folders) blur

master
morethanwords 4 years ago
parent
commit
be15db0a5c
  1. 31
      src/lib/lottieLoader.ts

31
src/lib/lottieLoader.ts

@ -16,7 +16,8 @@ type RLottieOptions = {
width?: number, width?: number,
height?: number, height?: number,
group?: string, group?: string,
noCache?: true noCache?: true,
needUpscale?: true
}; };
export class RLottiePlayer { export class RLottiePlayer {
@ -84,16 +85,22 @@ export class RLottiePlayer {
} }
} }
//this.cachingEnabled = true;//this.width < 100 && this.height < 100; const pixelRatio = window.devicePixelRatio;
if(window.devicePixelRatio > 1 && this.width > 100 && this.height > 100) { if(pixelRatio > 1) {
if(isApple || !mediaSizes.isMobile) { //this.cachingEnabled = true;//this.width < 100 && this.height < 100;
/* this.width = Math.round(this.width * (window.devicePixelRatio - 1)); if(options.needUpscale) {
this.height = Math.round(this.height * (window.devicePixelRatio - 1)); */ this.width = Math.round(this.width * pixelRatio);
this.width = Math.round(this.width * window.devicePixelRatio); this.height = Math.round(this.height * pixelRatio);
this.height = Math.round(this.height * window.devicePixelRatio); } else if(pixelRatio > 1 && this.width > 100 && this.height > 100) {
} else if(window.devicePixelRatio > 2.5) { if(isApple || !mediaSizes.isMobile) {
this.width = Math.round(this.width * (window.devicePixelRatio - 1.5)); /* this.width = Math.round(this.width * (pixelRatio - 1));
this.height = Math.round(this.height * (window.devicePixelRatio - 1.5)); this.height = Math.round(this.height * (pixelRatio - 1)); */
this.width = Math.round(this.width * pixelRatio);
this.height = Math.round(this.height * pixelRatio);
} else if(pixelRatio > 2.5) {
this.width = Math.round(this.width * (pixelRatio - 1.5));
this.height = Math.round(this.height * (pixelRatio - 1.5));
}
} }
} }
@ -623,7 +630,7 @@ class LottieLoader {
.then(res => res.arrayBuffer()) .then(res => res.arrayBuffer())
.then(data => apiManager.gzipUncompress<string>(data, true)) .then(data => apiManager.gzipUncompress<string>(data, true))
.then(str => { .then(str => {
return this.loadAnimationWorker(Object.assign(params, {animationData: JSON.parse(str)})); return this.loadAnimationWorker(Object.assign(params, {animationData: JSON.parse(str), needUpscale: true}));
}); });
} }

Loading…
Cancel
Save