单击地图时出现Ionic 3 Leaflet CRS地图错误

时间:2018-08-13 21:44:15

标签: ionic3 leaflet

我正在使用Ionic 3和Leaflet来绘制crs地图。该地图可以正常渲染,但是当我单击或对地图执行任何操作时,都会出现此错误:

  

无法读取未定义的属性'_leaflet_pos'

我找到了a github issue about adding touchExtend。虽然这似乎已经清除了错误,但它不是map实例的已知参数。因此,我所有的前端路径都无效。

是否有更好的解决方法?这是我的.ts文件的样子:

public map: L.Map = null;

@ViewChild('map') mapContainer: ElementRef;

...

if (this.map != undefined) {
  this.map.off();
  this.map.remove();
}

map = L.map(this.mapContainer.nativeElement, {
  crs: L.CRS.Simple
  // touchExtend: false 
});

let bounds: any = [[0, 0], [myObject.mapHeight, myObject.mapWidth]];
let image: any = L.imageOverlay(myObject.mapUrl, bounds).addTo(this.map);

this.map.fitBounds(bounds);

0 个答案:

没有答案
相关问题