|
@@ -143,7 +143,7 @@ export function useAMap(options) {
|
|
|
}
|
|
|
addMarker([item], true);
|
|
|
clickMarker = item;
|
|
|
- options.onMarkerClick(item);
|
|
|
+ options.onMarkerClick(item, true);
|
|
|
};
|
|
|
// 添加多个点
|
|
|
const addMarker = (points, notClean?: boolean) => {
|
|
@@ -324,7 +324,7 @@ export function useAMap(options) {
|
|
|
}
|
|
|
}
|
|
|
clickMarker = e.target;
|
|
|
- options.onMarkerClick(extData);
|
|
|
+ options.onMarkerClick(extData, true);
|
|
|
});
|
|
|
plotLayers['points2'].addOverlay(marker);
|
|
|
addPoints.push(data);
|
|
@@ -411,24 +411,28 @@ export function useAMap(options) {
|
|
|
infoWindow.on('mouseout', () => map.setStatus({ zoomEnable: true }));
|
|
|
};
|
|
|
|
|
|
- const hideInfo = (e?: any) => {
|
|
|
+ const hideInfo = (flag?: any) => {
|
|
|
map.setStatus({ zoomEnable: true });
|
|
|
if (!!infoWindow) {
|
|
|
infoWindow.close();
|
|
|
- if (!!clickMarker && e) {
|
|
|
- const extData = clickMarker.getExtData ? clickMarker.getExtData() : clickMarker;
|
|
|
- for (let i = 0; i < addPoints.length; i++) {
|
|
|
- if (addPoints[i].id === extData.id) {
|
|
|
- addPoints[i].icon = addPoints[i].image;
|
|
|
- clickMarker.setContent(getContent(addPoints[i].icon, addPoints[i].size));
|
|
|
- clickMarker = null;
|
|
|
- // addMarker(addPoints);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ if (flag) {
|
|
|
+ clearHoverMarker();
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+ const clearHoverMarker = () => {
|
|
|
+ if (!!clickMarker) {
|
|
|
+ const extData = clickMarker.getExtData ? clickMarker.getExtData() : clickMarker;
|
|
|
+ for (let i = 0; i < addPoints.length; i++) {
|
|
|
+ if (addPoints[i].id === extData.id) {
|
|
|
+ addPoints[i].icon = addPoints[i].image;
|
|
|
+ clickMarker.setContent(getContent(addPoints[i].icon, addPoints[i].size));
|
|
|
+ clickMarker = null;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
let maskPolygon;
|
|
|
const creatMask = (options, name = '茂名市') => {
|
|
|
new AMap.DistrictSearch({
|
|
@@ -805,6 +809,7 @@ export function useAMap(options) {
|
|
|
getScale,
|
|
|
showInfo,
|
|
|
hideInfo,
|
|
|
+ clearHoverMarker,
|
|
|
creatMask,
|
|
|
removeMask,
|
|
|
creatMask2,
|