Fix page end cut off when starting with page break

Fixes https://github.com/johnfactotum/foliate/issues/1179
This commit is contained in:
John Factotum
2024-03-20 08:44:47 +08:00
parent d9da576611
commit b0a869b7ed
+7 -1
View File
@@ -311,7 +311,13 @@ class View {
if (this.#column) { if (this.#column) {
const side = this.#vertical ? 'height' : 'width' const side = this.#vertical ? 'height' : 'width'
const otherSide = this.#vertical ? 'width' : 'height' const otherSide = this.#vertical ? 'width' : 'height'
const contentSize = this.#contentRange.getBoundingClientRect()[side] const contentRect = this.#contentRange.getBoundingClientRect()
const rootRect = this.document.documentElement.getBoundingClientRect()
// offset caused by column break at the start of the page
// which seem to be supported only by WebKit and only for horizontal writing
const contentStart = this.#vertical ? 0
: this.#rtl ? rootRect.right - contentRect.right : contentRect.left - rootRect.left
const contentSize = contentStart + contentRect[side]
const pageCount = Math.ceil(contentSize / this.#size) const pageCount = Math.ceil(contentSize / this.#size)
const expandedSize = pageCount * this.#size const expandedSize = pageCount * this.#size
this.#element.style.padding = '0' this.#element.style.padding = '0'