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

leafpm draggable argument seems broken #64

Open
victorcazalis opened this issue Jul 9, 2024 · 2 comments
Open

leafpm draggable argument seems broken #64

victorcazalis opened this issue Jul 9, 2024 · 2 comments

Comments

@victorcazalis
Copy link

victorcazalis commented Jul 9, 2024

Hi,

I hope this is the good place to post an issue on leafpm options. I'm trying to allow editing a polygon but not drag it around, I thought that the draggable argument in pmEditOptions() would do it but it is not working. You can see in the reprex below that you can edit the polygon in South America (called MyEditablePolyg) but not the one in the North (MyFixPolyg), but that you can drag the South polygon although draggable is set to F. Just to check that pmEditOptions was working well with this polygon I changed the snap distance and this argument is applied.
Is it that the draggable argument is broken or am I missing something?

Thanks for all the great work on r-spatial packages! Best,
Victor

Reprex:

library(leaflet)
library(leafpm)
library(sf)

MyEditablePolyg <- st_polygon(list(matrix( c(-90,-56, -80,-20, -6,-56, -90,-56) , byrow=T, ncol=2))) %>% st_sfc(.)
MyFixPolyg <- st_polygon(list(matrix( c(-90,56, -80,20, -6,56, -90,56) , byrow=T, ncol=2))) %>% st_sfc(.)


LEAF <- leaflet() %>%
  addTiles()  %>%
  addPolygons(data=MyEditablePolyg, group="editable") %>%
  addPolygons(data=MyFixPolyg, group="fix") %>%
  leafpm::addPmToolbar(targetGroup="editable", editOptions = pmEditOptions(draggable=F, snapDistance=200), toolbarOptions = pmToolbarOptions(drawMarker=T, drawPolygon=T, drawPolyline=F, drawCircle=F, drawRectangle=F, removalMode=F, cutPolygon=F, editMode=T))

LEAF
@tim-salabim
Copy link
Member

@timelyportfolio is this intended behaviour?

@victorcazalis
Copy link
Author

Just a quick addition: it would be a fine solution to just be able to remove the "drag" button from the toolbar (so that nothing can be dragged), but I don't think it's possible yet.

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

No branches or pull requests

2 participants