/// <summary> /// Keep the scroll positon event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void KeepScrollPosistion(object sender, EventArgs e) { double graphScrollXRatio = GraphScroller.ScrollX / GraphScroller.Width; double graphScrollYRatio = GraphScroller.ScrollY / GraphScroller.Height; Point graphScrollRatio = new Point(graphScrollXRatio, graphScrollYRatio); GraphScroller.ScrollToAsync(GraphScroller.Width * graphScrollRatio.X, GraphScroller.Height * graphScrollRatio.Y, false); }
public void MouseUp() { if (currentPath == null) { return; } if (pathSegmentCollection.Count > 2) { var col = new System.Windows.Media.Color(); col.A = 100; col.G = 255; currentPath.Stroke = new SolidColorBrush(col); currentPath.ContextMenu = new ContextMenu(); var path = currentPath; currentPath.ContextMenu.Items.Add(GraphScroller.CreateMenuItem("Remove polyline", () => RemovePath(path))); PathToShape(currentPath); } currentPath = null; }
public PolygonManager(GraphScroller scroller) { this.scroller = scroller; diagram = scroller.Diagram; }
void DockPanelInitialized(object sender, EventArgs e) { #if DEBUGGLEE Microsoft.Msagl.Layout.Show = new Microsoft.Msagl.Show(Microsoft.Msagl.CommonTest.DisplayGeometryGraph.ShowCurves); #endif zoomSlider.Value = zoomSlider.Minimum; zoomSlider.LostMouseCapture += new MouseEventHandler(zoomSlider_LostMouseCapture); graphScroller = new GraphScroller(); graphScroller.ViewingSettingsChangedEvent += new EventHandler(graphScroller_ViewingSettingsChangedEvent); diagram = this.graphScroller.Diagram; diagram.Background = Brushes.AliceBlue; diagram.LayoutComplete += DiagramLayoutComplete; this.holder.Children.Add(graphScroller); this.holder.ClipToBounds = true; this.zoomSlider.ValueChanged += new RoutedPropertyChangedEventHandler <double>(zoomSlider_ValueChanged); this.zoomSlider.Minimum = 0; this.zoomSlider.Maximum = 100; this.zoomSlider.Value = zoomSlider.Minimum; this.brandesThresholdSlider.Minimum = 0; this.brandesThresholdSlider.Maximum = 5000; // this.brandesThresholdSlider.Value = Layout.BrandesThreshold; this.brandesThresholdSlider.ValueChanged += new RoutedPropertyChangedEventHandler <double>(brandesThresholdSlider_ValueChanged); this.aspectRatioSlider.Minimum = 0; this.aspectRatioSlider.Maximum = 10; this.aspectRatioSlider.Value = 0; this.aspectRatioSlider.ValueChanged += new RoutedPropertyChangedEventHandler <double>(aspectRatioSlider_ValueChanged); this.backwardButton.IsEnabled = false; this.forwardButton.IsEnabled = false; graphScroller.BackwardEnabledChanged += new NavigationChangeDelegate(graphScroller_BackwardEnabledChanged); graphScroller.ForwardEnabledChanged += new NavigationChangeDelegate(graphScroller_ForwardEnabledChanged); this.forwardButton.Click += new RoutedEventHandler(forwardButton_Click); this.backwardButton.Click += new RoutedEventHandler(backwardButton_Click); this.windowZoomButton.IsChecked = true; this.graphScroller.MouseDraggingMode = MouseDraggingMode.LayoutEditing; // this.windowZoomButton.Click += new RoutedEventHandler(windowZoomButton_Click); this.panButton.Click += new RoutedEventHandler(panButton_Click); windowZoomButton.ToolTip = "Set window zoom mode"; panButton.ToolTip = "Set pan mode"; //this.diagram.SelectionChanged += new SelectionChangedEventHandler( // delegate // { // NodeShape ns = diagram.SelectedObject as NodeShape; // if (ns != null) // { // NodeInfo ni = (NodeInfo)ns.Node.UserData; // SubGraph bucket = ni.Contents as SubGraph; // if (bucket != null) // { // if (details == null) // { // details = new Details(); // } // details.Title = "Details for " + ni.Name; // details.aspectRatioSlider.Value = this.aspectRatioSlider.Value; // details.Show(); // details.TakeGraph(bucket.SubBuilder.MakeGraph(MpdGraphType.Class)); // } // } // } // ); //this.diagram.EdgeSelectionChanged += new SelectionChangedEventHandler( // delegate // { // EdgeShape es = diagram.SelectedEdge as EdgeShape; // if (es != null) // { // EdgeInfo edgeInfo = es.Edge.UserData as EdgeInfo; // if (edgeInfo != null) // { // if (edgeDetails == null) // { // edgeDetails = new EdgeDetails(); // } // edgeDetails.Title = "Details for Edge from " + es.Edge.Source + " to " + es.Edge.Target; // edgeDetails.TakeEdge(es.Edge); // edgeDetails.Show(); // } // } // } // ); }
public Animator(GraphScroller viewer) { _viewer = viewer; _nodes = _viewer.Entities.Where(e => e is IViewerNode).ToArray(); }
void DockPanelInitialized(object sender, EventArgs e) { #if DEBUGGLEE Microsoft.Msagl.Layout.Show = new Microsoft.Msagl.Show(Microsoft.Msagl.CommonTest.DisplayGeometryGraph.ShowCurves); #endif zoomSlider.Value = zoomSlider.Minimum; zoomSlider.LostMouseCapture += new MouseEventHandler(zoomSlider_LostMouseCapture); graphScroller = new GraphScroller(); graphScroller.ViewingSettingsChangedEvent += new EventHandler(graphScroller_ViewingSettingsChangedEvent); diagram = this.graphScroller.Diagram; diagram.Background = Brushes.AliceBlue; diagram.LayoutComplete += DiagramLayoutComplete; this.holder.Children.Add(graphScroller); this.holder.ClipToBounds = true; this.zoomSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(zoomSlider_ValueChanged); this.zoomSlider.Minimum = 0; this.zoomSlider.Maximum = 100; this.zoomSlider.Value = zoomSlider.Minimum; this.brandesThresholdSlider.Minimum = 0; this.brandesThresholdSlider.Maximum = 5000; // this.brandesThresholdSlider.Value = Layout.BrandesThreshold; this.brandesThresholdSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(brandesThresholdSlider_ValueChanged); this.aspectRatioSlider.Minimum = 0; this.aspectRatioSlider.Maximum = 10; this.aspectRatioSlider.Value = 0; this.aspectRatioSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(aspectRatioSlider_ValueChanged); this.backwardButton.IsEnabled = false; this.forwardButton.IsEnabled = false; graphScroller.BackwardEnabledChanged += new NavigationChangeDelegate(graphScroller_BackwardEnabledChanged); graphScroller.ForwardEnabledChanged += new NavigationChangeDelegate(graphScroller_ForwardEnabledChanged); this.forwardButton.Click += new RoutedEventHandler(forwardButton_Click); this.backwardButton.Click += new RoutedEventHandler(backwardButton_Click); this.windowZoomButton.IsChecked = true; this.graphScroller.MouseDraggingMode = MouseDraggingMode.LayoutEditing; // this.windowZoomButton.Click += new RoutedEventHandler(windowZoomButton_Click); this.panButton.Click += new RoutedEventHandler(panButton_Click); windowZoomButton.ToolTip = "Set window zoom mode"; panButton.ToolTip = "Set pan mode"; //this.diagram.SelectionChanged += new SelectionChangedEventHandler( // delegate // { // NodeShape ns = diagram.SelectedObject as NodeShape; // if (ns != null) // { // NodeInfo ni = (NodeInfo)ns.Node.UserData; // SubGraph bucket = ni.Contents as SubGraph; // if (bucket != null) // { // if (details == null) // { // details = new Details(); // } // details.Title = "Details for " + ni.Name; // details.aspectRatioSlider.Value = this.aspectRatioSlider.Value; // details.Show(); // details.TakeGraph(bucket.SubBuilder.MakeGraph(MpdGraphType.Class)); // } // } // } // ); //this.diagram.EdgeSelectionChanged += new SelectionChangedEventHandler( // delegate // { // EdgeShape es = diagram.SelectedEdge as EdgeShape; // if (es != null) // { // EdgeInfo edgeInfo = es.Edge.UserData as EdgeInfo; // if (edgeInfo != null) // { // if (edgeDetails == null) // { // edgeDetails = new EdgeDetails(); // } // edgeDetails.Title = "Details for Edge from " + es.Edge.Source + " to " + es.Edge.Target; // edgeDetails.TakeEdge(es.Edge); // edgeDetails.Show(); // } // } // } // ); }