-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug with resizing the window after updating book state
- Loading branch information
Showing
3 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,59 @@ | ||
import {UI} from "./UI"; | ||
import {PageFlip} from "../PageFlip"; | ||
import {FlipSetting} from "../Settings"; | ||
import { UI } from './UI'; | ||
import { PageFlip } from '../PageFlip'; | ||
import { FlipSetting } from '../Settings'; | ||
|
||
/** | ||
* UI for HTML mode | ||
*/ | ||
export class HTMLUI extends UI { | ||
constructor(inBlock: HTMLElement, app: PageFlip, setting: FlipSetting, items: NodeListOf<HTMLElement> | HTMLElement[]) { | ||
private items: NodeListOf<HTMLElement> | HTMLElement[]; | ||
|
||
constructor( | ||
inBlock: HTMLElement, | ||
app: PageFlip, | ||
setting: FlipSetting, | ||
items: NodeListOf<HTMLElement> | HTMLElement[] | ||
) { | ||
super(inBlock, app, setting); | ||
|
||
// Second wrapper to HTML page | ||
this.wrapper.insertAdjacentHTML('afterbegin', '<div class="stf__block"></div>'); | ||
|
||
this.distElement = inBlock.querySelector('.stf__block'); | ||
|
||
this.items = items; | ||
for (const item of items) { | ||
this.distElement.appendChild(item); | ||
} | ||
|
||
this.setHandlers(); | ||
} | ||
|
||
public clear(): void { | ||
for (const item of this.items) { | ||
this.parentElement.appendChild(item); | ||
} | ||
} | ||
|
||
/** | ||
* Update page list from HTMLElements | ||
* | ||
* | ||
* @param {(NodeListOf<HTMLElement>|HTMLElement[])} items - List of pages as HTML Element | ||
*/ | ||
public updateItems(items: NodeListOf<HTMLElement> | HTMLElement[]): void { | ||
this.removeHandlers(); | ||
|
||
this.distElement.innerHTML = ""; | ||
this.distElement.innerHTML = ''; | ||
|
||
for (const item of items) { | ||
this.distElement.appendChild(item); | ||
} | ||
this.items = items; | ||
|
||
this.setHandlers(); | ||
} | ||
|
||
public update(): void { | ||
this.app.getRender().update(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters