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

View File

@ -983,32 +983,7 @@ namespace EduNetworkBuilder
TimeSpan duration; TimeSpan duration;
duration = DateTime.Now - LastClick; duration = DateTime.Now - LastClick;
if(e.Button == System.Windows.Forms.MouseButtons.Right) //Track size of area for the click/drag
{
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();
int sx; int sx;
int sy; int sy;
int swidth; int swidth;
@ -1033,6 +1008,34 @@ namespace EduNetworkBuilder
sy = ClickedImageLocation.Y; sy = ClickedImageLocation.Y;
sheight = e.Location.Y - sy; 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 //Now we have a rectangle, but need to exchange numbers for numbers on the image
Point topCorner = myNetwork.clickedPos(new Point(sx, sy)); Point topCorner = myNetwork.clickedPos(new Point(sx, sy));
Point botCorner = myNetwork.clickedPos(new Point(sx + swidth, sy + sheight)); Point botCorner = myNetwork.clickedPos(new Point(sx + swidth, sy + sheight));