Make a snapshot of a NGLVieweR object in Shinymode.

snapShot(NGLVieweR_proxy, fileName = "Snapshot", param = list())

Arguments

NGLVieweR_proxy

A NGLVieweR object.

fileName

Optional name for Snapshot (default = "Snapshot").

param

Of type list, can be; antialias TRUE/FALSE, trim TRUE/FALSE, transparent TRUE/FALSE or scale numeric. For a full list of options, see "makeImage" and "ImageParameters" in the official NGL.js manual.

Value

API call containing NGLVieweR id and list of message parameters.

See also

NGLVieweR_example() See example "snapshot".

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

Examples

if (FALSE) { # \dontrun{
NGLVieweR_proxy("structure") %>%
snapShot("Snapshot", param = list(
                               antialias = TRUE,
                               trim = TRUE,
                               transparent = TRUE,
                               scale = 1))
} # }

if (interactive()) {
  library(shiny)

  ui <- fluidPage(
    titlePanel("Viewer with API inputs"),
    sidebarLayout(
      sidebarPanel(
        actionButton("snapshot", "Snapshot"),
      ),
      mainPanel(
        NGLVieweROutput("structure")
      )
    )
  )
  server <- function(input, output) {
    output$structure <- renderNGLVieweR({
      NGLVieweR("7CID") %>%
        addRepresentation("cartoon",
          param = list(
            name = "cartoon",
            color = "residueindex"
          )
        )
    })
    observeEvent(input$snapshot, {
      NGLVieweR_proxy("structure") %>%
        snapShot("Snapshot",
          param = list(
            antialias = TRUE,
            trim = TRUE,
            transparent = TRUE,
            scale = 1
          )
        )
    })
  }
  shinyApp(ui, server)
}