// selfMap.OlMap===map
/* 监听地图的单击事件,如果点击的是矢量元素则进行相关操作 */
selfMap.OlMap.on('click', (evt) => {
/* 检测视口中的特征 */
const featureInfo = selfMap.OlMap.forEachFeatureAtPixel(evt.pixel, (feature, layerVetor) => feature);
if (featureInfo) {
// console.log(featureInfo.get('point'));
console.log(featureInfo);
}
});
网友评论