Fixed call action: polygon click

This commit is contained in:
Vladyslav_Prykhodko 2020-08-18 15:00:31 +03:00
parent 1e1d3a8257
commit c3b0372173
2 changed files with 19 additions and 20 deletions

View File

@ -592,11 +592,10 @@ export default abstract class LeafletMap {
}
deletePolygon(key: string) {
let polygon = this.polygons.get(key)?.leafletPoly;
const polygon = this.polygons.get(key)?.leafletPoly;
if (polygon) {
this.map.removeLayer(polygon);
this.polygons.delete(key);
polygon = null;
}
return polygon;
}

View File

@ -55,7 +55,7 @@ export class Polygon {
this.leafletPoly.on('click', (event: LeafletMouseEvent) => {
for (const action in this.settings.polygonClick) {
if (typeof (this.settings.polygonClick[action]) === 'function') {
this.settings.polygonClick[action](event.originalEvent, polyData.datasource);
this.settings.polygonClick[action](event.originalEvent, polyData.$datasource);
}
}
});