import { Viewer as VivliostyleViewer } from "vivliostyle" ; import vivliostyle from "./vivliostyle" ; class ZoomOptions { zoom : number ; constructor ( zoom ) { this . zoom = zoom ; } get fitToScreen ( ) : null | boolean { return null ; } getCurrentZoomFactor ( _viewer ? ) { return 1 ; } toggleFitToScreen ( ) { return new ZoomOptions ( 1 ) ; } zoomIn ( viewer ) { return new FixedZoomFactor ( this . getCurrentZoomFactor ( viewer ) * 1.25 ) ; } zoomOut ( viewer ) { return new FixedZoomFactor ( this . getCurrentZoomFactor ( viewer ) * 0.8 ) ; } zoomToActualSize ( ) { return new FixedZoomFactor ( 1 ) ; } static createDefaultOptions ( ) { return new FitToScreen ( ) ; } static createFromZoomFactor ( zoom ) { return new FixedZoomFactor ( zoom ) ; } } export class FitToScreen extends ZoomOptions { constructor ( ) { super ( 1 ) ; } get fitToScreen ( ) { return true ; } toggleFitToScreen ( ) { return new FixedZoomFactor ( 1 ) ; } getCurrentZoomFactor ( viewer ) { return viewer . queryZoomFactor ( vivliostyle . viewer . ZoomType . FIT_INSIDE_VIEWPORT ) ; } } class FixedZoomFactor extends ZoomOptions { get fitToScreen ( ) { return false ; } toggleFitToScreen ( ) { return new FitToScreen ( ) ; } getCurrentZoomFactor ( ) { return this . zoom ; } } export default ZoomOptions ;