-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Allowing user-defined interaction handlers, and splitting them into a submodule #8886
Comments
What would those interaction paradigms be? Could you provide any examples/use cases before adding an API? |
Some common configurations I can think of, On Desktop:
On mobile:
Right now our approach is kinda forceful, so I was thinking decoupling the logic. making it optional with a clear interface boundary might make it easier to implement all this variety. |
Thanks; I think that makes sense. |
I'm 👎 on cutting this out into a different repo. This will increase complexity and maintaining burden quite a bit, and I don't anticipate users plugging their own implementations all at once, since this is a lot of code — usually they would customize some things while leaving others at default behavior. 👍 on improving handler code extensibility though. |
Motivation
We have a number of issues in our issue queue that are regarding customizing various things regarding interactivity.
dragInertia
options for custom drag panning #8260The idea with this proposal is to make this easier to do for developers by allowing them to bind their own event handlers declaratively at map init time, moving what we do in
bind_handlers.js
up and out so developers can integrate their own implementations and not necessarily have to rely on passingoptions
and or activating/deactivating handlers that we have.We can take this one step further, and extract our handlers and controls into separate npm packages ( similar to what babel and turf do ) so users not using our implementations don't have to pay the cost of the increased bundle size.
Design Alternative
The current status quo of adding additional options to
Map
, and or exposing configuration thoughmap.{handlerName}
.This has the potential of adding a lot of cruft and complexity over-time as we try to accomodate additional requests.
Design
Map
isinteractive:false
by default, and this option gets removed from theMap
constructor.map.bindInteractionHandlers(handlers: EventHandlers)
method, this is how you would add interactivity to the map.interactive: true
would look something like this.Pros:
hammer.js
can have better integration with the rest of their app.Cons:
map
for things likezooming
hackily throughout the codebase.The text was updated successfully, but these errors were encountered: