鼠标光标会改变要素,即使它们被覆盖层隐藏了

Mouse cursor changes over features even if they are hidden by an overlay

我试图在使用 OpenLayers 3 将光标移到某个要素上时更改光标。我正在使用此代码:

map.addInteraction(new ol.interaction.Select({
  condition : function(event) {
    return ol.events.condition.pointerMove(event);
  }
}));

当功能被弹出窗口隐藏时(就像在 OL3 examples 中一样创建),我的问题就来了。当您将鼠标移动到功能所在的位置时,即使该功能被弹出窗口隐藏,它仍然会改变光标。

是否可以禁用不可见的功能选择?

看到 example

当鼠标悬停在弹出窗口上时,您需要停止向地图冒泡的 mousemove 事件

document.getElementById("popup").onmousemove = function(e) {
    e.stopPropagation();
};

edited fiddle