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

Switch to Plugin API, convert gesture detection to a layer #174

Closed
johnpryan opened this issue Nov 21, 2018 · 7 comments
Closed

Switch to Plugin API, convert gesture detection to a layer #174

johnpryan opened this issue Nov 21, 2018 · 7 comments
Labels
feature This issue requests a new feature

Comments

@johnpryan
Copy link
Collaborator

  1. making all layers a "plugin" and 2. adding a gesture detection layer.

see #160 for background

@johnpryan johnpryan added the feature This issue requests a new feature label Nov 21, 2018
@kengu
Copy link
Contributor

kengu commented Dec 13, 2018

@johnpryan: I'm currently blocked on this issue. Could we start an design discussion so that I can attempt an implementation of this issue?

@kengu
Copy link
Contributor

kengu commented Dec 13, 2018

From #153

After looking at this a little more closely, I don't think this PR should make changes to MapGestureMixin. It should be each layer's job to enter the gesture arena and immediately leave the gesture arena if the tap (or drag, for example) gesture is not on a polygon. This will be more flexible in the long run and this approach will allow for more interactive gestures by simply leaving it up to the layers themselves.

There are some challenges to doing this; the main challenge is that FlutterMapState is currently handling the gestures, but really the gesture mixing should be just a layer rendered above the tile layer.

I am going to make a separate ticket for this but for now I would like to leave this PR open so that we can come back and add this feature after 1. making all layers a "plugin" and 2. adding a gesture detection layer.

@kengu
Copy link
Contributor

kengu commented Dec 13, 2018

@johnpryan, does "entering the gesture area" imply that each layer should implement a RawGestureDetector along the same lines as Flutter Deep Dive: Gestures. Or is it just an analogy, implying something more along the lines of each layer listening for gesture events generated by the gesture layer and handling them?

If it is the latter, I guess this could easily be implemented with streams passed to each layer with the createLayer in the MapStateobject. Each layer could then listen for specific events using the filter method, and convert hits on geometries to invocation of callbacks passed to the layer in LayerOptions. This would also solve my current problem, which is implementing a geometry editor plugin. This editor needs to respond to drag events, which is hard to implement with a GestureDetector in a child widget when Stack is used.

The only issue I can see so far, is how to determine a winner when multiple geometries are located inside the same hit area. If we when for traditional callbacks instead, we could implement winning with boolean return value from each callback, or something similar to e.stopPropagation().

@johnpryan
Copy link
Collaborator Author

Yes, each layer should have the ability to handle gestures for themselves without relying on the MapGestureMixin to decide what polygon, circle, or marker was tapped. The goal is to support tap events of all layer types. #160 does not quite work for cases like that

@johnpryan johnpryan self-assigned this Feb 21, 2019
@johnpryan johnpryan removed their assignment Jun 7, 2019
This was referenced Aug 29, 2019
@ruizalexandre
Copy link

@johnpryan I pushed a PR to move layers to Flutter widgets ! With that you can rebuild layer easily ! Solve performance issue also

#542 here

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Mar 31, 2021
@github-actions
Copy link

github-actions bot commented Apr 5, 2021

This issue was closed because it has been stalled for 5 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue requests a new feature
Projects
None yet
Development

No branches or pull requests

3 participants