Hi,
I’m having an issue with MouseWheel zoom. I’m using MapSuiteCore version 7.0.0.0 / WPF Desktop. When zooming in with the mouse wheel, my map always stops at zoom level scale 125. See zoom level scales I have set below. My RestrictExtent is null and MinimumScale and MaximumScale are not too restrictive. To try and overcome this limit, I implemented the following override for OnMouseWheel() which seems to work great, except for one behavior. I can now zoom to zoom level scales 60, 30, 15, etc and no longer have the zoom scale 125 limit. However, the map now zooms in and centers at the center of the map extents instead of the point under cursor remaining constant as was the default behavior. How to I get the map position to stay “attached” or constant at the cursor location, ie zoom in at the mouse cursor, and not use the center of extents as the zoom center? For example, previously I could point to a building corner at the very edge of my map and zoom in using mouse wheel, and the building corner would remain at the mouse location as I zoomed in (even though the mouse location was not the center of the map). With this override, the building corner at mouse cursor no longer displays when I zoom in because the zoom center is the center of the map extents. Also, I want the building corner to remain visible and at the mouse cursor location (ie I don’t want the building corner to move to the center of the map). How would I implement that behavior in this override (which matches the default mouse wheel zoom behavior)?
Thank you,
Rod
protected override void OnMouseWheel(MouseWheelEventArgs e)
{
var wheelChange = e.Delta;
if (wheelChange < 0)
{
ZoomOut();
}
else
{
ZoomIn();
}
base.OnMouseWheel(e);
}
SetZoomLevelScales()
{
map.MinimumScale = 0.5;
map.MaximumScale = 2000000;
var levels = map.ZoomLevelSet.GetZoomLevels().ToArray();
levels[0].Scale = 1000000;
levels[1].Scale = 500000;
levels[2].Scale = 250000;
levels[3].Scale = 120000;
levels[4].Scale = 60000;
levels[5].Scale = 30000;
levels[6].Scale = 15000;
levels[7].Scale = 8000;
levels[8].Scale = 4000;
levels[9].Scale = 2000;
levels[10].Scale = 1000;
levels[11].Scale = 500;
levels[12].Scale = 250;
levels[13].Scale = 125;
levels[14].Scale = 60;
levels[15].Scale = 30;
levels[16].Scale = 15;
levels[17].Scale = 6;
levels[18].Scale = 3;
levels[19].Scale = 1.5;
}