diff --git a/examples/geolocation-orientation.js b/examples/geolocation-orientation.js index 99e653fcda..2a3a32aa05 100644 --- a/examples/geolocation-orientation.js +++ b/examples/geolocation-orientation.js @@ -47,13 +47,13 @@ var positions = new ol.geom.LineString([], // Geolocation Control var geolocation = new ol.Geolocation(/** @type {olx.GeolocationOptions} */ ({ + projection: view.getProjection(), trackingOptions: { maximumAge: 10000, enableHighAccuracy: true, timeout: 600000 } })); -geolocation.bindTo('projection', view); var deltaMean = 500; // the geolocation sampling period mean in ms diff --git a/examples/geolocation.js b/examples/geolocation.js index af65afd0dd..50da8d7550 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -30,8 +30,9 @@ var map = new ol.Map({ view: view }); -var geolocation = new ol.Geolocation(); -geolocation.bindTo('projection', view); +var geolocation = new ol.Geolocation({ + projection: view.getProjection() +}); var track = new ol.dom.Input(document.getElementById('track')); track.bindTo('checked', geolocation, 'tracking'); diff --git a/examples/mobile-full-screen.js b/examples/mobile-full-screen.js index 63441b0de7..986bb92572 100644 --- a/examples/mobile-full-screen.js +++ b/examples/mobile-full-screen.js @@ -25,9 +25,9 @@ var map = new ol.Map({ }); var geolocation = new ol.Geolocation({ + projection: view.getProjection(), tracking: true }); -geolocation.bindTo('projection', view); geolocation.once('change:position', function() { view.setCenter(geolocation.getPosition()); view.setResolution(2.388657133911758); diff --git a/src/ol/geolocation.js b/src/ol/geolocation.js index 8b4bc23874..0ec8d27e1b 100644 --- a/src/ol/geolocation.js +++ b/src/ol/geolocation.js @@ -42,9 +42,10 @@ ol.GeolocationProperty = { * * Example: * - * var geolocation = new ol.Geolocation(); - * // take the projection to use from the map's view - * geolocation.bindTo('projection', map.getView()); + * var geolocation = new ol.Geolocation({ + * // take the projection to use from the map's view + * projection: view.getprojection() + * }); * // listen to changes in position * geolocation.on('change', function(evt) { * window.console.log(geolocation.getPosition());