Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        public void ZoomOut()
        {
            if (ZoomLocked)
            {
                return;
            }
            if (!_viewportInitialized)
            {
                return;
            }

            Map.Viewport.Resolution = ZoomHelper.ZoomOut(_map.Resolutions, Map.Viewport.Resolution);

            OnViewChanged();
        }
Exemplo n.º 3
0
        public void ZoomIn()
        {
            if (ZoomLocked)
            {
                return;
            }

            if (double.IsNaN(_toResolution))
            {
                _toResolution = Map.Viewport.Resolution;
            }

            _toResolution = ZoomHelper.ZoomIn(_map.Resolutions, _toResolution);
            ZoomMiddle();
        }
Exemplo n.º 4
0
        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 > Constants.Epsilon)
            {
                _toResolution = ZoomHelper.ZoomIn(_map.Resolutions, _toResolution);
            }
            else if (e.Delta < Constants.Epsilon)
            {
                _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);
        }