vol_set: Change a running widget

View source: R/widget.R

vol_setR Documentation

Change a running widget

Description

Sends settings to a widget that is already on screen, without rebuilding it.

Usage

vol_set(id, options, session = shiny::getDefaultReactiveDomain())

Arguments

id

Output identifier of the widget.

options

Named list of viewer settings; see vol_widget() for the keys.

session

The shiny session.

Details

Change a running widget

Rendering the widget again would rebuild the whole page and reload the payload, which for a slider that a reader is dragging is the wrong trade. This sends the settings alone, so the state of the camera and of the loaded textures survives.

Value

NULL, invisibly. Called for its effect.

See Also

vol_widget() for the widget and the keys it takes, render_vol_widget(), vol_snapshot(), shinyVolumr().

Examples

# Inside the server function of a shiny application; see render_vol_widget()
# for a complete one.
if (interactive() && requireNamespace("shiny", quietly = TRUE)) {
  server <- function(input, output, session) {
    output$volume <- render_vol_widget(vol_widget(vol_example_payload()))
    shiny::observe(vol_set("volume", list(slab = input$slab,
                                          slabZ = input$depth)))
  }
}

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