コード例 #1
0
        public GridCanvas(ZoomBorder parent)
        {
            Canvas = new Canvas
            {
                Background = Brushes.White,
                Width      = MainWindow.GridSize,
                Height     = MainWindow.GridSize
            };
            Canvas.PointerMoved   += MouseMoveHandler;
            Canvas.PointerPressed += ClickHandler;
            parent.Child           = Canvas;

            DrawGrid();

            Dispatcher.UIThread.InvokeAsync
            (
                () =>
            {
                parent.StartPan(0, 0);
                parent.PanTo(-(MainWindow.GridSize - App.MainWindow.Width) / 2,
                             -(MainWindow.GridSize - App.MainWindow.Height) / 2);
            },
                DispatcherPriority.Render
            );

            Components            = new List <Component>();
            Connections           = new List <Connection>();
            _previewComponentData = new string[2];
            Canvas.Children.Add(_previewComponent = new Rectangle
            {
                Width           = 2 * MainWindow.GridCellSize,
                Height          = 2 * MainWindow.GridCellSize,
                Stroke          = Brushes.Black,
                IsVisible       = false,
                StrokeThickness = 1
            });
        }
コード例 #2
0
ファイル: Zoomer.cs プロジェクト: sandboxa13/lacmus-app
 public static void MoveTo(double x, double y)
 {
     /* Thanks to @wieslawsoltes https://github.com/wieslawsoltes/PanAndZoom/issues/27 */
     _zoomBorder?.StartPan(0, 0);
     _zoomBorder?.PanTo(x, y);
 }
コード例 #3
0
 public static void MoveTo(double x, double y)
 {
     _zoomBorder?.PanTo(0.1, 0);
 }