2
지도에서 폴리곤을 그렸습니다. 폴리곤 경계를 클릭하면 정보가 팝업됩니다. 경계에서 선택을 강요하는 해결책이 있습니까? 내가 지금 무슨 짓을openlayers 3 - 폴리곤 경계를 클릭하십시오.
var featureContext = new ol.Feature({
geometry: new ol.geom.Polygon([polyCoords])
})
featureContext.setStyle(
new ol.style.Style({
stroke: new ol.style.Stroke({
color: context[cc].displayColor,
width: 3
})
})
);
var layerContext = new ol.layer.Vector({
source: new ol.source.Vector({
features: [featureContext]
})
});
map.addLayer(layerContext);
:
map.on('singleclick', function(evt) {
if (evt.dragging) {
return;
}
var feature = map.forEachFeatureAtPixel(map.getEventPixel(evt.originalEvent), function(feature) {
return feature;
});
if (feature) {
popUp(feature);
}
});
하지만이 다각형 다각형 (면적 등), 팝업 정보의 모든 내용을 선택합니다.
도움 주셔서 감사합니다.