updateFocus {NGLVieweR} | R Documentation |
Update Focus
Description
Update the focus of an existing NGLVieweR object in Shinymode.
Usage
updateFocus(NGLVieweR_proxy, focus = 0)
Arguments
NGLVieweR_proxy |
A NGLVieweR object. |
focus |
Numeric value between 0-100 (default = 0). |
Value
API call containing NGLVieweR
id
and list of message parameters.
See Also
-
NGLVieweR_example()
See example "updateFocus".
Other options:
setFocus()
,
setQuality()
,
snapShot()
,
updateFullscreen()
Examples
## Not run:
NGLVieweR_proxy("structure") %>%
updateFocus(focus = 50)
## End(Not run)
if (interactive()) {
library(shiny)
ui = fluidPage(
titlePanel("Viewer with API inputs"),
sidebarLayout(
sidebarPanel(
sliderInput("focus", "Focus", 0, 100, 50)
),
mainPanel(
NGLVieweROutput("structure")
)
)
)
server = function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color= "red"))
})
observeEvent(input$focus, {
NGLVieweR_proxy("structure") %>%
updateFocus(input$focus)
})
}
shinyApp(ui, server)
}
[Package NGLVieweR version 1.3.1 Index]