mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Remove useless variable
This commit is contained in:
+5
-11
@@ -215,13 +215,11 @@ class View {
|
|||||||
this.setImageSize()
|
this.setImageSize()
|
||||||
this.expand()
|
this.expand()
|
||||||
}
|
}
|
||||||
columnize({ width, height, margin, gap, columnWidth }) {
|
columnize({ width, height, gap, columnWidth }) {
|
||||||
const vertical = this.#vertical
|
const vertical = this.#vertical
|
||||||
this.#size = vertical ? height : width
|
this.#size = vertical ? height : width
|
||||||
|
|
||||||
const doc = this.document
|
const doc = this.document
|
||||||
const gapPadding = `${gap / 2}px`
|
|
||||||
const marginPadding = `0`
|
|
||||||
Object.assign(doc.documentElement.style, {
|
Object.assign(doc.documentElement.style, {
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
columnWidth: `${columnWidth}px`,
|
columnWidth: `${columnWidth}px`,
|
||||||
@@ -230,9 +228,7 @@ class View {
|
|||||||
...(vertical
|
...(vertical
|
||||||
? { width: `${width}px` }
|
? { width: `${width}px` }
|
||||||
: { height: `${height}px` }),
|
: { height: `${height}px` }),
|
||||||
padding: (vertical
|
padding: vertical ? `${gap / 2}px 0` : `0 ${gap / 2}px`,
|
||||||
? [gapPadding, marginPadding]
|
|
||||||
: [marginPadding, gapPadding]).join(' '),
|
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
// force wrap long words
|
// force wrap long words
|
||||||
overflowWrap: 'anywhere',
|
overflowWrap: 'anywhere',
|
||||||
@@ -347,9 +343,6 @@ export class Paginator {
|
|||||||
Object.assign(this.#container.style, {
|
Object.assign(this.#container.style, {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
display: 'flex',
|
|
||||||
flexWrap: 'nowrap',
|
|
||||||
overflow: 'hidden',
|
|
||||||
})
|
})
|
||||||
new ResizeObserver(() => this.render()).observe(this.#element)
|
new ResizeObserver(() => this.render()).observe(this.#element)
|
||||||
this.#container.addEventListener('scroll', debounce(() => {
|
this.#container.addEventListener('scroll', debounce(() => {
|
||||||
@@ -368,8 +361,9 @@ export class Paginator {
|
|||||||
#beforeRender({ vertical, rtl, background }) {
|
#beforeRender({ vertical, rtl, background }) {
|
||||||
this.#vertical = vertical
|
this.#vertical = vertical
|
||||||
this.#rtl = rtl
|
this.#rtl = rtl
|
||||||
|
|
||||||
// set `document` background to `doc` background
|
// set `document` background to `doc` background
|
||||||
// this is needed cause the iframe does not fill the whole element
|
// this is needed because the iframe does not fill the whole element
|
||||||
this.#element.style.background = background
|
this.#element.style.background = background
|
||||||
|
|
||||||
const { flow, margin, gap, maxColumnWidth } = this.layout
|
const { flow, margin, gap, maxColumnWidth } = this.layout
|
||||||
@@ -386,7 +380,7 @@ export class Paginator {
|
|||||||
const divisor = Math.ceil(size / maxColumnWidth)
|
const divisor = Math.ceil(size / maxColumnWidth)
|
||||||
const columnWidth = (size / divisor) - gap
|
const columnWidth = (size / divisor) - gap
|
||||||
this.#element.setAttribute('dir', rtl ? 'rtl' : 'ltr')
|
this.#element.setAttribute('dir', rtl ? 'rtl' : 'ltr')
|
||||||
const paddingH = `${vertical ? margin : gap / 2}px`
|
const paddingH = `${vertical ? gap : gap / 2}px`
|
||||||
const paddingV = `${vertical ? margin - gap / 2 : margin}px`
|
const paddingV = `${vertical ? margin - gap / 2 : margin}px`
|
||||||
this.#element.style.padding = `${paddingV} ${paddingH}`
|
this.#element.style.padding = `${paddingV} ${paddingH}`
|
||||||
this.#container.style.overflow ='hidden'
|
this.#container.style.overflow ='hidden'
|
||||||
|
|||||||
Reference in New Issue
Block a user