Skip to content

Commit

Permalink
fix context2d autoPaging with 10 or more pages
Browse files Browse the repository at this point in the history
  • Loading branch information
HackbrettXXX committed Jun 26, 2020
1 parent a5ee1d0 commit c5a2f29
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
Original file line number Diff line number Diff line change
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 c5a2f29

Please sign in to comment.