Beispiel #1
0
        public override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            VisualGrid.StatusIndicator.Text = "Wire holding: " + started.ToString();
            if (tempLine != null)
            {
                VisualGrid.StatusIndicator.Text = String.Format("Thickness:{0}", tempLine.StrokeThickness);
            }

            if (started)
            {
                Line l = (Line)currentCanvas.Children[tempLineIndex];
                VisualGrid.StatusIndicator.Text += "\n" + posX.ToString() + ", " + posY.ToString();

                //we can add wire only horizontally or vertically.
                double difX = Mathf.Difference(l.X1, posX);
                double dify = Mathf.Difference(l.Y1, posY);

                if (difX > dify)
                {
                    l.X2 = posX;
                    l.Y2 = l.Y1;
                }
                else
                {
                    l.X2 = l.X1;
                    l.Y2 = posY;
                }

                lastKnownX = (int)l.X2;
                lastKnownY = (int)l.Y2;
            }
        }