private void MapControl_MouseWheel(object sender, MouseWheelEventArgs e) { this.currentMousePosition = e.GetPosition(this); //Needed for both MouseMove and MouseWheel event for mousewheel event if (this.toResolution == 0) { this.toResolution = this.transform.Resolution; } if (e.Delta > 0) { this.toResolution = ZoomHelper.ZoomIn(this.rootLayer.Schema.Resolutions, this.toResolution); } else if (e.Delta < 0) { this.toResolution = ZoomHelper.ZoomOut(this.rootLayer.Schema.Resolutions, this.toResolution); } e.Handled = true; //so that the scroll event is not sent to the html page. //this.transform.Resolution = toResolution; //this.Refresh(); this.StartZoomAnimation(this.transform.Resolution, this.toResolution); }
private void MapControl_MouseWheel(object sender, MouseWheelEventArgs e) { if (AllowMoveAndZoom) { currentMousePosition = e.GetPosition(this); //Needed for both MouseMove and MouseWheel event for mousewheel event if (toResolution == 0) { toResolution = viewport.Resolution; } if (e.Delta > 0) { toResolution = ZoomHelper.ZoomIn(map.Resolutions, toResolution); } else if (e.Delta < 0) { if (toResolution < 1200) //Stop zooming out at this resolution { 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 viewport.CenterX += 0.000000001; viewport.CenterY += 0.000000001; OnViewChanged(false, true); StartZoomAnimation(viewport.Resolution, toResolution); } }
private void MapControlMouseWheel(object sender, MouseWheelEventArgs e) { if (ZoomLocked) { return; } currentMousePosition = e.GetPosition(this); //Needed for both MouseMove and MouseWheel event for mousewheel event if (double.IsNaN(toResolution)) { toResolution = 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 viewport.CenterX += 0.000000001; viewport.CenterY += 0.000000001; map.ViewChanged(false, viewport.Extent, viewport.Resolution); OnViewChanged(false, true); StartZoomAnimation(viewport.Resolution, toResolution); }
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 ZoomIn() { var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution); _viewport.SetResolution(resolution); _map.RefreshData(_viewport.Extent, _viewport.Resolution, true); }
public void ZoomIn(Point centerOfZoom) { var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution); ZoomTo(resolution, centerOfZoom); Navigated?.Invoke(this, EventArgs.Empty); }
public void ZoomIn() { var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution); _viewport.SetResolution(resolution); Navigated?.Invoke(this, EventArgs.Empty); }
public void ZoomIn(Point centerOfZoom) { var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution); ZoomTo(resolution, centerOfZoom); _map.RefreshData(_viewport.Extent, _viewport.Resolution, true); }
public void ZoomIn() { if (this.toResolution == 0) { this.toResolution = this.transform.Resolution; } this.toResolution = ZoomHelper.ZoomIn(this.rootLayer.Schema.Resolutions, this.toResolution); ZoomMiddle(); }
public void ZoomIn() { if (toResolution == 0) { toResolution = viewport.Resolution; } toResolution = ZoomHelper.ZoomIn(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 ZoomIn() { if (ZoomLocked) { return; } if (!viewInitialized) { return; } viewport.Resolution = ZoomHelper.ZoomIn(map.Resolutions, viewport.Resolution); OnViewChanged(false); }
public void ZoomIn() { if (ZoomLocked) { return; } if (double.IsNaN(toResolution)) { toResolution = viewport.Resolution; } toResolution = ZoomHelper.ZoomIn(map.Resolutions, toResolution); ZoomMiddle(); }
void MapControlMouseWheel(object sender, MouseWheelEventArgs e) { if (e.Delta > 0) { _viewport.UnitsPerPixel = ZoomHelper.ZoomIn(_tileSource.Schema.Resolutions.Select(r => r.Value.UnitsPerPixel).ToList(), _viewport.UnitsPerPixel); } else if (e.Delta < 0) { _viewport.UnitsPerPixel = ZoomHelper.ZoomOut(_tileSource.Schema.Resolutions.Select(r => r.Value.UnitsPerPixel).ToList(), _viewport.UnitsPerPixel); } _fetcher.ViewChanged(_viewport.Extent, _viewport.UnitsPerPixel); e.Handled = true; //so that the scroll event is not sent to the html page. _invalid = true; }
public void ZoomIn() { if (ZoomLocked) { return; } if (double.IsNaN(_toResolution)) { _toResolution = Map.Viewport.Resolution; } _toResolution = ZoomHelper.ZoomIn(_map.Resolutions, _toResolution); ZoomMiddle(); }
public void ZoomIn(PointF mapPosition) { // When zooming in we want the mouse position to stay above the same world coordinate. // We do that in 3 steps. // 1) Temporarily center on where the mouse is Map.Viewport.Center = Map.Viewport.ScreenToWorld(mapPosition.X, mapPosition.Y); // 2) Then zoom Map.Viewport.Resolution = ZoomHelper.ZoomIn(_map.Resolutions, Map.Viewport.Resolution); // 3) Then move the temporary center back to the mouse position Map.Viewport.Center = Map.Viewport.ScreenToWorld( Map.Viewport.Width - mapPosition.X, Map.Viewport.Height - mapPosition.Y); ViewChanged(true); Invalidate(); }
public double GetResolution(int delta, IViewport viewport, IMap map) { // If the animation has ended then start from the current resolution. // The alternative is that use the previous resolution target and add an extra // level to that. if (!IsAnimating()) { _toResolution = viewport.Resolution; } if (delta > Constants.Epsilon) { _toResolution = ZoomHelper.ZoomIn(map.Resolutions, _toResolution); } else if (delta < Constants.Epsilon) { _toResolution = ZoomHelper.ZoomOut(map.Resolutions, _toResolution); } // TickCount is fast https://stackoverflow.com/a/4075602/85325 _tickCount = Environment.TickCount; return(_toResolution); }
/// <summary> /// Zoom in to a given point /// </summary> /// <param name="centerOfZoom">Center to use for zoom in</param> public void ZoomIn(Point centerOfZoom) { var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution); ZoomTo(resolution, centerOfZoom); }
/// <summary> /// Zoom in to the next resolution /// </summary> public void ZoomIn() { var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution); ZoomTo(resolution); }
public void ZoomIn() { viewport.Resolution = ZoomHelper.ZoomIn(map.Resolutions, viewport.Resolution); ViewChanged(true); InvalidateMap(true); }
/// <summary> /// Zoom in to a given point /// </summary> /// <param name="centerOfZoom">Center of zoom. This is the one point in the map that stays on the same location while zooming in. /// For instance, in mouse wheel zoom animation the position of the mouse pointer can be the center of zoom.</param> /// <param name="duration">Duration for animation in milliseconds.</param> /// <param name="easing">The type of easing function used to transform from begin tot end state</param> public void ZoomIn(MPoint centerOfZoom, long duration = -1, Easing?easing = default) { var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution); ZoomTo(resolution, centerOfZoom, duration, easing); }
public void ZoomIn() { Map.Viewport.Resolution = ZoomHelper.ZoomIn(_map.Resolutions, Map.Viewport.Resolution); ViewChanged(true); Invalidate(); }