Finish locking items in location. Can no longer move them if they are locked.
This commit is contained in:
parent
1ada144423
commit
56b680e057
@ -575,7 +575,7 @@ namespace EduNetworkBuilder
|
||||
if (tItem is NetworkDevice)
|
||||
{
|
||||
tDevice = (NetworkDevice)tItem;
|
||||
if (tDevice.GetNetType() == NetworkComponentType.tree) continue; //Cannot select trees
|
||||
if (tDevice.IsLockedInLocation()) continue; //some items cannot be moved
|
||||
int tsize = tDevice.Size;
|
||||
tPoint = tDevice.myLocation();
|
||||
if (tPoint.X + tsize >= area.X && tPoint.Y +tsize >= area.Y)
|
||||
|
@ -1660,6 +1660,8 @@ namespace EduNetworkBuilder
|
||||
else //Drag the item
|
||||
{
|
||||
if (Math.Abs(ClickedLocation.X - ClickLocation.X) > 5 || Math.Abs(ClickedLocation.Y - ClickLocation.Y) > 5)
|
||||
{
|
||||
if (!ItemClickedOn.IsLockedInLocation())
|
||||
{
|
||||
ItemClickedOn.ChangeLocation(CenteredLocation);
|
||||
ItemClickedOn.UnHide(); //If it was hidden, unhide it
|
||||
@ -1668,6 +1670,7 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LastClick = DateTime.Now;
|
||||
}
|
||||
|
||||
@ -1769,7 +1772,7 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
//find where we are
|
||||
TimeSpan HowLong = DateTime.UtcNow - LastMouseDown;
|
||||
if(HowLong.TotalMilliseconds > 100)
|
||||
if(HowLong.TotalMilliseconds > 100 && !ItemClickedOn.IsLockedInLocation())
|
||||
DragItemToNewLocation(ItemClickedOn, CenteredLocation);
|
||||
}
|
||||
else if (MouseIsDown && ItemsSelected.Count >0) //dragging multiple items around
|
||||
|
@ -459,6 +459,14 @@ namespace EduNetworkBuilder
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
public bool IsLockedInLocation()
|
||||
{
|
||||
if (myType == NetworkComponentType.tree) return true; //Trees are always stationary
|
||||
Network myNet = NB.GetNetwork();
|
||||
if (myNet.ItemHasTest(hostname, NetTestType.LockLocation)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetDNSServer(bool isDNS)
|
||||
{
|
||||
isDNSServer = isDNS;
|
||||
|
Loading…
Reference in New Issue
Block a user