Skip to content

Commit

Permalink
add argument editor to drawFeatures. sohuld fix #90
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-salabim committed Jan 30, 2019
1 parent 445db14 commit 4e4c6a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions R/draw.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ drawFeatures = function(map = NULL,
record = FALSE,
viewer = shiny::paneViewer(),
title = "Draw Features",
editor = c("leaflet.extras", "leafpm"),
...) {
res = editMap(x = map,
sf = sf,
record = record,
viewer = viewer,
title = title,
editor = editor,
...)
if (!inherits(res, "sf") && is.list(res)) res = res$finished
return(res)
Expand Down
4 changes: 2 additions & 2 deletions R/edit.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ editMap.mapview <- function(

#' @name editMap
#' @export
editMap.NULL = function(x, ...) {
editMap.NULL = function(x, editor = c("leaflet.extras", "leafpm"), ...) {
m = mapview::mapview()@map
m = leaflet::fitBounds(
m,
Expand All @@ -163,7 +163,7 @@ editMap.NULL = function(x, ...) {
lng2 = 180, #as.numeric(sf::st_bbox(x)[3]),
lat2 = 90 #as.numeric(sf::st_bbox(x)[4])
)
ed = editMap(m, record=TRUE)
ed = editMap(m, record = TRUE, editor = editor)
ed_record <- ed$finished
attr(ed_record, "recorder") <- attr(ed, "recorder", exact = TRUE)
ed_record
Expand Down

0 comments on commit 4e4c6a9

Please sign in to comment.