Class: SwipeTool

SwipeTool

new SwipeTool(options)

tool/SwipeTool.js, line 3

卷帘工具,继承自zondy.tool.BaseSwipeTool

Name Type Description
options Object

构造参数

Name Type Default Description
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'垂直两种模式

Example
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);

Methods

destroy()

tool/SwipeTool.js, line 51

销毁工具实例

enable(enabled)

tool/SwipeTool.js, line 42

开启或关闭卷帘

Name Type Description
enabled Boolean