mmmap
v0.0.2
Published
地图覆盖物api,兼容高德/百度
Downloads
2
Readme
import { createCoverage } from 'mmmap'
let coverage
/**
|--------------------------------------------------
| 覆盖物
|--------------------------------------------------
*/
// 创建点
coverage = createCoverage({ lng: 119, lat: 29 })
// 创建圆
coverage = createCoverage({ lng: 119, lat: 29, backgroundColor: 'rgba(0,0,0,0.4)', borderColor: 'black', borderWidth: 0.5, radius: 500 })
// 创建 polyLine
const points = [ {lng: 119, lat: 29}, {lng: 118, lat: 29}, {lng: 119, lat: 28} ]
coverage = createCoverage({ borderColor: 'black', borderWidth: 0.5, points })
// 创建 polygon
const points = [ {lng: 119, lat: 29}, {lng: 118, lat: 29}, {lng: 119, lat: 28} ]
coverage = createCoverage({ backgroundColor: 'rgba(0,0,0,0.4)', borderColor: 'black', borderWidth: 0.5, points })
/**
|--------------------------------------------------
| 事件
|--------------------------------------------------
*/
// 点击事件
coverage = createCoverage({ lng: 119, lat: 29, onClick: ()=>alert(1) })
// hover改变样式
coverage = createCoverage({ backgroundColor: 'rgba(0,0,0,0.4)', borderColor: 'black', borderWidth: 0.5, points, hoverStyle: {
backgroundColor: 'red',
borderColor: 'red',
context: map // map 实例
} })