Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix context2d autoPaging with 10 or more pages #2793

Merged
merged 4 commits into from Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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