Dictionary 传单多段线在拖动/缩放时不移动
我正在使用带有定制CRS的传单。简单投影。如果我在页面加载时绘制一条多段线,它或多或少是绘制正常的(虽然在firefox中比在chrome中精确得多),但是如果我拖动地图,多段线将保留在浏览器窗口的相同位置,因此在背景地图上会出现偏移 例如: 初始荷载 拖动地图后,地图将移动,但多段线仍保留在同一位置 要添加多段线,我将坐标转换为CRS。简单投影。我认为这里没有问题,因为其他地图标记或文本都显示正确Dictionary 传单多段线在拖动/缩放时不移动,dictionary,leaflet,polyline,Dictionary,Leaflet,Polyline,我正在使用带有定制CRS的传单。简单投影。如果我在页面加载时绘制一条多段线,它或多或少是绘制正常的(虽然在firefox中比在chrome中精确得多),但是如果我拖动地图,多段线将保留在浏览器窗口的相同位置,因此在背景地图上会出现偏移 例如: 初始荷载 拖动地图后,地图将移动,但多段线仍保留在同一位置 要添加多段线,我将坐标转换为CRS。简单投影。我认为这里没有问题,因为其他地图标记或文本都显示正确 ..... //initialize leaflet map map = L.map('ma
.....
//initialize leaflet map
map = L.map('map', {
maxZoom: mapMaxZoom,
minZoom: mapMinZoom,
zoomControl: false,
crs: L.CRS.Simple //simple coordinates system
}).setView([0, 0], mapMaxZoom);
//set the bounds of the map to the current dimension
var mapBounds = new L.LatLngBounds(
map.unproject([0, mapHeight], mapMaxZoom),
map.unproject([mapWidth, 0], mapMaxZoom)
);
//load the tiles
map.fitBounds(mapBounds);
L.tileLayer(mapData.info.tiles+'/{z}/{x}/{y}.png', {
minZoom: mapMinZoom,
maxZoom: mapMaxZoom,
bounds: mapBounds,
attribution: '',
noWrap: true,
continuousWorld: true
}).addTo(map);
.....
var pointList = [getMapCoordinates(1750,1750),
getMapCoordinates(1520,1764),
getMapCoordinates(1300,1560),
getMapCoordinates(1132,1258),
getMapCoordinates(1132,1060),
getMapCoordinates(926,960)];
polyline = new L.Polyline(pointList, {
color: 'red',
weight: 3,
opacity: 0.5,
smoothFactor: 1
});
polyline.addTo(map);
....
function getMapCoordinates(px,py)
{
//as we use simple system, transform the point (based on pixel) on map coordinates that leaflet understand
return map.unproject([px, py], map.getMaxZoom());
}
你知道我做错了什么吗,还是一只虫子?任何解决方法都值得赞赏好的,问题似乎是在稳定版本(0.7.3)中,使用dev版本(1.0-dev)工作正常,甚至解决了不同浏览器绘图的问题