我正在使用Leaflet v0.7,并且在地图或tileLayer上似乎没有min/maxZoom的setter.
有没有办法动态设置这些值?
如何查看localStorage中的内容,例如Google Chrome:资源 - >本地存储
(我的意思是在FF开发工具,而不是Firebug)
对于智能手机的增强现实网络应用程序,我正在尝试计算当用户手持设备时的罗盘方向,屏幕在垂直平面中,屏幕顶部朝上.
我从http://dev.w3.org/geo/api/spec-source-orientation(参见工作示例)中采用了建议的公式,并实现了以下功能:
function compassHeading(alpha, beta, gamma) {
var a1, a2, b1, b2;
if ( beta !== 0 || gamma !== 0 ) {
a1 = -Math.cos(alpha) * Math.sin(gamma);
a2 = Math.sin(alpha) * Math.sin(beta) * Math.cos(gamma);
b1 = -Math.sin(alpha) * Math.sin(gamma);
b2 = Math.cos(alpha) * Math.sin(beta) * Math.cos(gamma);
return Math.atan((a1 - a2) / (b1 + b2)).toDeg();
}
else {
return 0;
}
}
Run Code Online (Sandbox Code Playgroud)
而.toDeg()是一个Number对象扩展,由http://www.movable-type.co.uk/scripts/latlong.html提供
/** Converts radians to numeric (signed) degrees */
if (typeof Number.prototype.toDeg == 'undefined') { …Run Code Online (Sandbox Code Playgroud)