question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Mouseover" event not detecting feature

See original GitHub issue

Hi,

I’m not sure if I’m doing this wrong, but it looks like the GetMapInfo() isn’t detecting features on the mouse-over callback. So as a test, using the WPF example, specifically the MapInfo sample. I modified the MouseMove method to this:

private void MapControlOnMouseMove(object sender, MouseEventArgs e)
{
    var screenPosition = e.GetPosition(MapControl);
    var worldPosition = MapControl.Viewport.ScreenToWorld(screenPosition.X, screenPosition.Y);
    var mapInfo = MapControl.GetMapInfo(worldPosition);
    var isFeature = mapInfo.Feature != null;
    MouseCoordinates.Text = $"{worldPosition.X:F0}, {worldPosition.Y:F0}, isFeature={isFeature}";
}

I’m trying to have it so if you mouse over a certain feature, it will add a feature to another layer showing a popup with some text. IsMapInfoLayer is set to true.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pauldendulkcommented, Aug 28, 2021

That is because the WPF Point needs to be converted to a Mapsui Point.

var mapInfo = this.MapControl.GetMapInfo(screenPosition.ToMapsui());

Be careful, this may impact performance.

0reactions
pauldendulkcommented, Jun 23, 2023

Summary:

  • There is no built in support for MouseOver.
  • You could implement is yourself by requesting the GetMapInfo on the MouseOver of the platform.
    • Don’t forget to set ILayer.IsMapInfoLayer = true;.
    • You need to realize this impacts performance.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Mouseover Event not working well with overlaid objects
I am trying to create mouseover tooltip effects on the graph created by d3. The circle is on top of the line. The...
Read more >
mouseover event is not firing on element on which written
1 Answer. I found the solution. I used mouseenter event instead of mouseover and it worked.
Read more >
Mouse-over events not working when window is in focus
The problem has been resolved. It turns out the Dijit Popup was interfering with mouseover event, but only when the window was focused...
Read more >
Element: mouseover event - Web APIs | MDN
The mouseover event is fired at an Element when a pointing device (such as a mouse or trackpad) is used to move the...
Read more >
mouseover event | jQuery API Documentation
A function to execute each time the event is triggered. This page describes the mouseover event. For the deprecated .mouseover() method, see .mouseover()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found