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

            if (c != null)
            {
                c.SelectedPoint = c.SelectedCurve.CurvePoints.FirstOrDefault();
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 4
0
 public BezierSegment(CurveGraph g)
 {
     graph = g;
 }
Exemplo n.º 5
0
 public BezierSegment(CurveGraph g)
 {
     graph = g;
 }
Exemplo n.º 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;
        }