Skip to content
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

'interactive' option is broken #249

Closed
kirach opened this issue Mar 4, 2016 · 10 comments · Fixed by #258
Closed

'interactive' option is broken #249

kirach opened this issue Mar 4, 2016 · 10 comments · Fixed by #258
Milestone

Comments

@kirach
Copy link
Contributor

kirach commented Mar 4, 2016

As it stated in documentation:

option values function
interactive boolean Keep all features permanently in selected mode - default: false

But it doesn't work. When I create mapbox.Draw with interactive: true - I still can leave selected mode if I click somewhere outside of shape.

@mcwhittemore
Copy link
Contributor

@kirach - are you using this for styling reasons or do you want the always editable functionality?

In #109 we've been talking about how the being edited and not being edited states are pretty limiting. There is also a conversation about supporting some pretty complex styling rules #248 just for context.

@kirach
Copy link
Contributor Author

kirach commented Mar 9, 2016

@mcwhittemore I just want to always have 'editable' state. No styling reasons.

@mcwhittemore
Copy link
Contributor

@kirach for all features or just some?

@kirach
Copy link
Contributor Author

kirach commented Mar 9, 2016

@mcwhittemore Well, I think both of options would work for me, because I place only one shape to the map and want it to always be in "interactive" mode. So it can can be either 'all features' or I can specify it only for one shape that I place.

@mcwhittemore
Copy link
Contributor

Thanks - one way to do this without some sort of config in gl-draw is to have an event handler on draw.select.end that reselects the feature if it gets unselected. Does this work for you? My fear here would be that there could be a flicker between styles.

I'm trying to drop extra features that complicate the code so if we can find a good way to achieve this that would be great.

@kirach
Copy link
Contributor Author

kirach commented Mar 15, 2016

@mcwhittemore Thank you for your suggestion. I've tried it and it works, but as you expected - there is a flicker even though I've made both styles (for selected and not selected shape) same:
screenshot

It can be temporary solution, but it's definitely not what we would go with in production :(

@mcwhittemore
Copy link
Contributor

Currently setData isn't part of the mapbox-gl-js batch command, I think this might fix the flicker.

@lucaswoj what do you think?

@lucaswoj
Copy link

The batch command is for methods on Style. setData is a method on GeoJSONSource.

This flicker is due to an async delay on setData. The correct solutions to this problem, IMO, are

@kirach
Copy link
Contributor Author

kirach commented Mar 16, 2016

Hey guys, wouldn't it be simpler just to keep interactive option and if it's true - just ignore when user clicks outside of shape?

@mcwhittemore
Copy link
Contributor

@kirach - having flags that limit the way internal state works is pretty weird and I think asking users to maintain this kind of state is the right move as it empowers different types of control without adding complicity to an already complex library. The permanent flag @drewbo is talking about in #109 is another example.

In the last incarnation of gl-draw these two options we handleable, but as we look to enabling more advanced selection tools and styling options (#248 via #257 in progress in #258) these kinds of options quickly becoming limiting to both the library and the end-developer.

If the path forward that #258 is taking us on isn't right for you, lets talk about it on that PR.

@mcwhittemore mcwhittemore added this to the Fresh Start milestone Mar 25, 2016
@mcwhittemore mcwhittemore mentioned this issue Mar 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants