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

with L_PREFER_CANVAS, Path click's event.layer points to Map #1215

Closed
smremde opened this issue Dec 12, 2012 · 3 comments
Closed

with L_PREFER_CANVAS, Path click's event.layer points to Map #1215

smremde opened this issue Dec 12, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@smremde
Copy link

smremde commented Dec 12, 2012

Tested with 0.4.5

var polygons = new L.FeatureGroup();

polygons.addLayer(
   new L.Polyline(points, { weight: 2, opacity: 1, color:'red' })
);

polygons.on('click', function (m) { 
   // m.layer is the clicked polygon here
   m.layer.bindPopup('hello!').openPopup();
});

stops working with

L_PREFER_CANVAS = true;

m.layer is something else?

@mourner
Copy link
Member

mourner commented Dec 12, 2012

Set up a JSFiddle please so I could take a quick look.

@smremde
Copy link
Author

smremde commented Dec 12, 2012

Here is a fiddle.... not sure how to do the L_PREFER_CANVAS = true; in jsfiddle...

http://jsfiddle.net/esDTD/

@mourner
Copy link
Member

mourner commented Dec 12, 2012

Confirmed, the click does work but e.layer points to Map instead of the layer.

@ghost ghost assigned mourner Dec 12, 2012
mourner added a commit that referenced this issue Dec 27, 2012
Handling clicks on paths with L_PREFER_CANVAS, #1215
@mourner mourner closed this as completed Dec 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants