y / lng coords에 의존하는 전단지 원 반경 변경
문제
일반지도가 아닌 인체의 그림을 표시하기 위해 Mapbox / 전단지를 사용하고 있습니다.
나는 전단지 끌기를 사용하고 있으며, 원 원을 만들고 반경을 유지하면서 주위를 움직일 수 있어야합니다.그러나지도 / 화면의 바닥으로 움직일 때 크기가 지수가 증가합니다.나는 그것이 같은 크기를 유지하기를 원한다.
나는 그것이 투영이나 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);
});
.
아이디어가 있습니까?L.Circle이 할 수있는 전단지 드로잉을 사용할 필요가 없지만 동일한 문제가 있습니다.
여기에 문제가있는 GIF :
해결책
이 작은 보석을 포함하여 전단지 0.7 코드를 포함하여 전단지 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);
},
.
0.8dev로 업데이트되며 모두 수정되었습니다!
제휴하지 않습니다 StackOverflow