ThinkGeo.com    |     Documentation    |     Premium Support

MouseWheel Zoom In and Out

Hi Guys,


Would like to implement MouseWheel zooming where the Map zooms in and out relative to the mouse position.  I have seen the posts in the 2.0 forum which suggests using ZoomIntoCenter.  Tha'ts not what I'm after.


Imagine a map displaying New York harbour with the Statue of Liberty under the mouse somwehere towards the top left of the mapl NOT at the center. Using the MouseWheel the map should zoom in and out with the Statue of Liberty remaining under the mouse.


If you use ZoomIntoCenter(30, e.X,e.Y) the map centres at the position under the mouse and then zooms in/out leaving the Statue of Liberty at the centrre of the map but not under the position of the mouse.


Any thoughts?


John



John, 
  
   I think I understand where you are going with this.  We want to keep the position of the mouse in world and screen coordinates constant.  I could image it like this…  When the wheel clicks then we zoom  in as normals but then we would slide the extent so that the position of the mouse is still over the same world coordinates it was before.  What this would do is allow you to deep zoom into something that is not centered but not have to move your mouse after the first wheel click.  As in your example if the statue of liberty is in the upper right and you want to zoom into it quite a bit  now you either have to pan to make it the center then mouse wheel zoom or mouse wheel zoom and then pan the map to make it centered before zooming in more.  As if you just kept zooming the statue would eventually go off the screen.   
  
 Brilliant!  I really like this idea.  I will see what we can do to get this in.  I am anxious to see how this works in practice but I think the principle seems sound. 
  
 David

Hi David,


Spot on (excuse the pun)


John


 



John, 
  
 We are working on it and it will be available in the next release. Thanks for the insights! 
  
 Ben