我们经常需要对多个地图进行联动 分别展示,
对于cesium 的多屏联动 我们用typescript 实现
```javascript
export class LinkageMap{
private viewers:Array;
private focusIndex=0;
constructor(_viewers:Array){
super();
this.viewers = _viewers;
}
sync(focusIndex=0){
this.focusIndex= focusIndex;
this.viewers[0].scene.postRender.addEventListener(this.syncMapEventHandle, this);
for(let index =0;index {
this.focusIndex = index;
}
}
}
cancelSync(){
this.viewers[0].scene.postRender.removeEventListener(this.syncMapEventHandle, this);
for(let index =0;index
const viewer= this.viewers[index];
viewer.container.onmouseenter = null;
}
}
private syncMapEventHandle(){
更多参考 https://xiaozhuanlan.com/topic/3879512640
网友评论