Add a button for zooming to a selection

m_button_zoom_to(
  id,
  sel = m_sel(),
  label = "Zoom",
  duration = 500,
  zoomOut = TRUE,
  zoomOutLabel = "Zoom Out"
)

Arguments

id

R3dmol id or a r3dmol object (the output from r3dmol()).

sel

Atom selection specification with m_sel()

label

String for button label.

duration

Duration of the zoom animation in milliseconds. (Default 500)

zoomOut

Logical, whether to also create a button that will reset the view to encompass the entire scene.

zoomOutLabel

String for zoom out button label.

Value

R3dmol id or a r3dmol object (the output from r3dmol())

Examples

# Add buttons to zoom in and out of a specific selection
r3dmol() %>%
  m_add_model(data = pdb_1j72, format = "pdb") %>%
  m_zoom_to() %>%
  m_set_style(m_style_cartoon()) %>%
  m_add_style(m_style_stick(), m_sel(resi = 100:110)) %>%
  m_button_zoom_to(sel = m_sel(resi = 100:110))