Add 'tracking' property to ol.DeviceOrientation

This commit is contained in:
Frederic Junod
2013-04-16 09:40:59 +02:00
parent 448e300a03
commit c431cc7f63
3 changed files with 73 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ goog.require('ol.DeviceOrientation');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.dom.Input');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OSM');
@@ -21,6 +22,8 @@ var map = new ol.Map({
});
var deviceOrientation = new ol.DeviceOrientation();
var track = new ol.dom.Input(document.getElementById('track'));
track.bindTo('checked', deviceOrientation, 'tracking');
deviceOrientation.on('changed', function() {
document.getElementById('alpha').innerHTML = deviceOrientation.getAlpha();