Make it so we can add items. Had broken it when we made the ability to drag / select a big box of stuff.

This commit is contained in:
Tim Young 2017-06-14 14:15:58 -05:00
parent d129fdc1a4
commit 49be222b5d
1 changed files with 30 additions and 27 deletions

View File

@ -983,32 +983,7 @@ namespace EduNetworkBuilder
TimeSpan duration;
duration = DateTime.Now - LastClick;
if(e.Button == System.Windows.Forms.MouseButtons.Right)
{
pbNetworkView_RightMouseUp(ReleasedOn, e);
return;
}
if (duration.TotalMilliseconds < 250)
{
//This mouse-up is part of a double-click operation. Do an edit
pbNetworkView_Edit_Click(sender, e);
}
else
{
if (MouseIsDown && ItemsSelected.Count > 0)
{
//We were dragging stuff. All done now
MouseIsDown = false;
ItemsSelected.Clear(); //clear it so we stop moving these ones
UpdateLinks();
UpdateVisuals();
return;
}
if (MouseIsDown && ItemClickedOn == null)
{
//We just finished dragging a select box
//Put them all into the drag box.
ItemsSelected.Clear();
//Track size of area for the click/drag
int sx;
int sy;
int swidth;
@ -1033,6 +1008,34 @@ namespace EduNetworkBuilder
sy = ClickedImageLocation.Y;
sheight = e.Location.Y - sy;
}
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
pbNetworkView_RightMouseUp(ReleasedOn, e);
return;
}
if (duration.TotalMilliseconds < 250)
{
//This mouse-up is part of a double-click operation. Do an edit
pbNetworkView_Edit_Click(sender, e);
}
else
{
if (MouseIsDown && ItemsSelected.Count > 0)
{
//We were dragging stuff. All done now
MouseIsDown = false;
ItemsSelected.Clear(); //clear it so we stop moving these ones
UpdateLinks();
UpdateVisuals();
return;
}
if (MouseIsDown && ItemClickedOn == null && (swidth > 4 || sheight>4))
{
//We just finished dragging a select box
//Put them all into the drag box.
ItemsSelected.Clear();
//Now we have a rectangle, but need to exchange numbers for numbers on the image
Point topCorner = myNetwork.clickedPos(new Point(sx, sy));
Point botCorner = myNetwork.clickedPos(new Point(sx + swidth, sy + sheight));