Select to view content in your preferred language

zoom not zooming to mouse location

2028
7
Jump to solution
06-20-2014 12:30 PM
jaykapalczynski
Honored Contributor
I have this app...when I scroll zoom it does not zoom to where my mouse pointer is...its not bad in this jsfiddle but in my app its far worse...check the website below...and scroll / zoom in watch how it pushes to the right

Any thoughts?

Click the MAP button to bring up map

http://jsfiddle.net/Q6ss8/6/

https://fwisweb1.dgif.virginia.gov/dgifmapping/2PopupMapInputTextboxCoordinatesy.html


2 other questions:
1. Can I convert the XY to Lat Long after I click the map to populate the text boxes with XY?
2. Is there a better way to do this than using identifyParams?
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor
Adding these lines seems to fix the Fiddle

    function DragDrop() {         //alert("IN DragDrop");         domUtils.toggle(dom.byId("divSplashScreenContainer"));         app.map.resize();         app.map.reposition();     } 


These should be called after the map DIV has been repositioned and resized.

View solution in original post

0 Kudos
7 Replies
jaykapalczynski
Honored Contributor
Map is still zooming to the right ????  Dont know why

Think I got my XY Coordinate corrected with this
var normalizedVal = webMercatorUtils.xyToLngLat(XCoord, YCoord);
alert(normalizedVal);

Although the translated Coordinates put me in the Atlantic Ocean
JS App is returning -8036423.598 4246950.54
Translated with webMercatorUtils i get -72.192421 and 35.6089

Should be around -77 and 37


Dont know if there is a better way to capture XY coordinates and populate input boxes
0 Kudos
KenBuja
MVP Esteemed Contributor
Adding these lines seems to fix the Fiddle

    function DragDrop() {         //alert("IN DragDrop");         domUtils.toggle(dom.byId("divSplashScreenContainer"));         app.map.resize();         app.map.reposition();     } 


These should be called after the map DIV has been repositioned and resized.
0 Kudos
KenBuja
MVP Esteemed Contributor
As for your other question, you can use getLatitude and getLongitude methods on a Point. See this thread
0 Kudos
jaykapalczynski
Honored Contributor
Awesome....thank you all very much.....very very appreciated.
0 Kudos
jaykapalczynski
Honored Contributor
Ken Buja

Is that getting the center of the map?  I am trying to get the XY of a map click
0 Kudos
KenBuja
MVP Esteemed Contributor
It's just an example of different ways to get the latitude and longitude from a point. That thread used the example of the map's center, but a point is a point.
0 Kudos
KenBuja
MVP Esteemed Contributor
If your question was answered, don't forget to click the check mark on the appropriate post. This helps others when searching for solutions to this question.
0 Kudos