Skip to content

Commit

Permalink
Stop calculating reduction at the page pixel limit instead of going o…
Browse files Browse the repository at this point in the history
…ne further
  • Loading branch information
mbklein committed Aug 28, 2024
1 parent 3b89d68 commit 38cc1a7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const reduceToLimit = ({ width, height, limit }) => {
const result = [{ width, height }];
let page = 1;
let currentPage = result[result.length - 1];
while (currentPage.width >= limit || currentPage.height >= limit) {
while (currentPage.width > limit || currentPage.height > limit) {
const nextPage = calculatePage(result[0], page++);
result.push(nextPage);
currentPage = result[result.length - 1];
Expand Down
1 change: 0 additions & 1 deletion tests/resolvers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ describe('resolvers', () => { // eslint-disable-line max-lines-per-function
{ width: 1024, height: 768 },
{ width: 512, height: 384 },
{ width: 256, height: 192 },
{ width: 128, height: 96 },
];
const result = await dimensionResolver({id: 'dimensions'});
expect(result).toEqual(expected);
Expand Down

0 comments on commit 38cc1a7

Please sign in to comment.