0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OpenSeadragonでフルスクリーン時に強制的にControlを消す方法

Last updated at Posted at 2020-05-28

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できる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?