Commit 2faa858e authored by julien's avatar julien

optimized the pages count

parent 80e8f6a2
...@@ -101,7 +101,7 @@ class Chunker { ...@@ -101,7 +101,7 @@ class Chunker {
this.hooks.afterRendered = new Hook(this); this.hooks.afterRendered = new Hook(this);
this.pages = []; this.pages = [];
this._total = 0; this.total = 0;
this.q = new Queue(this); this.q = new Queue(this);
this.stopped = false; this.stopped = false;
...@@ -162,11 +162,14 @@ class Chunker { ...@@ -162,11 +162,14 @@ class Chunker {
} }
this.rendered = true; this.rendered = true;
this.pagesArea.style.setProperty("--pagedjs-page-count", this.total);
await this.hooks.afterRendered.trigger(this.pages, this); await this.hooks.afterRendered.trigger(this.pages, this);
this.emit("rendered", this.pages); this.emit("rendered", this.pages);
return this; return this;
} }
...@@ -330,6 +333,8 @@ class Chunker { ...@@ -330,6 +333,8 @@ class Chunker {
// Stop if we get undefined, showing we have reached the end of the content // Stop if we get undefined, showing we have reached the end of the content
} }
} }
recoredCharLength(length) { recoredCharLength(length) {
...@@ -468,14 +473,7 @@ class Chunker { ...@@ -468,14 +473,7 @@ class Chunker {
} }
*/ */
get total() {
return this._total;
}
set total(num) {
this.pagesArea.style.setProperty("--pagedjs-page-count", num);
this._total = num;
}
loadFonts() { loadFonts() {
let fontPromises = []; let fontPromises = [];
......
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