# new SwipeTool(options)
卷帘工具,继承自zondy.tool.BaseSwipeTool
参数:
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
options |
Object | 构造参数 |
|
view |
BaseView | 视图对象,必传 |
|
leadingLayers |
Array.<Layer> | [] | 左侧或者上部图层列表,根据卷帘的模式调整。在leaflet-plguin的MapView中使用时,矢量图层、组图层不支持卷帘 |
trailingLayers |
Array.<Layer> | [] | 右侧或者下部图层列表,根据卷帘的模式调整。在leaflet-plguin的MapView中使用时,矢量图层、组图层不支持卷帘 |
region |
Number | 区域信息,当region为0.5时,沿着水平卷帘或垂直卷帘方向50%的区域。当前值域范围为0-1 |
|
mode |
SwipeType | SwipeMode.hzorizontal | 卷帘的模式。当前仅支持两种模式,'horizontal'水平和'vertical'垂直两种模式 |
示例
const swipeTool = new SwipeTool({
view: view,
leadingLayers: layerArray1,
trailingLayers: layerArray2,
});
// 销毁swipeTool
swipeTool.destroy();
// 动态修改mode
swipeTool.mode = SwipeMode.vertical;
// 动态修改region
swipeTool.region = 0.3;
// 关闭卷帘效果
swipeTool.enable(false);
