Exemplo n.º 1
0
 public void HandleMove(IInputModeContext context, PointD originalLocation, PointD newLocation)
 {
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the position that is constrained by the rectangle.
 /// </summary>
 protected override PointD ConstrainNewLocation(IInputModeContext context, PointD originalLocation,
                                                PointD newLocation)
 {
     return(newLocation.GetConstrained(boundaryPositionRectangle));
 }
Exemplo n.º 3
0
 protected override bool IsInBox(IInputModeContext context, RectD rectangle, ILabel label)
 {
     return(wrapped.Renderer.GetMarqueeTestable(label, wrapped).IsInBox(context, rectangle));
 }
 /// <summary>
 /// The resize gesture is finished.
 /// </summary>
 public void ReshapeFinished(IInputModeContext context, RectD originalBounds, RectD newBounds)
 {
     handler.ReshapeFinished(context, originalBounds, newBounds);
     layoutHelper.FinishLayout();
 }
 /// <summary>
 /// The resize gesture is canceled.
 /// </summary>
 public void CancelReshape(IInputModeContext context, RectD originalBounds)
 {
     handler.CancelReshape(context, originalBounds);
     layoutHelper.CancelLayout();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Stores the initial location of the movement for reference, and calls the base method.
 /// </summary>
 public void InitializeDrag(IInputModeContext context)
 {
     handler.InitializeDrag(context);
     lastLocation = new PointD(handler.Location);
 }
Exemplo n.º 7
0
 public void DragFinished(IInputModeContext context, PointD originalLocation, PointD newLocation)
 {
     handler.DragFinished(context, originalLocation, lastLocation);
 }
Exemplo n.º 8
0
 protected override PointD ConstrainNewLocation(IInputModeContext context, PointD originalLocation, PointD newLocation)
 {
     // do not constrain...
     return(newLocation);
 }
 public static IModelItem FindItem(this GraphEditorInputMode mode, PointD location,
                                   GraphItemTypes[] tests, Predicate <IModelItem> filter, IInputModeContext context)
 {
     return(mode.FindItems(context, location, tests, filter).FirstOrDefault());
 }
Exemplo n.º 10
0
 /// <inheritdoc />
 protected override bool IsHit(IInputModeContext context, PointD location, INode node)
 {
     return(Style.Renderer.GetHitTestable(node, Style).IsHit(context, location));
 }
Exemplo n.º 11
0
 /// <inheritdoc />
 protected override bool IsInBox(IInputModeContext context, RectD rectangle, INode node)
 {
     return(Style.Renderer.GetMarqueeTestable(node, Style).IsInBox(context, rectangle));
 }
 /// <summary>
 /// In general, this method determines whether the user may detach the
 /// given node from its current parent in order to reparent it. In this case,
 /// it returns false for red nodes.
 /// </summary>
 /// <param name="context">The context that provides information about the
 /// user input.</param>
 /// <param name="node">The node that is about to be detached from its
 /// current parent.</param>
 /// <returns>Whether the node may be detached and reparented.</returns>
 public override bool ShouldReparent(IInputModeContext context, INode node)
 {
     return(!Colors.Firebrick.Equals(node.Tag));
 }
 /// <summary>
 /// In general, this method determines whether the current gesture that
 /// can be determined through the context is a reparent gesture. In this
 /// case, it returns true, if the base implementation returns true or if the
 /// current node is green.
 /// </summary>
 /// <param name="context">The context that provides information about the
 /// user input.</param>
 /// <param name="node">The node that will possibly be reparented.</param>
 /// <returns>Whether this is a reparenting gesture.</returns>
 public override bool IsReparentGesture(IInputModeContext context, INode node)
 {
     return(base.IsReparentGesture(context, node) || Colors.Green.Equals(node.Tag));
 }
Exemplo n.º 14
0
            public bool IsHit(IInputModeContext context, PointD location)
            {
                var whichButton = GetHitButton(context, node, location);

                return(whichButton != ButtonType.None);
            }
Exemplo n.º 15
0
 public void CancelDrag(IInputModeContext context, PointD originalLocation)
 {
 }
 /// <summary>
 /// Stores the initial position of the <see cref="IMutablePoint"/>.
 /// </summary>
 public virtual void InitializeDrag(IInputModeContext context)
 {
     startPosition = position.ToPointD();
 }
Exemplo n.º 17
0
 public void DragFinished(IInputModeContext context, PointD originalLocation, PointD newLocation)
 {
 }
Exemplo n.º 18
0
 /// <summary>
 /// Stores the initial <see cref="NodeStylePortStyleAdapter.RenderSize"/>.
 /// </summary>
 /// <param name="context">The context of the reshape gesture.</param>
 public void InitializeDrag(IInputModeContext context)
 {
     initialRenderSize = adapter.RenderSize;
 }
Exemplo n.º 19
0
 public void CancelDrag(IInputModeContext context, PointD originalLocation)
 {
     handler.CancelDrag(context, originalLocation);
 }
Exemplo n.º 20
0
 /// <summary>
 /// Resets <see cref="NodeStylePortStyleAdapter.RenderSize"/> to its initial value.
 /// </summary>
 /// <param name="context">The context of the reshape gesture.</param>
 /// <param name="originalLocation">The value of the <see cref="Location"/> property at the time of <see cref="InitializeDrag"/>.</param>
 public void CancelDrag(IInputModeContext context, PointD originalLocation)
 {
     adapter.RenderSize = initialRenderSize;
 }
Exemplo n.º 21
0
 /// <summary>
 /// Hit test which considers HitTestRadius specified in canvasContext
 /// </summary>
 /// <returns>True if p is inside node.</returns>
 protected override bool IsHit(IInputModeContext context, PointD location, INode node)
 {
     return(GeomUtilities.EllipseContains(node.Layout.ToRectD(), location, context.HitTestRadius));
 }
Exemplo n.º 22
0
        /// <summary>
        /// Calculates and applies the final <see cref="NodeStylePortStyleAdapter.RenderSize"/>.
        /// </summary>
        /// <param name="context">The context of the reshape gesture.</param>
        /// <param name="originalLocation">The value of the <see cref="Location"/> property at the time of <see cref="InitializeDrag"/>.</param>
        /// <param name="newLocation">The coordinates in the world coordinate system that the client wants the handle to be at.</param>
        public void DragFinished(IInputModeContext context, PointD originalLocation, PointD newLocation)
        {
            var delta = CalculateDelta(originalLocation, newLocation);

            adapter.RenderSize = CalculateNewSize(delta);
        }
 /// <summary>
 /// The node is resized.
 /// </summary>
 public void HandleReshape(IInputModeContext context, RectD originalBounds, RectD newBounds)
 {
     handler.HandleReshape(context, originalBounds, newBounds);
     layoutHelper.RunLayout();
 }
Exemplo n.º 24
0
 public override bool ShouldEditOrthogonally(IInputModeContext context, IEdge edge)
 {
     // arc edges are not edited orthogonally
     return(!(edge.Style is ArcEdgeStyle));
 }
Exemplo n.º 25
0
 /// <summary>
 /// Prepares the rectangle that is actually used to limit the node
 /// position, besides the base functionality. Since a position handler
 /// works on points, the actual rectangle must be a limit for the upper
 /// left corner of the node and not for the node's bounding box.
 /// </summary>
 protected override void OnInitialized(IInputModeContext context, PointD originalLocation)
 {
     base.OnInitialized(context, originalLocation);
     // Shrink the retangle by the node size to get the limits for the upper left node corner
     boundaryPositionRectangle = boundaryRectangle.ToRectD() + new InsetsD(0, 0, -node.Layout.Width, -node.Layout.Height);
 }
Exemplo n.º 26
0
 public override bool ShouldMoveEndImplicitly(IInputModeContext context, IEdge edge, bool sourceEnd)
 {
     // enable moving of source/target of the edge to other ports
     return(true);
 }
Exemplo n.º 27
0
 public void InitializeDrag(IInputModeContext context)
 {
 }
Exemplo n.º 28
0
 protected override bool IsHit(IInputModeContext context, PointD location, ILabel label)
 {
     return(wrapped.Renderer.GetHitTestable(label, wrapped).IsHit(context, location));
 }