예제 #1
0
 /// <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)));
 }
예제 #2
0
        public override void Initialize()
        {
            PNode n1 = PPath.CreateEllipse(0, 0, 100, 100);
            PNode n2 = PPath.CreateRectangle(300, 200, 100, 100);

            n1.Tag = "node 1";
            n2.Tag = "node 2";
            Canvas.Layer.AddChild(n1);
            Canvas.Layer.AddChild(n2);

            PCamera camera = Canvas.Camera;

            tooltipNode = new PText();

            tooltipNode.Pickable = false;
            camera.AddChild(tooltipNode);

            PBasicInputEventHandler tipEventHandler = new PBasicInputEventHandler();

            tipEventHandler.MouseMove = new MouseMoveDelegate(MouseMoveHandler);
            tipEventHandler.MouseDrag = new MouseDragDelegate(MouseDragHandler);
            camera.AddInputEventListener(tipEventHandler);
        }
 /// <summary>
 /// Sets the camera the bounds handles will be stuck to and the target node that
 /// will be resized by the sticky bounds handles.
 /// </summary>
 /// <param name="newCamera">The camera to stick the bounds handles to.</param>
 /// <param name="newTarget">
 /// The node that will be resized by the sticky bounds handles.
 /// </param>
 public virtual void SetCameraTarget(PCamera newCamera, PNode newTarget)
 {
     camera = newCamera;
     camera.AddChild(this);
     target = newTarget;
 }