Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

How to add an event to a polygon? #45

Open
4khobta opened this issue Dec 5, 2018 · 2 comments
Open

How to add an event to a polygon? #45

4khobta opened this issue Dec 5, 2018 · 2 comments
Labels

Comments

@4khobta
Copy link

4khobta commented Dec 5, 2018

$polygon = new Polygon(['name'=>'poly','map'=>'map']);
$polygon->setLatLngs([$poly1, $poly2, $poly3, $poly4]);
$polygon->clientEvents = ['click' => "function(e) {alert(1)}"];

but return wrong js without event:
map.addLayer(var poly = L.polygon([[50.07300647938297,31.440094543457036],[50.07300647938297,31.438094543457034],[50.074006479382966,31.438094543457034],[50.074006479382966,31.440094543457036]], 
@tonydspaniard
Copy link
Member

@4khobta you just found a bug. Forgot to collect events.

@egutierrezr421
Copy link

this code worked for me. I created a class by extending the Polygon class and modified the encode function as seen in the image. 1593307904029545111095393589527

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

No branches or pull requests

3 participants