public void DeployGraph() { WaitingResult = WaitingDialogResult.Flawless; ZoomAndPanCanvasModel.Clear(); ((Action)DoDeployGraph).BeginInvoke(OnDeployedGraph, null); Program.GetInstance().ShowWaitingDialog(); }
void SetModel(ZoomAndPanCanvasModel model) { Model = model; Model.TransformMatrixChanged += TransformMatrixChanged; Model.ContentUpdated += UpdateContent; Model.ContentCleared += CleareContent; CanvasTransform = new MatrixTransform(Model.TransformMatrix); Model.Released += () => View.ReleaseMouseCapture(); Model.Captured += () => Mouse.Capture(View, CaptureMode.SubTree); }
void UpdateGraph(IAsyncResult ar) { if (WaitingResult == WaitingDialogResult.Flawless) { Point p = GraphViewCenter(); ZoomAndPanCanvasModel.Update(new Size(p.X * 2, p.Y * 2)); } else { Program.GetInstance().CloseCurrentRepository(); } Program.GetInstance().EndWaitingDialog(WaitingResult); }
public void Scale(int wheelDelta, Point mouse) { Point p = GraphViewCenter(); double desiredZoom = Zoom * (wheelDelta > 0 ? 1.25 : 0.8); double boundedZoom = Math.Max(0.5, Math.Min(3, desiredZoom)); double boundedScale = boundedZoom / Zoom; Zoom = boundedZoom; AppSettings set = ((App)Application.Current).Settings; Point origin = set.UseMouseAsZoomOrigin ? mouse : Center; ZoomAndPanCanvasModel.Rescale(boundedScale, origin); ZoomAndPanCanvasModel.Move(new Vector(0, 0), new Size(p.X * 2, p.Y * 2)); }
void DoDeployGraph() { WaitingResult = WaitingDialogResult.Flawless; try { DeployCommitNodes(); DeployBranchNodes(); UpdateCheckouted(); ZoomAndPanCanvasModel.CreateEdgePairs(); } catch (OutOfMemoryException e) { WaitingResult = WaitingDialogResult.OutOfMemory; } catch (TooMuchCommitsException e) { WaitingResult = WaitingDialogResult.TooMuchCommits; } }
public ZoomAndPanCanvasViewModel(ZoomAndPanCanvasModel model, ZoomAndPanCanvasView view) { SetModel(model); View = view; View.DataContext = this; }
public void ResetTranslate() { ZoomAndPanCanvasModel.Rescale(1 / Zoom, new Point(0, 0)); Zoom = 1; Move(new Vector(double.MaxValue, double.MaxValue)); }
Vector AggresiveMove(Vector move) { Point p = GraphViewCenter(); return(ZoomAndPanCanvasModel.AggresiveMove(move, new Size(p.X * 2, p.Y * 2))); }
public void ReleaseMouseCapture() { ZoomAndPanCanvasModel.ReleaseMouseCapture(); }
public void CaptureMaouse() { ZoomAndPanCanvasModel.CaptureMouse(); }