小叶圆半径根据y/lng坐标而变化

Ada*_*ker 2 leaflet mapbox

我使用mapbox/leaflet来显示人体的图片而不是常规地图.

我正在使用传单绘制,我需要能够创建一个圆并在保持其半径的同时移动它.但是,当我将它移向地图/屏幕的底部时,大小会逐渐增加.我希望它保持相同的大小.

我认为它与投影或CRS有关,但我不知道如何阻止它.

我的代码是:

    var mapMinZoom = 0;
    var mapMaxZoom = 4;
    var map = L.map('map', {
        maxZoom: mapMaxZoom,
        minZoom: mapMinZoom,
        crs: L.CRS.Simple,
        noWrap: true,
        continuousWorld: true
    }).setView([0, 0], mapMaxZoom);

    var mapBounds = new L.LatLngBounds(
        map.unproject([0, 3840], mapMaxZoom),
        map.unproject([4096, 0], mapMaxZoom));

    map.fitBounds(mapBounds);
    L.tileLayer('/tiles/{z}/{x}/{y}.png', {
        minZoom: mapMinZoom, maxZoom: mapMaxZoom,
        bounds: mapBounds,
        attribution: 'Rendered with <a href="http://www.maptiler.com/">MapTiler</a>',
        noWrap: true,
        continuousWorld: true
    }).addTo(map);

     var touches;

     var featureGroup = L.featureGroup().addTo(map);

     var drawControl = new L.Control.Draw({
         edit: {
             featureGroup: featureGroup
         }
     }).addTo(map);

    map.on('draw:created', function (e) {
        featureGroup.addLayer(e.layer);
    });
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?我不需要使用传单绘制,只是L.circle会这样做,但它有同样的问题.

问题的Gif在这里:

在此输入图像描述

Ada*_*ker 5

原来在传单0.7代码中有一堆todos ...包括这个小宝石:

// TODO Earth hardcoded, move into projection code!

_getLatRadius: function () {
    return (this._mRadius / 40075017) * 360;
},

_getLngRadius: function () {
    return this._getLatRadius() / Math.cos(L.LatLng.DEG_TO_RAD * this._latlng.lat);
},
Run Code Online (Sandbox Code Playgroud)

更新到0.8Dev,它已全部修复!