Commit 30dbf945 authored by Fred Chasen's avatar Fred Chasen

Fix chunker stop for renderAsync

parent d8aaa720
...@@ -73,6 +73,7 @@ class Chunker { ...@@ -73,6 +73,7 @@ class Chunker {
this.q = new Queue(this); this.q = new Queue(this);
this.stopped = false; this.stopped = false;
this.rendered = false;
this.content = content; this.content = content;
...@@ -186,7 +187,7 @@ class Chunker { ...@@ -186,7 +187,7 @@ class Chunker {
stop() { stop() {
this.stopped = true; this.stopped = true;
this.q.clear(); // this.q.clear();
} }
renderOnIdle(renderer) { renderOnIdle(renderer) {
...@@ -347,7 +348,7 @@ class Chunker { ...@@ -347,7 +348,7 @@ class Chunker {
if (!blank) { if (!blank) {
// Listen for page overflow // Listen for page overflow
page.onOverflow((overflowToken) => { page.onOverflow((overflowToken) => {
// console.log("overflow on", page.id, overflowToken); console.warn("overflow on", page.id, overflowToken);
// Only reflow while rendering // Only reflow while rendering
if (this.rendered) { if (this.rendered) {
...@@ -365,15 +366,22 @@ class Chunker { ...@@ -365,15 +366,22 @@ class Chunker {
// Remove pages // Remove pages
this.removePages(index); 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) => { page.onUnderflow((overflowToken) => {
......
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