Fix JS error on non-mobile devices (issue #4239)

This commit is contained in:
vncntcltt
2020-03-06 14:39:30 +01:00
committed by Vladimir Agafonkin
parent a4422ed395
commit 5e93da5c70

View File

@ -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
}
});