So far, in this chapter, we've looked at how to respond to events that OpenLayers itself publishes, such as tile load events and vector feature events, such as feature added. However, what about user-driven gestures and interactions with the map? This recipe takes a look at some of these types of events.
We'll demonstrate the click or tap and map panning events. When the user clicks on or touches the map, the geometry and pixel coordinates will be displayed in the sidebar. When the map is panned, the new visible extent of the map will be displayed in the sidebar as well.
The source code can be found in ch04/ch04-mouse-touch-events
, and here's a screenshot of what this will look like:
