Impose a small delay in centering items. Makes it work smoother when simply right-clicking to do a menu or something.
This commit is contained in:
parent
4e9399f9b5
commit
d63452813a
@ -33,6 +33,7 @@ namespace EduNetworkBuilder
|
|||||||
private Point ClickedLocation;
|
private Point ClickedLocation;
|
||||||
private Point ClickedImageLocation;
|
private Point ClickedImageLocation;
|
||||||
DateTime LastClick = DateTime.Now;
|
DateTime LastClick = DateTime.Now;
|
||||||
|
DateTime LastMouseDown = DateTime.Now;
|
||||||
private string LastPath = "";
|
private string LastPath = "";
|
||||||
private bool processing = false;
|
private bool processing = false;
|
||||||
private List<PuzzleInfo> PuzzleList = new List<PuzzleInfo>();
|
private List<PuzzleInfo> PuzzleList = new List<PuzzleInfo>();
|
||||||
@ -1273,6 +1274,7 @@ namespace EduNetworkBuilder
|
|||||||
//See if we have clicked on something
|
//See if we have clicked on something
|
||||||
ItemClickedOn = myNetwork.ItemAtPosition(location);
|
ItemClickedOn = myNetwork.ItemAtPosition(location);
|
||||||
MouseIsDown = true;
|
MouseIsDown = true;
|
||||||
|
LastMouseDown = DateTime.UtcNow;
|
||||||
//Make a duplicate of the old background image.
|
//Make a duplicate of the old background image.
|
||||||
LastBackgroundImage = new Bitmap(pbNetworkView.BackgroundImage);
|
LastBackgroundImage = new Bitmap(pbNetworkView.BackgroundImage);
|
||||||
}
|
}
|
||||||
@ -1330,7 +1332,9 @@ namespace EduNetworkBuilder
|
|||||||
else if (MouseIsDown && LastBackgroundImage != null && ItemClickedOn != null && ItemsSelected.Count == 0) //We are trying to drag something
|
else if (MouseIsDown && LastBackgroundImage != null && ItemClickedOn != null && ItemsSelected.Count == 0) //We are trying to drag something
|
||||||
{
|
{
|
||||||
//find where we are
|
//find where we are
|
||||||
DragItemToNewLocation(ItemClickedOn, CenteredLocation);
|
TimeSpan HowLong = DateTime.UtcNow - LastMouseDown;
|
||||||
|
if(HowLong.TotalMilliseconds > 100)
|
||||||
|
DragItemToNewLocation(ItemClickedOn, CenteredLocation);
|
||||||
}
|
}
|
||||||
else if (MouseIsDown && ItemsSelected.Count >0) //dragging multiple items around
|
else if (MouseIsDown && ItemsSelected.Count >0) //dragging multiple items around
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user