Leaflet扩展:处理程序和控件

Leaflet扩展:处理程序和控件
发布日期: 2017-04-19 更新日期: 2017-04-19 编辑:xuzhiping 浏览次数: 4527

标签:
 L.TiltHandler = L.Handler.extend({
    addHooks: function() {
        L.DomEvent.on(window, 'deviceorientation', this._tilt, this);
    },

    removeHooks: function() {
        L.DomEvent.off(window, 'deviceorientation', this._tilt, this);
    },

    _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 ) );
    }
});
L.Map.addInitHook('addHandler', 'tilt', L.TiltHandler);
var map = L.map('mapDiv', { tilt: true });
说明:

Leaflet扩展:处理程序和控件


Copyright © Since 2014. 开源地理空间基金会中文分会 吉ICP备05002032号

Powered by TorCMS

OSGeo 中国中心 邮件列表

问题讨论 : 要订阅或者退订列表,请点击 订阅

发言 : 请写信给: osgeo-china@lists.osgeo.org