-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make all features fully interactive #100
Conversation
The use case for an interactive mode is something I hadn't considered before talking to @peterqliu today but its very common. In a nutshell, a developer using gl-draw can simply Working on interactive mode is making me question whether there is a need for different modes at all. Why isn't everything just always edittable? A user is always free to drag features around, resize, and reshape without have to click on it to enter a special mode (the only UI downside to this I see will be in deleting features, but that is surmountable). Making everything always edittable would kill two birds with one stone by simplifying the codebase a great deal and also making the UI more intuitive. UI-wise, a feature is simply styled differently on hover and then you can edit as necessary. This will also eliminate most of the functionality of the stores and individual geometry Objects will be responsible for rendering themselves. As a bonus, this will also come with a nice performance improvement because we'll be switching between gl-js layers a lot less. I know it isn't the Leaflet draw paradigm we have all come to know and love but I think this is definitely the way to go. @tristen @tmcw @peterqliu thoughts? |
Having not looked at the codebase for some time I'll throw in a rash agreement and say yes! All features should be editable with editing indicators defined in the UI (i.e. hover). |
As a user, I'd enthusiastically want this. But the real question is, what's the performance overhead of keeping all these elements editable? This is analogous to the discussion about whether GL layers should be interactive by default: either if the performance sacrifice is small enough to be worthwhile, or so negligible that we can make things interactive all the time, and removing the concept of interactivity outright. |
Always-editable interfaces introduce UX issues beyond deletion:
Like other cases of thinking about performance before seeing numbers, I'm going to reiterate that that's the incorrect order. But from a UX perspective, we know about some of the potential paths:
I'm -1 on this. Route planning is the simplest case: two draggable markers that are naturally placed away from each other. gl-draw's eventual role is as the editor for the dataset api, which has to deal with any kind of data - different shapes, different densities, many shapes stacked on each other - and for these cases removing the modality costs more clarity than it wins in ease. |
The best solution would be to give developers control over how features are can be edited. Spend some time with iD (or any vector editing program) and you'll see a lot of different approaches, most of them a hybrid of always editable and focused edit modes. In iD, some features need to be selected first before editing, like polygons, and in other cases (with points and lines) we display nodes and allow direct editing. If we had to pick between always editable, and always select -> edit, I'd lean towards requiring user to make a selection first. It's the safer approach that has less usability issues, the downside is that it's going to slow users down or feel weird for certain types of interactions. It would be great if this library made it possible for developers to make those kinds of choices on their own, there is no best UX approach. |
@tmcw @samanpwbb @tristen @peterqliu perhaps a compromise can be the ability to toggle between everything being edittable and nothing being editabble (giving the developer the option to disable either of those modes for their app). |
I'm going to go ahead and merge this. When a user instantiates draw, they now have the option to keep everything in edit mode always of toggle between drawn and edit (default). So, var Draw = mapboxgl.Draw({ interactive: true, drawing: false });
map.addControl(Draw); will enable the developer to set features than can be dragged, manipulated, etc. but the user can't draw any new features and the set features are always in edit mode. |
Make all features fully interactive
/cc @peterqliu
The way its going to work is you call
initially to set the point (the second argument sets the feature to
interactive
so that it is always in edit mode).id
is the way to unique identify features in gl-draw. When you drag the point around it will fire an event so on your side just something along the lines of: