private void MapControlMouseWheel(object sender, MouseWheelEventArgs e) { if (!_viewportInitialized) { return; } if (ZoomLocked) { return; } _currentMousePosition = e.GetPosition(this); //Needed for both MouseMove and MouseWheel event for mousewheel event if (double.IsNaN(_toResolution)) { _toResolution = Map.Viewport.Resolution; } if (e.Delta > 0) { _toResolution = ZoomHelper.ZoomIn(_map.Resolutions, _toResolution); } else if (e.Delta < 0) { _toResolution = ZoomHelper.ZoomOut(_map.Resolutions, _toResolution); } e.Handled = true; //so that the scroll event is not sent to the html page. // Some cheating for personal gain. This workaround could be ommitted if the zoom animations was on CenterX, CenterY and Resolution, not Resolution alone. Map.Viewport.Center.X += 0.000000001; Map.Viewport.Center.Y += 0.000000001; StartZoomAnimation(Map.Viewport.Resolution, _toResolution); }
public void ZoomOut() { if (double.IsNaN(_toResolution)) { _toResolution = Map.Viewport.Resolution; } _toResolution = ZoomHelper.ZoomOut(_map.Resolutions, _toResolution); ZoomMiddle(); }
private double DetermineNewResolution(int mouseWheelDelta, double currentResolution) { if (mouseWheelDelta > 0) { return(ZoomHelper.ZoomIn(_map.Resolutions, currentResolution)); } if (mouseWheelDelta < 0) { return(ZoomHelper.ZoomOut(_map.Resolutions, currentResolution)); } return(currentResolution); }
public void ZoomOut() { if (ZoomLocked) { return; } if (!_viewportInitialized) { return; } Map.Viewport.Resolution = ZoomHelper.ZoomOut(_map.Resolutions, Map.Viewport.Resolution); OnViewChanged(); }