Add 'tracking' property to ol.DeviceOrientation
This commit is contained in:
@@ -37,9 +37,12 @@
|
||||
|
||||
<div class="span4">
|
||||
<h4 id="title">Device orientation example</h4>
|
||||
<p>α : <code id="alpha"></code> rad</p>
|
||||
<p>β : <code id="beta"></code> rad</p>
|
||||
<p>γ : <code id="gamma"></code> rad</p>
|
||||
<label class="checkbox" for="track">
|
||||
<input id="track" type="checkbox"/>track changes
|
||||
</label>
|
||||
<p>α : <code id="alpha"></code></p>
|
||||
<p>β : <code id="beta"></code></p>
|
||||
<p>γ : <code id="gamma"></code></p>
|
||||
<p id="shortdesc">Listen to DeviceOrientation events</p>
|
||||
<div id="docs">
|
||||
<p>See the <a href="device-orientation.js" target="_blank">device-orientation.js source</a> to see how this is done.</p>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user