|
@ -456,9 +456,11 @@ export default { |
|
|
target: "map", |
|
|
target: "map", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
myMap.on("singleclick", function (e) { |
|
|
myMap.on("singleclick", (event) => { |
|
|
// console.log(e.coordinate) |
|
|
myMap.forEachFeatureAtPixel(event.pixel, function (feature) { |
|
|
// console.log(transform(e.coordinate, 'EPSG:3857', 'EPSG:4326')); |
|
|
// 为移动到的 feature 发送自定义的 mousemove 消息 |
|
|
|
|
|
feature.dispatchEvent({ type: "click", event }); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
await nextTick(); |
|
|
await nextTick(); |
|
@ -535,6 +537,21 @@ export default { |
|
|
}), |
|
|
}), |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
item.on("click", function (event) { |
|
|
|
|
|
console.log("我被点击拉", item, event); |
|
|
|
|
|
// 修改feature的样式为半径100像素的园,用蓝色填充 |
|
|
|
|
|
this.setStyle( |
|
|
|
|
|
new ol.style.Style({ |
|
|
|
|
|
image: new ol.style.Circle({ |
|
|
|
|
|
radius: 100, |
|
|
|
|
|
fill: new ol.style.Fill({ |
|
|
|
|
|
color: "blue", |
|
|
|
|
|
}), |
|
|
|
|
|
}), |
|
|
|
|
|
}) |
|
|
|
|
|
); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
setInterval(() => { |
|
|
setInterval(() => { |
|
|
let currStyle = item.getStyle(); |
|
|
let currStyle = item.getStyle(); |
|
|
if (!Array.isArray(currStyle)) { |
|
|
if (!Array.isArray(currStyle)) { |
|
|