/// <summary> /// Add a LockPosition for each node whose position you want to keep fixed. LockPosition allows you to, /// for example, do interactive mouse dragging. /// We return the LinkedListNode which you can store together with your local Node object so that a RemoveLock operation can be performed in /// constant time. /// </summary> /// <param name="node"></param> /// <param name="bounds"></param> /// <param name="weight">stay weight of lock</param> /// <returns>LinkedListNode which you should hang on to if you want to call RemoveLock later on.</returns> public LockPosition CreateLock(Node node, Rectangle bounds, double weight) { LockPosition lp = new LockPosition(node, bounds, weight); lp.listNode = locks.AddLast(lp); return(lp); }
public void RemoveLock(LockPosition lockPosition) { ValidateArg.IsNotNull(lockPosition, "lockPosition"); if (lockPosition.listNode != null) { lockPosition.RestoreNodeWeight(); try { locks.Remove(lockPosition.listNode); } catch (InvalidOperationException e) { Console.WriteLine("Problem in FastIncrementalLayoutSettings.RemoveLock " + e.Message); } lockPosition.listNode = null; } }