Commit c3b03721737dc483e6130f7324094a3491f68801

Authored by Vladyslav_Prykhodko
1 parent 1e1d3a82

Fixed call action: polygon click

... ... @@ -417,25 +417,25 @@ export default abstract class LeafletMap {
417 417 };
418 418 }
419 419
420   - convertToPolygonFormat(points: Array<any>): Array<any> {
421   - if (points.length) {
422   - return points.map(point => {
423   - if (point.length) {
424   - return this.convertToPolygonFormat(point);
425   - } else {
426   - return [point.lat, point.lng];
427   - }
428   - });
429   - } else {
430   - return [];
  420 + convertToPolygonFormat(points: Array<any>): Array<any> {
  421 + if (points.length) {
  422 + return points.map(point => {
  423 + if (point.length) {
  424 + return this.convertToPolygonFormat(point);
  425 + } else {
  426 + return [point.lat, point.lng];
  427 + }
  428 + });
  429 + } else {
  430 + return [];
  431 + }
431 432 }
432   - }
433 433
434   - convertPolygonToCustomFormat(expression: any[][]): object {
435   - return {
436   - [this.options.polygonKeyName] : this.convertToPolygonFormat(expression)
437   - };
438   - }
  434 + convertPolygonToCustomFormat(expression: any[][]): object {
  435 + return {
  436 + [this.options.polygonKeyName] : this.convertToPolygonFormat(expression)
  437 + };
  438 + }
439 439
440 440 updateData(drawRoutes: boolean, showPolygon: boolean) {
441 441 this.drawRoutes = drawRoutes;
... ... @@ -592,11 +592,10 @@ export default abstract class LeafletMap {
592 592 }
593 593
594 594 deletePolygon(key: string) {
595   - let polygon = this.polygons.get(key)?.leafletPoly;
  595 + const polygon = this.polygons.get(key)?.leafletPoly;
596 596 if (polygon) {
597 597 this.map.removeLayer(polygon);
598 598 this.polygons.delete(key);
599   - polygon = null;
600 599 }
601 600 return polygon;
602 601 }
... ...
... ... @@ -55,7 +55,7 @@ export class Polygon {
55 55 this.leafletPoly.on('click', (event: LeafletMouseEvent) => {
56 56 for (const action in this.settings.polygonClick) {
57 57 if (typeof (this.settings.polygonClick[action]) === 'function') {
58   - this.settings.polygonClick[action](event.originalEvent, polyData.datasource);
  58 + this.settings.polygonClick[action](event.originalEvent, polyData.$datasource);
59 59 }
60 60 }
61 61 });
... ...