ArcGISWindowsPhoneSDK.SwipeMap.Handle_MouseMove C# (CSharp) Метод

Handle_MouseMove() публичный Метод

public Handle_MouseMove ( object sender, System.Windows.Input.MouseEventArgs args ) : void
sender object
args System.Windows.Input.MouseEventArgs
Результат void
        public void Handle_MouseMove(object sender, MouseEventArgs args)
        {
            Rectangle item = sender as Rectangle;

            if (isMouseCaptured)
            {
                // Calculate the current position of the object.
                double deltaH = args.GetPosition(null).X - mouseHorizontalPosition;
                double newLeft = deltaH + (double)item.GetValue(Canvas.LeftProperty);

                //if slider is pulled beyond start of map, default it back to start.
                if (newLeft < 0.0)
                {
                    item.ReleaseMouseCapture();
                    newLeft = 0.0;
                    isMouseCaptured = false;
                }

                //if slider is pulled beyond screen, default it back to end.
                if (newLeft > rootCanvas.ActualWidth)
                {
                    item.ReleaseMouseCapture();
                    newLeft = rootCanvas.ActualWidth - slider.ActualWidth;
                    isMouseCaptured = false;
                }

                item.SetValue(Canvas.LeftProperty, newLeft);

                // Update position global variables.
                mouseHorizontalPosition = args.GetPosition(null).X;

                Point mouse = args.GetPosition(this.AboveMap);
                // You can modify StartPoint and Endpoint to change the slope of the swipe
                // as well as where it starts and ends. Using a range from 0 to 1 allows
                // the mouse position (X,Y) to be used relative to the grid's ActualWidth or
                // ActualHeight to keep the cursor synchronized with the edge of the mask.
                LinearGradientBrush mask = new LinearGradientBrush();
                mask.StartPoint = new Point(0, 1);
                mask.EndPoint = new Point(1, 1);

                GradientStop transparentStop = new GradientStop();
                transparentStop.Color = Colors.Black;
                transparentStop.Offset = (mouse.X / this.LayoutRoot.ActualWidth);
                mask.GradientStops.Add(transparentStop);

                // The color property must be set, but the OpacityMask ignores color details.
                GradientStop visibleStop = new GradientStop();
                visibleStop.Color = Colors.Transparent;
                visibleStop.Offset = (mouse.X / this.LayoutRoot.ActualWidth);
                mask.GradientStops.Add(visibleStop);

                // Apply the OpacityMask to the map.
                this.AboveMap.OpacityMask = mask;
            }
        }