Skip to content

instantiate a new drawing with a custom control #145

@cscrum

Description

@cscrum

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions