Commit b1ce62fb authored by Fred Chasen's avatar Fred Chasen

Merge branch 'disable_overflow' into 'master'

Fix chunker stop for renderAsync

See merge request tools/pagedjs!37
parents 5e85d4a4 30dbf945
......@@ -73,6 +73,7 @@ class Chunker {
this.q = new Queue(this);
this.stopped = false;
this.rendered = false;
this.content = content;
......@@ -186,7 +187,7 @@ class Chunker {
stop() {
this.stopped = true;
this.q.clear();
// this.q.clear();
}
renderOnIdle(renderer) {
......@@ -347,7 +348,7 @@ class Chunker {
if (!blank) {
// Listen for page overflow
page.onOverflow((overflowToken) => {
// console.log("overflow on", page.id, overflowToken);
console.warn("overflow on", page.id, overflowToken);
// Only reflow while rendering
if (this.rendered) {
......@@ -365,15 +366,22 @@ class Chunker {
// Remove pages
this.removePages(index);
this.q.enqueue(async () => {
if (this.rendered === true) {
this.rendered = false;
this.start();
this.q.enqueue(async () => {
console.log("start",page.id, this.rendered);
await this.render(this.source, this.breakToken);
this.start();
await this.render(this.source, this.breakToken);
this.rendered = true;
});
}
this.rendered = true;
});
});
page.onUnderflow((overflowToken) => {
......
......@@ -114,11 +114,11 @@ class TargetCounters extends Handler {
// psuedo += "::" + split[1];
// }
this.styleSheet.insertRule(`[data-${target.variable}="${selector}"] { counter-increment: ${target.variable} ${pg}; }`, this.styleSheet.cssRules.length);
this.styleSheet.insertRule(`[data-${target.variable}="${selector}"] { counter-reset: ${target.variable} ${pg}; }`, this.styleSheet.cssRules.length);
} else {
let value = element.getAttribute(`data-counter-${target.counter}-value`);
if (value) {
this.styleSheet.insertRule(`[data-${target.variable}="${selector}"] { counter-increment: ${target.variable} ${parseInt(value)}; }`, this.styleSheet.cssRules.length);
this.styleSheet.insertRule(`[data-${target.variable}="${selector}"] { counter-reset: ${target.variable} ${target.variable} ${parseInt(value)}; }`, this.styleSheet.cssRules.length);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment