|
|
@ -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 { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const pixelRatio = window.devicePixelRatio; |
|
|
|
|
|
|
|
if(pixelRatio > 1) { |
|
|
|
//this.cachingEnabled = true;//this.width < 100 && this.height < 100;
|
|
|
|
//this.cachingEnabled = true;//this.width < 100 && this.height < 100;
|
|
|
|
if(window.devicePixelRatio > 1 && this.width > 100 && this.height > 100) { |
|
|
|
if(options.needUpscale) { |
|
|
|
|
|
|
|
this.width = Math.round(this.width * pixelRatio); |
|
|
|
|
|
|
|
this.height = Math.round(this.height * pixelRatio); |
|
|
|
|
|
|
|
} else if(pixelRatio > 1 && this.width > 100 && this.height > 100) { |
|
|
|
if(isApple || !mediaSizes.isMobile) { |
|
|
|
if(isApple || !mediaSizes.isMobile) { |
|
|
|
/* this.width = Math.round(this.width * (window.devicePixelRatio - 1)); |
|
|
|
/* this.width = Math.round(this.width * (pixelRatio - 1)); |
|
|
|
this.height = Math.round(this.height * (window.devicePixelRatio - 1)); */ |
|
|
|
this.height = Math.round(this.height * (pixelRatio - 1)); */ |
|
|
|
this.width = Math.round(this.width * window.devicePixelRatio); |
|
|
|
this.width = Math.round(this.width * pixelRatio); |
|
|
|
this.height = Math.round(this.height * window.devicePixelRatio); |
|
|
|
this.height = Math.round(this.height * pixelRatio); |
|
|
|
} else if(window.devicePixelRatio > 2.5) { |
|
|
|
} else if(pixelRatio > 2.5) { |
|
|
|
this.width = Math.round(this.width * (window.devicePixelRatio - 1.5)); |
|
|
|
this.width = Math.round(this.width * (pixelRatio - 1.5)); |
|
|
|
this.height = Math.round(this.height * (window.devicePixelRatio - 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})); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|