Select to view content in your preferred language

Problem on using MouseMove to show Coordinate

5412
5
01-26-2015 10:24 AM
MayJeff
Deactivated User

I would like to has mouse move event to show coordinate and followed this thread for map click event:Javascript API map 3.7 has no coordinates when handling map click

For some reasons, onMouseMove is totally not working at all and map click is working fine using the thread mentioned above.  Here is my JSFiddler: Edit fiddle - JSFiddle

Is this another bug?

Thanks.

0 Kudos
5 Replies
TimWitt2
MVP Alum

Hey May,

what isn't working exactly? Looking at your fiddle when I move my mouse over the map the coordinates change.

Tim

0 Kudos
MayJeff
Deactivated User

If you are using browser like chrome, firefox, and etc then it works but if you test it on different devices like iPhone, Andriod then mouse-move didn't seem to work.

Looks at the code on JSFiddler-

If I comment out this line map.on("mouse-move", showCoordinates) and replace it with this dojo.connect(map, "onMouseOver", showCoordinates1); that is similar to this thread for map click -Javascript API map 3.7 has no coordinates when handling map click

Instead of using map click, I would like to use mouse-move event on my mobile app.

Thank you.

0 Kudos
JoshHevenor
Frequent Contributor

I would add dojo/touch and update your coordinates on touch.press. That covers mouse-down when a mouse is present and touchstart when a touchscreen is in use.

dojo/touch — The Dojo Toolkit - Reference Guide

SteveCole
Honored Contributor

There is a mouse-drag event. Maybe that's what needs to be set up if you determine that the visitor is using a smartphone?..

0 Kudos
MayJeff
Deactivated User

I try it still not working.  ESRI sample here: Create Map Display Mouse Coordinates  also not show on mobile devices.

Thanks.

0 Kudos