microvideo-map
Advanced tools
Comparing version 0.1.7 to 0.2.0
@@ -29,3 +29,3 @@ import { getIconName } from '../../public-function' | ||
async loadLayer() { | ||
this.layer = await this.sdk.openMvMapTrafficLayer(this.config) | ||
this.layer = await this.sdk.createMvMapTrafficLayer(this.config) | ||
return this.layer | ||
@@ -32,0 +32,0 @@ } |
@@ -147,3 +147,4 @@ /** | ||
iconSize: null, // 这里iconSize设置为null,是因为当前设置的是点位点击效果,此时data数据里已有size值 | ||
hasActive: false | ||
hasActive: false, | ||
isCurrentClickMarker: true | ||
} | ||
@@ -319,18 +320,21 @@ | ||
marker.on('click', e => { | ||
// 清除之前的点击marker | ||
this.setMvMapClickMarker() | ||
if (markerIconConfig.hasIconActive && config.hasActive && (item.hasClickStatus || config.hasClickStatus)) { | ||
// 设置点击效果 | ||
const extData = { | ||
...marker.getExtData(), | ||
size: (iconOptions && iconOptions.pointSize) || item.size, | ||
offset: item.offset || offset, | ||
if (!config.isCurrentClickMarker) { | ||
// 清除之前的点击marker | ||
this.setMvMapClickMarker() | ||
if (markerIconConfig.hasIconActive && config.hasActive && (item.hasClickStatus || config.hasClickStatus)) { | ||
// 设置点击效果 | ||
const extData = { | ||
...marker.getExtData(), | ||
size: (iconOptions && iconOptions.pointSize) || item.size, | ||
offset: item.offset || offset, | ||
} | ||
this.setMvMapClickMarker(extData, { | ||
...config, | ||
zIndex, | ||
MARKER_SOURCE: 'Marker' | ||
}, markerIconConfig.iconActiveConfig) | ||
} | ||
this.setMvMapClickMarker(extData, { | ||
...config, | ||
zIndex, | ||
MARKER_SOURCE: 'Marker' | ||
}, markerIconConfig.iconActiveConfig) | ||
} | ||
callback && callback(e, item, config) | ||
@@ -725,3 +729,3 @@ }) | ||
/** | ||
* 打开实时路况 | ||
* 创建实时路况 | ||
* config:{ | ||
@@ -734,4 +738,4 @@ * zIndex 图层叠加的顺序值,0表示最底层,默认zIndex:4 | ||
*/ | ||
openMvMapTrafficLayer(config = {}) { | ||
let trafficLayer = new AMap.TileLayer.Traffic({ | ||
createMvMapTrafficLayer(config = {}) { | ||
let layer = new AMap.TileLayer.Traffic({ | ||
autoRefresh: true, | ||
@@ -741,4 +745,4 @@ interval: 180, | ||
}); | ||
trafficLayer.setMap(this.map); | ||
return trafficLayer; | ||
layer.setMap(this.map); | ||
return layer; | ||
} | ||
@@ -748,9 +752,44 @@ | ||
* 隐藏实时路况 | ||
* @param traffic 路况实例 | ||
* @param layer 图层 | ||
*/ | ||
hideMvMapTrafficLayer(traffic) { | ||
traffic.hide(); | ||
hideMvMapTrafficLayer(layer) { | ||
layer.hide(); | ||
} | ||
/** | ||
* 显示实时路况 | ||
* @param layer 图层 | ||
*/ | ||
showMvMapTrafficLayer(layer) { | ||
layer.show(); | ||
} | ||
/** | ||
* 创建卫星图层 | ||
* config:{ | ||
* zIndex 图层叠加的顺序值,0表示最底层,默认zIndex:4 | ||
* opacity 图层的透明度,取值范围[0,1] | ||
* zooms 支持的缩放级别范围,默认范围[3, 17],取值范围[3, 17] | ||
* } | ||
*/ | ||
createMvMapSatelliteLayer(config = {}) { | ||
let layer = new AMap.TileLayer.Satellite(config); | ||
layer.setMap(this.map); | ||
return layer; | ||
} | ||
/** | ||
* 隐藏卫星图层 | ||
* @param layer 图层 | ||
*/ | ||
hideMvMapSatelliteLayer(layer) { | ||
layer.hide(); | ||
} | ||
/** | ||
* 显示卫星图层 | ||
* @param layer 图层 | ||
*/ | ||
showMvMapSatelliteLayer(layer) { | ||
layer.show(); | ||
} | ||
/** | ||
@@ -757,0 +796,0 @@ * 行政边界区域 |
{ | ||
"name": "microvideo-map", | ||
"version": "0.1.7", | ||
"version": "0.2.0", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "scripts": { |
2433052
22863