
If you are not using jQuery's normalized events but still have access to the jQuery, you can use to normalize the event object. If you are doing event handling with jQuery, it will automatically normalize pageX and pageY for you. The only major browser that does not support these properties is IE8. Know that only clientX, clientY, screenX, and screenY are part of the W3C Spec. QuirksMode has a great compatibility table that details inconsistencies in the non-standard properties. If none of the ancestor elements have positioning, the mouse position is relative to the document (like pageX, pageY). Mouse position relative to the closest positioned ancestor element. x, yĮquivalent to clientX, clientY, but is unsupported by some browsers. Mouse position relative to the html document (i.e.

This is implemented very inconsistently between browsers. Mouse position relative to the target element. Mouse position relative to the user's physical screen. You could probably hack something together like the below example that will basically change the anchors of the mouse area so that some of the time you use the mouse area to get screen coordinates, but other times you remove the mouse area and use the map signals.Ĭonsole.log("changed (from mouse area)") Ĭonsole.log("mouse position changed", mouse.Mouse position relative to the browser's visible viewport. If you need to have hovering built in, then the MouseArea limitation is a known limit at this time. It should pan and display screen coordinates.Ĭonsole.log("changed (from map signal)", mouse.x, mouse.y) Tip: To get the vertical coordinate (according to the client area) of the mouse pointer, use the clientY property. Take the following example and touch the screen and move around the map. The clientX property returns the horizontal coordinate (according to the client area) of the mouse pointer when a mouse event was triggered. If detecting mouse position without hovering, then you should be fine to just use mousePositionChanged. Release notes for ArcGIS Runtime SDK 10.2.6 for Qt-ArcGIS Runtime SDK for Qt | ArcGIS for Developers

Putting a mouse area over the map stops all mouse events from propagating to the map. On a touch screen, there isn't really a concept of hovering, so this isn't an issue here.Īs far as using the MouseArea over top of a Map, this is currently a known issue. The only caveat is that if you are using a desktop that has a mouse (as opposed to a touch mobile device), you need to actually press and hold the mouse to get the coordinates.

We also have a mousePositionChanged signal that will let you know the screen coordinates of the mouse. Thanks!Ĭonsole.log("mouse position changed", mouse.x)Ĭan you provide a few more details? Are you making an app that will run on desktops, mobile devices, or both? Also, are you looking to display the screen coordinates of the mouse with just hovering and not clicking? We have several MouseEvent signals on the map that will let you know when the mouse is clicked, released, etc ArcGIS Runtime SDK for Qt QML API: Map Class Reference . If this works for you, please mark this as the correct answer as it is more straight forward than the previous suggestion. It's a few lines of code, but if you actually just create signal handlers for each mouse signal on the MouseArea, then don't accept the mouse, it looks like it will actually get sent down to the map. What happens right now is the mouse area intercepts all of the mouse signals, and accepts them, which results in them not going through to the map. Basically place the mouse area over top of the map, but don't accept any of the mouse events so that they actually get propagated to the map.
