/// <summary> /// Adds bounds handles to the given node. /// </summary> /// <param name="aNode">The node to add bounds handles to.</param> public static void AddBoundsHandlesTo(PNode aNode) { aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateEastLocator(aNode))); aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateWestLocator(aNode))); aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthLocator(aNode))); aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthLocator(aNode))); aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthEastLocator(aNode))); aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthWestLocator(aNode))); aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthEastLocator(aNode))); aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthWestLocator(aNode))); }
/// <summary> /// Adds sticky bounds handles (with respect to the given camera) to the specified node. /// </summary> /// <param name="aNode">The node to add sticky bounds handles to.</param> /// <param name="camera">The camera to stick the bounds handles to.</param> /// <remarks> /// Sticky bounds handles are not affected by the view transform of the camera. That /// is, they will remain a constant size as the view is zoomed in and out. /// </remarks> public static void AddStickyBoundsHandlesTo(PNode aNode, PCamera camera) { camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateEastLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateWestLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthEastLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthWestLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthEastLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthWestLocator(aNode))); }
public override void Initialize() { PCanvas c = Canvas; PActivity updateHandles = new PActivity(-1, 0); updateHandles.ActivityStepped = new ActivitySteppedDelegate(ActivityStepped); PPath rect = PPath.CreateRectangle(0, 0, 100, 100); rect.Brush = Color.Red; c.Layer.AddChild(rect); c.Camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthEastLocator(rect))); c.Camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthWestLocator(rect))); c.Camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthEastLocator(rect))); c.Camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthWestLocator(rect))); c.Root.ActivityScheduler.AddActivity(updateHandles, true); }