I have been alerted by a user that the zoom in and zoom out of the mouse wheel does not match up. I have found that this is the case when I use the ZoomIn/ZoomOut calls as well. In both cases it always zooms in a little farther then it zooms out so if you go back and forth between zooms it will eventually zoom you in all the way.
I have tested this in your Map Suites Explorer program and get the same results. Is there any way this can get fixed so if you zoom in and then back out it matches up for both the mouse wheel and ZoomIn/ZoomOut calls?
Thanks for your post, I could explain the reason of “use the ZoomIn/ZoomOut calls” with following explaination:
100.zoomin(50) =100*(1-50/100)=50;
20.zoomout(50)=20*(1+50/100)=75;
So if you zoom in 80% then zoom out 80% the final result will not be the original value 100, so you need to:
50.zoomout(200)=50*(1+200/100)=100.
But I can’t explain the reason of mouse wheel with the information in the post, would you please provide us a captured screen shot or some code to test or a highly appreciated “self-contained sample”?
I don't really follow your explanation. For my code I simply use mapLink.ZoomIn(15) and mapLink.ZoomOut(15). (mapLink being my WinformsMap control on the form) Are you saying the 15% value i pass in for the zoom out needs to be something other than 15% to match up with the 15% I pass in for the zoom in? I would think something like that would/should be handled within the control so if the user is passing in the same percentage for both they would get the same desired result.
For the mouse wheel i have no code. I simply move it forward once to zoom in and move it back once to zoom out. And find that it zooms in farther then it zooms out.
For a self-contained sample you should be able to use your Map Suites Explorer program you ship with the control because it does it in there for both examples.
One thing to note is I do have ZoomLevelSnapping set to None.
Given the original extent is (100,100,100,100) then we use zoomin 15 percent, then the new extent will be (100,100,100,100)*(1-0.15)=(85, 85, 85, 85).
Then we zoomout 15 percent, we will use (85, 85, 85, 85) *(1+0.15)=(97.75, 97.75, 97.75, 97.75)
As you can see the extent after zoomin and zoomout is (97.75, 97.75, 97.75, 97.75) which is smaller than the original extent(100,100,100,100). This is the reason why zoomin then zoom out the extent will be smaller
That makes sense as to why it does it. However, I still think the control should take that into account when zooming in and out. The mouse wheel zoom only has one percent setting so I cannot correct that one on my end and the ZoomIn/ZoomOut calls only take an integer so I can't correct those either... Do you have any solutions to my issue or do I just need to tell my users to deal with it?
It too does not end up at the same extent you start with if you zoom in and back out. I tried to implement your fix for this but don’t see any way to get the current scale from the MapPrinterLayer. Do you have any suggestions for this situation?
MapPrinterLayer is a special data so you cannot use scale for it.
1. The 10 in zoom is a percent, if current we zoom in 10% first then zoom out 10%, the extent won’t be the same, because the cardinal number for 10% have changed. 2. MapExtent is the extent for printed layer, when you zoom by mouse in MapPrinterLayer, it won’t change, it only can be changed by code.
So I think maybe you can have a value for record original extents.