Fixed call action: polygon click
This commit is contained in:
		
							parent
							
								
									1e1d3a8257
								
							
						
					
					
						commit
						c3b0372173
					
				@ -417,25 +417,25 @@ export default abstract class LeafletMap {
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  convertToPolygonFormat(points: Array<any>): Array<any> {
 | 
					    convertToPolygonFormat(points: Array<any>): Array<any> {
 | 
				
			||||||
    if (points.length) {
 | 
					      if (points.length) {
 | 
				
			||||||
      return points.map(point => {
 | 
					        return points.map(point => {
 | 
				
			||||||
        if (point.length) {
 | 
					          if (point.length) {
 | 
				
			||||||
          return this.convertToPolygonFormat(point);
 | 
					            return this.convertToPolygonFormat(point);
 | 
				
			||||||
        } else {
 | 
					          } else {
 | 
				
			||||||
          return [point.lat, point.lng];
 | 
					            return [point.lat, point.lng];
 | 
				
			||||||
        }
 | 
					          }
 | 
				
			||||||
      });
 | 
					        });
 | 
				
			||||||
    } else {
 | 
					      } else {
 | 
				
			||||||
      return [];
 | 
					        return [];
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  convertPolygonToCustomFormat(expression: any[][]): object {
 | 
					    convertPolygonToCustomFormat(expression: any[][]): object {
 | 
				
			||||||
    return {
 | 
					      return {
 | 
				
			||||||
      [this.options.polygonKeyName] : this.convertToPolygonFormat(expression)
 | 
					        [this.options.polygonKeyName] : this.convertToPolygonFormat(expression)
 | 
				
			||||||
    };
 | 
					      };
 | 
				
			||||||
  }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    updateData(drawRoutes: boolean, showPolygon: boolean) {
 | 
					    updateData(drawRoutes: boolean, showPolygon: boolean) {
 | 
				
			||||||
      this.drawRoutes = drawRoutes;
 | 
					      this.drawRoutes = drawRoutes;
 | 
				
			||||||
@ -592,11 +592,10 @@ export default abstract class LeafletMap {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    deletePolygon(key: string) {
 | 
					    deletePolygon(key: string) {
 | 
				
			||||||
      let polygon = this.polygons.get(key)?.leafletPoly;
 | 
					      const polygon = this.polygons.get(key)?.leafletPoly;
 | 
				
			||||||
      if (polygon) {
 | 
					      if (polygon) {
 | 
				
			||||||
        this.map.removeLayer(polygon);
 | 
					        this.map.removeLayer(polygon);
 | 
				
			||||||
        this.polygons.delete(key);
 | 
					        this.polygons.delete(key);
 | 
				
			||||||
        polygon = null;
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return polygon;
 | 
					      return polygon;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -55,7 +55,7 @@ export class Polygon {
 | 
				
			|||||||
            this.leafletPoly.on('click', (event: LeafletMouseEvent) => {
 | 
					            this.leafletPoly.on('click', (event: LeafletMouseEvent) => {
 | 
				
			||||||
                for (const action in this.settings.polygonClick) {
 | 
					                for (const action in this.settings.polygonClick) {
 | 
				
			||||||
                    if (typeof (this.settings.polygonClick[action]) === 'function') {
 | 
					                    if (typeof (this.settings.polygonClick[action]) === 'function') {
 | 
				
			||||||
                        this.settings.polygonClick[action](event.originalEvent, polyData.datasource);
 | 
					                        this.settings.polygonClick[action](event.originalEvent, polyData.$datasource);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user