예제 #1
0
 private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (mCurrentLine != null)
       {
     mCurrentLine.Erase();
     mLines.Remove(mCurrentLine);
     mCurrentLine = null;
     e.Handled = true;
       }
 }
예제 #2
0
        void obj_Link(object sender, LinkEventArgs e)
        {
            NoiseObject obj = sender as NoiseObject;

              // set line begin - line end is mouse
              if (mCurrentLine == null)
              {
            if (e.type != LinkType.Out && e.id.Connection != null) obj_Erase(sender, e);
            mCurrentLine = new LinkLine(xBoard, e.type, e.id);
              }
              // set line end
              else
              {
            if (mCurrentLine.Source != null && sender == mCurrentLine.Source) { mCurrentLine.Erase(); mCurrentLine = null; }
            else if (mCurrentLine.Target != null && sender == mCurrentLine.Target) { mCurrentLine.Erase(); mCurrentLine = null; }
            else if (mCurrentLine.TargetLink == null && e.type == LinkType.Out) { mCurrentLine.Erase(); mCurrentLine = null; }
            else if (mCurrentLine.SourceLink == null && e.type != LinkType.Out) { mCurrentLine.Erase(); mCurrentLine = null; }
            else if (obj.Module == null) { mCurrentLine.Erase(); mCurrentLine = null; }
            else
            {
              if (e.id.Connection != null) obj_Erase(sender, e);
              mCurrentLine.EndLink(e.type, e.id);
              mLines.Add(mCurrentLine);
              mCurrentLine = null;
            }
              }
        }