dictionary - Leaflet polyline not moving on drag/zoom -
i'm using leaflet custom crs.simple projection. if draw polyline @ page load more or less drawn ok (although more accurate in firefox in chrome) if drag map polyline remains in same place of browser window, appears shifted respect of background map.
example: initial load
after drag map, map moves polyline remains in same place
to add polyline i'm converting coordinates crs.simple projection. don't think there problem here every other map marker or text appears correctly
..... //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 bounds of map current dimension var mapbounds = new l.latlngbounds( map.unproject([0, mapheight], mapmaxzoom), map.unproject([mapwidth, 0], mapmaxzoom) ); //load 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 use simple system, transform point (based on pixel) on map coordinates leaflet understand return map.unproject([px, py], map.getmaxzoom()); }
any idea i'm doing wrong, or bug? workaround appreciated
ok, seems problem in stable version (0.7.3) using dev version (1.0-dev) works ok , solves problem different browser drawing
Comments
Post a Comment