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"
)R3dmol id or a r3dmol object (the output from
r3dmol()).
Atom selection specification with m_sel()
String for button label.
Duration of the zoom animation in milliseconds. (Default 500)
Logical, whether to also create a button that will reset the view to encompass the entire scene.
String for zoom out button label.
R3dmol id or a r3dmol object (the output from
r3dmol())
# 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))