Skip to content

Commit

Permalink
Merge pull request #2793 from HackbrettXXX/context2d-autopaging
Browse files Browse the repository at this point in the history
fix context2d autoPaging with 10 or more pages
  • Loading branch information
HackbrettXXX committed Jul 2, 2020
2 parents f30e68f + 1da7e56 commit 08754f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
12 changes: 12 additions & 0 deletions spec/context2d.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added spec/reference/autoPaging10Pages.pdf
Binary file not shown.
12 changes: 9 additions & 3 deletions src/modules/context2d.js
Expand Up @@ -1441,7 +1441,7 @@
}
}

pages.sort();
sortPages(pages);

var clipPath;
if (this.autoPaging) {
Expand Down Expand Up @@ -1595,6 +1595,12 @@
return paths;
};

var sortPages = function (pages) {
return pages.sort(function (a, b) {
return a - b;
})
}

var pathPreProcess = function(rule, isClip) {
var fillStyle = this.fillStyle;
var strokeStyle = this.strokeStyle;
Expand Down Expand Up @@ -1625,7 +1631,7 @@
addPage.call(this);
}
}
pages.sort();
sortPages(pages);

if (this.autoPaging) {
var min = pages[0];
Expand Down Expand Up @@ -1987,7 +1993,7 @@
}
}

pages.sort();
sortPages(pages);

var clipPath, oldSize;
if (this.autoPaging === true) {
Expand Down

0 comments on commit 08754f3

Please sign in to comment.