Interaction logic for CurveGraph.xaml
Inheritance: System.Windows.Controls.UserControl
Example #1
0
        private static void OnSelectedCurveChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CurveGraph c = sender as CurveGraph;

            if (c != null)
            {
                c.SelectedPoint = c.SelectedCurve.CurvePoints.FirstOrDefault();
            }
        }
Example #2
0
        public Anchor(CurveGraph g, LinkedListNode <CurvePoint> p)
        {
            graph             = g;
            point             = p;
            X                 = graph.localX(point.Value.InVal);
            Y                 = graph.localY(point.Value.OutVal);
            this.DragDelta   += OnDragDelta;
            this.DragStarted += OnDragStarted;
            this.MouseDown   += Anchor_MouseDown;

            leftHandle = new Handle(this, true);
            graph.graph.Children.Add(leftHandle);
            rightHandle = new Handle(this, false);
            graph.graph.Children.Add(rightHandle);

            leftBez  = null;
            rightBez = null;
        }
Example #3
0
        private static void OnSelectedPointChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CurveGraph c = sender as CurveGraph;

            if (c != null)
            {
                foreach (var o in c.graph.Children)
                {
                    Anchor a;
                    if (o is Anchor)
                    {
                        a = o as Anchor;
                        if (a.point.Value != e.NewValue as CurvePoint)
                        {
                            a.IsSelected = false;
                        }
                    }
                }
                c.SelectedPointChanged?.Invoke(c, new RoutedPropertyChangedEventArgs <CurvePoint>(e.OldValue as CurvePoint, e.NewValue as CurvePoint));
            }
        }
 public BezierSegment(CurveGraph g)
 {
     graph = g;
 }
Example #5
0
 public BezierSegment(CurveGraph g)
 {
     graph = g;
 }
Example #6
0
        public Anchor(CurveGraph g, LinkedListNode<CurvePoint> p)
        {
            graph = g;
            point = p;
            X = graph.localX(point.Value.InVal);
            Y = graph.localY(point.Value.OutVal);
            this.DragDelta += OnDragDelta;
            this.DragStarted += OnDragStarted;
            this.MouseDown += Anchor_MouseDown;

            leftHandle = new Handle(this, true);
            graph.graph.Children.Add(leftHandle);
            rightHandle = new Handle(this, false);
            graph.graph.Children.Add(rightHandle);

            leftBez = null;
            rightBez = null;
        }