Creating a navigation history

In the next example, called ch06_navhist, we will create a fully functional navigation history. First, as usual, we have to make some considerations. We will store an array in the control containing the view properties for every change. We will also store the current index as we must remember to step our control between view states. A not-so-important property that we will store is a Boolean value, representing whether we should record the new view or not. This is particularly handy when we step between the history elements and do not want to double store these states. First, we create the first button for the control:

ol.control.NavigationHistory = function (opt_options) { var options = opt_options || {}; var _this ...

Get Mastering OpenLayers 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.