我試圖激活一個交互時,鼠標懸停在某些功能。Openlayers 3 - Interaction和pointermove
它正在如此工作......問題在於,如果您慢慢移動鼠標,交互會保持活動狀態。
這是OL3上的錯誤,還是我應該以不同的方式做?
代碼:http://jsfiddle.net/gmaq54dm/3/
olMap.on("pointermove", function (e) {
if (e.dragging) {
return;
}
var map = e.map;
console.log(e.pixel);
var feature = map.forEachFeatureAtPixel(e.pixel, function(feature, layer) {
return feature;
});
var hit = (feature) ? true : false;
console.log(hit);
olDraw.setActive(hit);
});
感謝
它看起來像一個錯誤。你可以向核心開發者報告。 –
我會在'setTimeout'調用中包裝最後一行,以便在處理完pointent事件後調用:'window.setTimeout(function(){olDraw.setActive(hit);},0);' – ahocevar