I'm attempting to create a custom control to draw a polygon. I can successfully add the toolbar and draw a polygon using the buttons, but I want to do this through a custom toolbar. I'm trying this:
however it doesn't like the this.map argument. this.map is the instance of my leaflet map in the Angular project. I get an error:
Argument of type 'Map' is not assignable to parameter of type 'DrawMap'.
Type 'Map' is missing the following properties from type 'DrawMap': mergeOptions, addInitHook
DrawMap seems to be a specific type that I can't find a reference for, but TS tells me it is this:
DrawMap(element: string | HTMLElement, options?: MapOptions): DrawMap
I'm not sure how this is supposed to relate to the leaflet map. Why would I need a different reference to the map other than the map I already have?
I'm attempting to create a custom control to draw a polygon. I can successfully add the toolbar and draw a polygon using the buttons, but I want to do this through a custom toolbar. I'm trying this:
this.polygonDrawer = new Draw.Polygon(this.map,{ metric: false, feet: false, shapeOptions: { color: '#85bb65', }, })
however it doesn't like the this.map argument. this.map is the instance of my leaflet map in the Angular project. I get an error: Argument of type 'Map' is not assignable to parameter of type 'DrawMap'. Type 'Map' is missing the following properties from type 'DrawMap': mergeOptions, addInitHook
DrawMap seems to be a specific type that I can't find a reference for, but TS tells me it is this: DrawMap(element: string | HTMLElement, options?: MapOptions): DrawMap I'm not sure how this is supposed to relate to the leaflet map. Why would I need a different reference to the map other than the map I already have?