mapbox/mapbox-gl-directions
setOrigin and setDestination changing others maps directions
開放
#170 建立於 2018年3月14日
bughelp wanted
倉庫指標
- 星標
- (253 顆星)
- PR 合併指標
- (平均合併 22小時 39分鐘) (30 天內合併 1 個 PR)
描述
Hi,
I have 2 classes with 2 differents maps with differents containers. When i made changes on one map, this is independant from the other map, excepts for setOrigin and setDestination. Those 2 functions impacts the two independants directions instances.
Class 1
this.map1 = new mapboxgl.Map({
container: 'map1',
style: 'mapbox://styles/mapbox/streets-v10',
});
this.directions1 = new MapboxDirections({
accessToken: mapboxgl.accessToken,
unit: 'metric',
profile: 'walking',
interactive: false,
controls: {
inputs: false,
instructions: false,
profileSwitcher: false
}
});
this.map1.addControl(this.directions);
...
this.directions1.setOrigin([lon, lat]);
this.directions1.setDestination([lon+1, lat+1]);
Class 2
this.map2 = new mapboxgl.Map({
container: 'map2',
style: 'mapbox://styles/mapbox/streets-v10',
});
this.directions2 = new MapboxDirections({
accessToken: mapboxgl.accessToken,
unit: 'metric',
profile: 'walking',
interactive: false,
controls: {
inputs: false,
instructions: false,
profileSwitcher: false
}
});
this.map2.addControl(this.directions);
...
this.directions2.setOrigin([lon+3, lat+3]);
this.directions2.setDestination([lon+3, lat+3]);
Problem : the setOrigin and setDestination from directions2 impacts the direction1 instance.