OpenSeadragonでフルスクリーン時にControlを消す方法が見つからなかったのでソースを調べてやってみた。
似たような質問があったが構成が変わったのが動作せず
https://github.com/openseadragon/openseadragon/issues/1304
import { Viewer } from 'openseadragon'
export class CustomOpenSeadragon {
public viewer: any
public constructor() {
//適当
const init: any = {
id: 'hogediv',
tileSources : getHogeTileUrl
}
}
this.viewer = new Viewer(init)
this.viewer.addHandler('full-screen', (e) => {
this.viewer.controls[0].autoFade = !e.fullScreen
this.viewer.controls[0].container.style.opacity = String(Number(!e.fullScreen))
})
}
}
Controlが表示されている状態でフルスクリーンボタンを押すと、Viewerのfull-screenイベントが発火され、フルスクリーン状態を示すBooleanであるeventSource.fullScreenを読み取り、自動フェードアウトフラグとコンテナのopacityに代入させるというもの。
!をつけて代入することでイベント発生ごとにtoggleできる