Class DrawCommandHandler

GoDiagram®
v10.0.11
by Northwoods Software®

This CommandHandler class allows the user to position selected Parts in a diagram relative to the first part selected, in addition to overriding the DoKeyDown method of the CommandHandler for handling the arrow keys in additional manners.

Inheritance
DrawCommandHandler
Namespace: Northwoods.Go.Extensions
Assembly: DrawCommandHandlerAvalonia.dll
Syntax
public class DrawCommandHandler : CommandHandler

Properties

ArrowKeyBehavior

Gets or sets the arrow key behavior. Possible values can be found in the ArrowBehavior enum.

Declaration
public ArrowBehavior ArrowKeyBehavior { get; set; }
Property Value
Type Description
ArrowBehavior
Remarks

The default value is Move.

PasteOffset

Gets or sets the offset at which each repeated PasteSelection(Point?) puts the new copied parts from the clipboard.

Declaration
public Point PasteOffset { get; set; }
Property Value
Type Description
Point
Remarks

The default value is (10, 10).

Methods

AlignBottom()

Aligns selected parts along the bottom-most edge of the bottom-most part.

Declaration
public void AlignBottom()

AlignCenterX()

Aligns selected parts at the x-value of the center point of the first selected part.

Declaration
public void AlignCenterX()

AlignCenterY()

Aligns selected parts at the y-value of the center point of the first selected part.

Declaration
public void AlignCenterY()

AlignColumn(int)

Aligns selected parts top-to-bottom in order of the order selected.

Declaration
public void AlignColumn(int distance = 0)
Parameters
Type Name Description
int distance
Remarks

Distance between parts can be specified. Default distance is 0.

AlignLeft()

Aligns selected parts along the left-most edge of the left-most part.

Declaration
public void AlignLeft()

AlignRight()

Aligns selected parts along the left-most edge of the left-most part.

Declaration
public void AlignRight()

AlignRow(int)

Aligns selected parts left-to-right in order of the order selected.

Declaration
public void AlignRow(int distance = 0)
Parameters
Type Name Description
int distance
Remarks

Distance between parts can be specified. Default distance is 0.

AlignTop()

Aligns selected parts along the top-most edge of the top-most part.

Declaration
public void AlignTop()

CanAlignSelection()

This controls whether or not the user can invoke the AlignLeft(), AlignRight(), AlignTop(), AlignBottom(), AlignCenterX(), AlignCenterY() commands.

Declaration
public bool CanAlignSelection()
Returns
Type Description
bool

This returns true: if the diagram is not IsReadOnly, if the model is not IsReadOnly, if there are at least two selected Parts.

CanRotate()

This controls whether or not the user can invoke the Rotate(double) method.

Declaration
public bool CanRotate()
Returns
Type Description
bool

This returns true: if the diagram is not IsReadOnly, if the model is not IsReadOnly, if there is at least one selected Parts.

CopyToClipboard(IEnumerable<Part>)

Reset the last offset for pasting.

Declaration
public override void CopyToClipboard(IEnumerable<Part> coll)
Parameters
Type Name Description
IEnumerable<Part> coll
Overrides

DoKeyDown()

This implements custom behaviors for arrow key keyboard events.

Declaration
public override void DoKeyDown()
Overrides
Remarks

Set ArrowKeyBehavior to select, move, scroll, or none This affects the behavior when a user types an arrow key.

PasteFromClipboard()

Paste from the clipboard with an offset incremented on each paste, and reset when copied.

Declaration
public override IReadOnlyCollection<Part> PasteFromClipboard()
Returns
Type Description
IReadOnlyCollection<Part>

a collection of newly pasted Parts

Overrides

PullToFront()

Change the z-ordering of selected parts to pull them forward, in front of all other parts in their respective layers.

Declaration
public void PullToFront()
Remarks

All unselected parts in each layer with a selected Part with a non-numeric ZOrder will get a ZOrder of 0.

PushToBack()

Change the z-ordering of selected parts to push them backward, behind all other parts in their respective layers.

Declaration
public void PushToBack()
Remarks

All unselected parts in each layer with a selected Part with a non-numeric ZOrder will get a ZOrder of 0.

Rotate(double)

Change the angle of the parts connected with the given part.

Declaration
public void Rotate(double angle = 90)
Parameters
Type Name Description
double angle

the positive (clockwise) or negative (counter-clockwise) change in the angle of each Part, in degrees.

Remarks

This is in the command handler so it can easily be accessed for the purpose of creating commands that change the rotation of parts.