terra-draw
terra-draw copied to clipboard
[Feature Request] allow multiple differently configured instances of the same class
Is your feature request related to a problem? Please describe.
Currently, mode name is hard coded for each terra-draw mode.
The below is an example of point mode
https://github.com/JamesLMilner/terra-draw/blob/e4c57f21b1d48ad1f2fb90c02b36eb3a9ceff125/packages/terra-draw/src/modes/point/point.mode.ts#L58-L59
If users want to add two point modes for different functionalities, currently we cannot add second one because mode name is already added.
Describe your proposed idea for the solution to this problem
maybe mode name can be set through constructor like below.
const point = new TerraDrawPointMode({
})
const point2 = new TerraDrawPointMode({
mode: `point2`
})
Describe alternatives you've considered
Currently no way to use two modes using same mode name.
Additional context
For example, I am implementing valhalla isochrone api by using terradraw point mode.
If I can add two point modes, one can be used for time isochrone, another one can be used for distance isochrone.