updateFullscreen: Fullscreen

View source: R/api.R

updateFullscreenR Documentation

Fullscreen

Description

Enter or leave fullscreen. Works in Shinymode.

Usage

updateFullscreen(
  NGLVieweR_proxy,
  fullscreen = TRUE,
  element = c("page", "viewer")
)

Arguments

NGLVieweR_proxy

A NGLVieweR object.

fullscreen

If TRUE (default) enter fullscreen, if FALSE leave it. Nothing happens if the page is already in the requested state.

element

What to show fullscreen: "page" (default) the whole page, so the app's own controls stay visible, or "viewer" only the viewer. Only used when entering fullscreen; users can always leave with Esc.

Details

Browsers only allow entering fullscreen in response to a user action, such as clicking a button that triggers updateFullscreen().

Value

API call containing NGLVieweR id and list of message parameters.

See Also

NGLVieweR_example() See example "updateFullscreen".

Other options: setFocus(), setQuality(), snapShot(), updateFocus()

Examples

## Not run: 
NGLVieweR_proxy("structure") %>% updateFullscreen()

## End(Not run)

if (interactive()) {
library(shiny)

ui <- fluidPage(
  titlePanel("Viewer with API inputs"),
  sidebarLayout(
    sidebarPanel(
      actionButton("enter", "Enter fullscreen"),
      actionButton("exit", "Exit fullscreen")
    ),
    mainPanel(
      NGLVieweROutput("structure")
    )
  )
)
server = function(input, output) {
 output$structure <- renderNGLVieweR({
  NGLVieweR("7CID") %>%
    addRepresentation("cartoon",
      param = list(name = "cartoon", color = "red")
    )
})

  observeEvent(input$enter, {
  NGLVieweR_proxy("structure") %>%
    updateFullscreen(TRUE)
})

  observeEvent(input$exit, {
  NGLVieweR_proxy("structure") %>%
    updateFullscreen(FALSE)
})
}
  shinyApp(ui, server)
}

NGLVieweR documentation built on Oct. 20, 2026, 1:07 a.m.