render_vol_widget: Render a widget in shiny

View source: R/widget.R

render_vol_widgetR Documentation

Render a widget in shiny

Description

The server half of the shiny pair.

Usage

render_vol_widget(expr, env = parent.frame(), quoted = FALSE)

Arguments

expr

An expression returning a vol_widget.

env

Environment in which to evaluate expr.

quoted

Is expr already quoted?

Details

Render a widget in shiny

The camera belongs to the pointer. A camera sent from the server is applied once and only when it carries a nonce the browser has not seen, so a rotation a reader has made survives every other change the server pushes.

Value

A shiny render function.

See Also

vol_widget_output() for the user-interface half, vol_widget(), vol_snapshot(), shinyVolumr().

Examples

if (interactive() && requireNamespace("shiny", quietly = TRUE)) {
  ui <- shiny::fluidPage(
    shiny::checkboxInput("slab", "Depth slab"),
    shiny::actionButton("save", "Save a PNG"),
    vol_widget_output("volume", height = "600px"))
  server <- function(input, output, session) {
    output$volume <- render_vol_widget(
      vol_widget(vol_example_payload(), inputId = "volume"))
    shiny::observeEvent(input$slab, vol_set("volume", list(slab = input$slab)))
    shiny::observeEvent(input$save, vol_snapshot("volume", "volume.png"))
  }
  shiny::shinyApp(ui, server)
}

volumr documentation built on Dec. 2, 2026, 5:07 p.m.