Mapbox-gl-js: Example for moving around on map with game-like controls

Created on 4 Aug 2016  路  3Comments  路  Source: mapbox/mapbox-gl-js

This demo is popular: https://www.mapbox.com/bites/00279/

I have gotten requests for an example that uses left, right, up, down arrow keys buttons for navigating a map. Here's the code @tristen and I wrote for these interactions: https://gist.github.com/samanpwbb/57a44206652ddc73887b11a392bf6c76

Most helpful comment

See #3178 and the live example here!

All 3 comments

We do have the "Move symbol with the keyboard" example. What do you think about improving that example with your interaction handling code instead of creating a new example?

What do you think about improving that example with your interaction handling code instead of creating a new example?

The two examples are pretty different. My demo has UI controls that move the map position (the bat is just an absolute positioned div). The existing demo moves a symbol layer with setData and relies on keyboard presses.

I see value in both examples. Adding keyboard controls to the existing demo that work the way the bat demo works runs the risk of over-complicating the existing demo.

See #3178 and the live example here!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaronlidman picture aaronlidman  路  3Comments

stevage picture stevage  路  3Comments

rigoneri picture rigoneri  路  3Comments

aderaaij picture aderaaij  路  3Comments

jfirebaugh picture jfirebaugh  路  3Comments