cesium 实现卷帘
这里需要ImageryLayer 定义
参考 cesium 图层那些事
```javascript
/**
- 卷帘效果
*/
import {ImageryLayer} from "./ImageryLayer";
export class ShutterEffect {
private map: any;
private _wrapper: any;
private _splitter: any;
private _splitterWidthCenter: any;
private _moveActive: boolean = false;
private _handler: any = null;
private _leftImageryLayer :ImageryLayer|null = null;
private _rightImageryLayer :ImageryLayer|null = null;
constructor(map: any) {
this.map = map;
this.moveHandler = this.moveHandler.bind(this);
}
-
start(left:ImageryLayer|null,right?:ImageryLayer|null,splitPosition = 0.5) {
-
this.stop();
-
if(this._wrapper || this._handler){
-
return;
-
}
-
if(left){
-
this._leftImageryLayer = left;
-
left.splitDirection(Cesium.ImagerySplitDirection.LEFT);
-
}
-
if(right){
-
this._rightImageryLayer = right;
-
right.splitDirection(Cesium.ImagerySplitDirection.RIGHT);
-
}
-
this.createDom(splitPosition);
-
}
-
-
stop() {
-
if (this._handler) {
-
this._handler.destroy();
-
this._handler = null;
-
}
-
if(this._wrapper){
-
this.map.container.removeChild(this._wrapper);
-
this._wrapper = null;
-
}
-
if(this._leftImageryLayer){
-
this._leftImageryLayer.removeByMap();
-
}
-
if(this._rightImageryLayer){
-
this._rightImageryLayer.removeByMap();
-
}
更多参考
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律