Example #1
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 > 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);
        }
Example #2
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);
 }
Example #3
0
        public void ZoomIn()
        {
            if (ZoomLocked)
            {
                return;
            }
            if (!_viewportInitialized)
            {
                return;
            }

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

            OnViewChanged();
        }
Example #4
0
        public void ZoomIn()
        {
            if (ZoomLocked)
            {
                return;
            }

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

            _toResolution = ZoomHelper.ZoomIn(_map.Resolutions, _toResolution);
            ZoomMiddle();
        }