I would like to know where the map center will be located at the end of a mouse wheel-initiated zoom. As I understand, the map center will be changed according to where the mouse is positioned when the user zooms using the mouse wheel. Can this location
be calculated beforehand? Thanks in advance.
Oct 29, 2014 at 8:45 AM
Edited Oct 29, 2014 at 8:45 AM
You could reproduce the calculation that happens in the private
var viewportOrigin = e.GetPosition(map);
var mapOrigin = map.ViewportTransform.Inverse.Transform(viewportOrigin);
var targetScale = Math.Pow(2d, map.TargetZoomLevel) * TileSource.TileSize / 360d;
var viewportTransform = new Matrix();
var viewportCenter = new Point(map.ActualWidth / 2d, map.ActualHeight / 2d);
var targetCenter = map.MapTransform.Transform(
is a MouseEventArgs and
an instance of the Map control.