public void HandleMove(IInputModeContext context, PointD originalLocation, PointD newLocation) { }
/// <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)); }
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(); }
/// <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); }
public void DragFinished(IInputModeContext context, PointD originalLocation, PointD newLocation) { handler.DragFinished(context, originalLocation, lastLocation); }
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()); }
/// <inheritdoc /> protected override bool IsHit(IInputModeContext context, PointD location, INode node) { return(Style.Renderer.GetHitTestable(node, Style).IsHit(context, location)); }
/// <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)); }
public bool IsHit(IInputModeContext context, PointD location) { var whichButton = GetHitButton(context, node, location); return(whichButton != ButtonType.None); }
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(); }
public void DragFinished(IInputModeContext context, PointD originalLocation, PointD newLocation) { }
/// <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; }
public void CancelDrag(IInputModeContext context, PointD originalLocation) { handler.CancelDrag(context, originalLocation); }
/// <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; }
/// <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)); }
/// <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(); }
public override bool ShouldEditOrthogonally(IInputModeContext context, IEdge edge) { // arc edges are not edited orthogonally return(!(edge.Style is ArcEdgeStyle)); }
/// <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); }
public override bool ShouldMoveEndImplicitly(IInputModeContext context, IEdge edge, bool sourceEnd) { // enable moving of source/target of the edge to other ports return(true); }
public void InitializeDrag(IInputModeContext context) { }
protected override bool IsHit(IInputModeContext context, PointD location, ILabel label) { return(wrapped.Renderer.GetHitTestable(label, wrapped).IsHit(context, location)); }