mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-15 22:36:58 +00:00
Fix JS error on non-mobile devices (issue #4239)
This commit is contained in:

committed by
Vladimir Agafonkin

parent
a4422ed395
commit
5e93da5c70
@ -39,8 +39,15 @@ title: Tilt handler
|
||||
|
||||
_tilt: function(ev) {
|
||||
// Treat Gamma angle as horizontal pan (1 degree = 1 pixel) and Beta angle as vertical pan
|
||||
this._map.panBy( L.point( ev.gamma, ev.beta ) );
|
||||
document.getElementById('info').innerHTML = ev.gamma + ',' + ev.beta;
|
||||
var info;
|
||||
var offset = L.point(ev.gamma, ev.beta)
|
||||
if (offset) {
|
||||
this._map.panBy(offset);
|
||||
info = ev.gamma + ',' + ev.beta;
|
||||
} else {
|
||||
info = 'Device orientation not detected'
|
||||
}
|
||||
document.getElementById('info').innerHTML = info
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user