1.0.5 • Published 2 years ago

arcgis-popup-control v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

arcgis-popup-control

基于ArcGis For JavaScript 4.x的自定义弹窗控制

20230531_155823.gif

Features

  • 纯JS实现,兼容性强

Install

npm install --save arcgis-popup-control
or
pnpm install --save arcgis-popup-control

Usage

Vue3使用示例:

核心代码

<template>
  <Map>
    <MyPopup v-show="popupVisible" :style="{ position: 'absolute', top: popupPosition.top, left: popupPosition.left }" />
  </Map>
</template>

<script setup>
  import { reactive, ref } from 'vue';
  import PopupControl from 'arcgis-popup-control'
  
  const popupPosition = reactive({left: '0px', top: '0px'})
  let popupVisible = ref(false)
  
  // PopupControl 的部分配置参数
  const options = {
      // 强制性必填
    view, 
      // open的回调返回 { left: 100, top: 100, attributes: {} } 结构的对象
    open: (obj) => { 
      // 更新定位并打开弹窗等逻辑
      popupPosition.left = obj.left + 'px'
      popupPosition.top = obj.top + 'px'
      popupVisible.value = true
    },
    close: () => {
      // popupVisible = false等一些操作逻辑
      popupVisible.value = false
    }
  }
  
  // 创建 PopupControl
  const popupControl = new PopupControl(options)
</script>

Options 参数

参数说明类型可选值默认值
viewView实例View必填-
open打开的回调方法, 接收{ left: 100, top: 100, attributes: {} } 结构的对象Function--
close关闭的回调方法Function--
include要包含在hitTest中的图层和图形列表。如果未指定include,则将包括所有图层和图形参照ArcGis MapView hitTest-undefined
exclude要从hitTest中排除的图层和图形列表。如果未指定exclude,则不排除任何图层或图形。参照ArcGis MapView hitTest-undefined
emptyClose点击空白处弹窗是否自动关闭Booleanfalsetrue
dragCloseType地图移动时弹窗动作 'close': 关闭弹窗、'hide': 暂时隐藏,停止移动后显示、'never': 不关闭Sting'close' 'never''hide'
positionType定位坐标来源, 'click': 点击位置的坐标, 'geometry': Graphic geometry的中心点Sting'click''geometry'
goto是否开启view.gotoBooleantruefalse
transitiongoTo持续时长(毫秒)Number-800

方法

方法名说明类型参数
destroy销毁方法--

Related

License

MIT © Matheus Fernandes

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago