How to catch mouse over a Feature #206
Unanswered
NARTech001
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I want to capture the mouse movements over my Features...but it does not work with the following code (which seems to be correct for me!). Have I missed something ?
map.on("pointermove", evt-> {
Pixel pixel = map.getEventPixel(evt.getCurrentTarget());
map.forEachFeatureAtPixel(pixel, new ol.FeatureAtPixelFunction() {
@OverRide
public boolean call(Feature feature, ol.layer.Layer layer) {
// Found a feature under the pointer
Window.alert("Hovered over feature: " + feature.getId());
return false;
}
});
});
Beta Was this translation helpful? Give feedback.
All reactions