예제 #1
0
        private static void Pan(object sender, ICommand command, double x, double y)
        {
            if (!IsKeyboardCommand((RoutedCommand)command)) // Move a whole square instead of a pixel if it wasn't the keyboard who sent it
            {
                x *= TileGenerator.TileSize;
                y *= TileGenerator.TileSize;
            }
            MapCanvas instance = (MapCanvas)sender;

            instance._offsetX.AnimateTranslate(x);
            instance._offsetY.AnimateTranslate(y);
            instance.Focus();
        }
예제 #2
0
        private static void OnLatitudeLongitudePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // Search for a MapControl parent
            MapCanvas        canvas = null;
            FrameworkElement child  = d as FrameworkElement;

            while (child != null)
            {
                canvas = child as MapCanvas;
                if (canvas != null)
                {
                    break;
                }
                child = child.Parent as FrameworkElement;
            }
            if (canvas != null)
            {
                canvas.RepositionChildren();
            }
        }