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

Decorator onclick event retrieve property #108

Open
Legolash2o opened this issue Dec 3, 2020 · 1 comment
Open

Decorator onclick event retrieve property #108

Legolash2o opened this issue Dec 3, 2020 · 1 comment

Comments

@Legolash2o
Copy link

I'm wanting to add a click event to the layer the arrows are added to, but I'm struggling to pass on custom properties. When I click on the arrow, it prevents me from clicking on the line which already has a working event trigger on it.

Each line has an 'id' property added to it. When I add a test property on arrowLine, i don't seem to be able to see it when I console log.

 var arrowLine = L.polylineDecorator(line, {
        patterns: [
             {
                id: 'test',
                clickable: true,
                offset: 40,
                repeat: 40,
                symbol: L.Symbol.arrowHead({
                    pixelSize: 20, pathOptions: {
                        fillOpacity: 0.75,
                        fillColor: 'black',
                        color: '#989898'
                    }
                })
            }
        ]
    });
    arrowLine.test = 'testing';
arrowLine.addTo(trackArrowLayer);

trackArrowLayer.on("click",
            function (event) {
                console.log(event.layer);
            });
@Legolash2o
Copy link
Author

I closed the duplicate as I posted it on the wrong git, as I believe this is a polyline decorator issue, not a leaflet one. I could be wrong.

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

1 participant