-
Notifications
You must be signed in to change notification settings - Fork 606
Description
I'm writing a custom mode that lets a user box select over a Line feature to select multiple vertices, then pass them off to direct_select so they can be moved around or deleted.
This is convenient when the Line feature is a windy road or otherwise contains lots of vertices where shift + clicking each one would be a hassle.
The problem I'm running into is that Direct Select only accepts a single coordPath in onSetup, which means we can only pass a single vertex off to Direct Select mode.
mapbox-gl-draw/src/modes/direct_select.js
Line 131 in e3edcc2
| selectedCoordPaths: opts.coordPath ? [opts.coordPath] : [] |
To make this work, I've forked Direct Select mode and tweaked the above line of code so that the caller is responsible for passing a coordPath array, instead of expecting onSetup to wrap it:
selectedCoordPaths: opts.coordPath ? opts.coordPath : [] This gives me my expected result.
If it makes sense, I'm happy to push up a PR with this small change. Or maybe there's a more idiomatic way to do this that I'm not seeing :)
