Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make new editorOptions() argument available in drawFeatures #103

Merged
merged 1 commit into from
Sep 9, 2019

Conversation

JoshOBrien
Copy link
Contributor

@tim-salabim (at #100 (comment)) noted that "the new editorOptions() argument is not available in drawFeatures". With a few additional lines, this ties up that loose end.

@JoshOBrien
Copy link
Contributor Author

Here is a simple reproducible example that can be used to test the new feature:

library(sf)
library(mapview)
library(mapedit)

##------------------------------------------------------------------------------
## Simple example for testing
##------------------------------------------------------------------------------
x <- list(matrix(c(11,0,11,1,12,1,12,0,11,0), ncol = 2, byrow = TRUE))
pp <- st_sf(geom = st_sfc(st_polygon(x)), crs = 4326)
m <- mapview(pp)


##------------------------------------------------------------------------------
## Passing options to leafpm editor
##------------------------------------------------------------------------------
optsA <- list(drawOptions = list(snappable = FALSE,
                                 hintlineStyle = list(color = "red",
                                                      opacity = 0.5),
                                 templineStyle = list(color = "red")),
              editOptions = list(snappable = FALSE))
y <- drawFeatures(m, editor = "leafpm", editorOptions = optsA)

##------------------------------------------------------------------------------
## Passing options to leaflet.extras editor
##------------------------------------------------------------------------------
## A stripped down toolbar
optsB <- list(editOptions = list(remove = FALSE),
              circleOptions = FALSE,
              markerOptions = FALSE,
              circleMarkerOptions = FALSE,
              rectangleOptions = FALSE)
y <- drawFeatures(m, editor = "leaflet.extras", editorOptions = optsB)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants