import { UI } from "./UI" ; import { PageFlip } from "../PageFlip" ; import { FlipSetting } from "../Settings" ; /**
 * UI for canvas mode
 */ export class CanvasUI extends UI { private readonly canvas : HTMLCanvasElement ; constructor ( inBlock , app , setting ) { super ( inBlock , app , setting ) ; this . wrapper . innerHTML = '<canvas class="stf__canvas"></canvas>' ; this . canvas = inBlock . querySelectorAll ( 'canvas' ) [ 0 ] ; this . distElement = this . canvas ; this . resizeCanvas ( ) ; this . setHandlers ( ) ; } private resizeCanvas ( ) { const cs = getComputedStyle ( this . canvas ) ; const width = parseInt ( cs . getPropertyValue ( 'width' ) , 10 ) ; const height = parseInt ( cs . getPropertyValue ( 'height' ) , 10 ) ; this . canvas . width = width ; this . canvas . height = height ; } /**
     * Get canvas element
     */ public getCanvas ( ) { return this . canvas ; } public update ( ) { this . resizeCanvas ( ) ; this . app . getRender ( ) . update ( ) ; } }