Learn R Programming

toro (version 0.1.0)

remove_draw_control: Remove the draw control from the map

Description

Remove the draw control from the map

Usage

remove_draw_control(proxy, panel_id = NULL)

Value

The map proxy object for chaining.

Arguments

proxy

The map proxy object created by mapProxy().

panel_id

Optional. If provided, removes the draw control from the specified control panel. If NULL, removes the standalone draw control.

Examples

Run this code
if(interactive()){
library(shiny)
library(toro)

ui <- fluidPage(
 tagList(
   mapOutput("map"),
   actionButton("remove_draw_control", "Remove draw control")
 )
)
server <- function(input, output, session) {
 output$map <- renderMap({
   map() |>
    add_draw_control()
 })

 observe({
   req(input$map_loaded)
   mapProxy("map") |>
     remove_draw_control()
 }) |>
   bindEvent(input$remove_draw_control)
}
}

Run the code above in your browser using DataLab