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
Center location maker in bottom half of screen in routing mode #180
Conversation
d868fc1
to
61aae6d
Compare
Nice, the approach you've found is pretty clean. Getting it to reliably update in one frame might be the trickier bit. Unless a stylesheet requires some kind of animation, tangram-es will render on-demand, meaning that when a parameter or datum is changed that will impact the image on screen, a render is requested. I say "requested" because the actual rendering happens on a dedicated thread, separate from application logic. What's likely happening in this case is:
The outcome is that you will see the map drawn at the first position for one frame or so and then immediately snap to the second position. Two solutions come to mind:
Option 2 seems pretty reasonable to me right now, I'm open to ideas from others too. |
Can we add a method to the For example:
The return value would be a list with 4 elements representing the |
I believe we can add this "position forecasting" to tangram. Additionally, to be sure that we're not triggering spurious renders, we can add a combined setter for all of the view parameters. I'll let you know when we've got something in tangram that you can use. |
With a small addition to tangram-es, I've implemented this view adjustment without stuttering over here: https://github.com/mapzen/eraser-map/tree/matt/105-route-position-offset The new |
61aae6d
to
a31b986
Compare
👍 Nicely done @blair1618. |
Center location maker in bottom half of screen in routing mode
WindowManager
.LngLat
coordinates are calculated for the adjusted position usingMapController.coordinatesAtScreenPosition(screenWidth/2, screenHeight/4)
.While successfully centering the route location marker in the bottom half of the screen this solution has the side effect of causing the map to flicker due to setting the map position twice in rapid succession.
@blair1618 @tallytalwar @karimnaaji is there a way to delay rendering until the final coordinates are calculated? Or is there a better approach we can use to implement this feature?
Closes #105