Skip to content

Commit

Permalink
fix(web): 🐛 incorrect default dpr (#338)
Browse files Browse the repository at this point in the history
* fix(web): 🐛 incorrect default dpr

* chore: 🤖 update changelog
  • Loading branch information
theashraf authored Aug 26, 2024
1 parent dec22e8 commit dd70edf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-coins-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/dotlottie-web': patch
---

fix(web): 🐛 incorrect default dpr
2 changes: 1 addition & 1 deletion packages/web/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ export function isLottie(fileData: string | Record<string, unknown>): boolean {
export function getDefaultDPR(): number {
const dpr = IS_BROWSER ? window.devicePixelRatio : 1;

return (1 + (dpr - 1)) * DEFAULT_DPR_FACTOR;
return 1 + (dpr - 1) * DEFAULT_DPR_FACTOR;
}
2 changes: 1 addition & 1 deletion packages/web/tests/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ describe('isLottie', () => {

describe('getDefaultDotLottieDPR', () => {
test('return 75% of device pixel ratio', () => {
expect(getDefaultDPR()).toBe((1 + ((window.devicePixelRatio || 1) - 1)) * 0.75);
expect(getDefaultDPR()).toBe(1 + (window.devicePixelRatio - 1) * 0.75);
});
});

0 comments on commit dd70edf

Please sign in to comment.