UNPKG

itk-viewer-bootstrap-ui

Version:

[![npm version](https://badge.fury.io/js/itk-viewer-bootstrap-ui.svg)](https://badge.fury.io/js/itk-viewer-bootstrap-ui) ![react-bootstrap version](https://img.shields.io/badge/React%20Bootstap-%3E=1.6.1-brightgreen.svg) [![Documentation Status](https://r

30 lines (24 loc) 957 B
import fullscreenMethods from './fullscreenMethods' function toggleFullscreen(context, event, actionMeta) { const fullscreenEnabled = context.main.fullscreenEnabled // Triggered by operating system events, e.g. pressing Esc while in // Fullscreen or F11 when not in fullscreen if (fullscreenEnabled === document[fullscreenMethods[3]]) { return } const container = context.rootContainer const oldWidth = context.main.rootContainerOldWidth const oldHeight = context.main.rootContainerOldHeight if (fullscreenEnabled) { context.main.rootContainerOldWidth = container.style.width context.main.rootContainerOldHeight = container.style.height container.style.width = '100vw' container.style.height = '100vh' context.rootContainer[fullscreenMethods[0]]() } else { container.style.width = oldWidth container.style.height = oldHeight document[fullscreenMethods[1]]() } } export default toggleFullscreen