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

When enabled, Find Me Button should change pinch gesture location so it centers over top of the location gem #125

Closed
msmollin opened this issue Dec 19, 2016 · 2 comments

Comments

@msmollin
Copy link
Member

I noticed in google and apple maps that when location tracking is functioning, they change how their pinch gestures function. Normally, pinch gestures focus the centers of the zoom wherever the user placed their fingers. However, when location tracking is enabled, the center is changed to always be on top of the location gem marker.

After some discussion with @karimnaaji it seems we'd need to alter Tangram's interface a bit to handle this. I believe the easiest way to do this is to allow implementing developers to mutate the CGPoint location we're passing to them in shouldRecognizePinchGesture: from the TGRecognizerDelegate callbacks. The difficulty here is expressing the mutability of the parameters due to the nature of the protocol being defined in objective-c but imported into swift.

There are a few alternative options, the easiest of which seems like a public obj-c function that wraps Tangram's self.map->handlePinchGesture() function, and some minor refactoring of the obj-c SDK code to use the new wrapper function. That way the implementor could override the handlePinchGesture function, change the location as necessary, and then call the superclass implementation.

@msmollin
Copy link
Member Author

Did a little more reading over lunch. We may be able to switch the CGPoint definition to use pass by reference on the objective-c side, so CGPoint **location and then swift should import that as an UnsafeMutablePointer and allow the mutation to happen.

@msmollin
Copy link
Member Author

Closing in favor of #293

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant