Enter or leave fullscreen. Works in Shinymode.
updateFullscreen(
NGLVieweR_proxy,
fullscreen = TRUE,
element = c("page", "viewer")
)A NGLVieweR object.
If TRUE (default) enter fullscreen, if
FALSE leave it. Nothing happens if the page is already in the
requested state.
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.
API call containing NGLVieweR id and list of message
parameters.
Browsers only allow entering fullscreen in response to a user
action, such as clicking a button that triggers updateFullscreen().
NGLVieweR_example() See example "updateFullscreen".
Other options:
setFocus(),
setQuality(),
snapShot(),
updateFocus()
if (FALSE) { # \dontrun{
NGLVieweR_proxy("structure") %>% updateFullscreen()
} # }
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)
}