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.