RotatingTool
The RotatingTool is used to interactively change the angle of an element.
Inherits: DiagramTool
Properties
protected FrameworkElement AdornedElement { get; set; }
value = rotatingTool.AdornedElement
rotatingTool.AdornedElement = value
Gets or sets the current FrameworkElement that is being rotated.
protected Node AdornedNode { get; }
value = rotatingTool.AdornedNode
Gets the current Node that the AdornedElement is in.
protected FrameworkElement Handle { get; set; }
value = rotatingTool.Handle
rotatingTool.Handle = value
Gets or sets the current rotate handle that is being dragged.
protected double OriginalAngle { get; set; }
value = rotatingTool.OriginalAngle
rotatingTool.OriginalAngle = value
Gets or sets the angle of the AdornedElement when the user started rotating.
protected Point RotationPoint { get; set; }
value = rotatingTool.RotationPoint
rotatingTool.RotationPoint = value
Gets or sets the point around which the element is being rotated.
public double SnapAngleEpsilon { get; set; }
value = rotatingTool.SnapAngleEpsilon
rotatingTool.SnapAngleEpsilon = value
Gets or sets the closeness to a desired angle at which the angle is "snapped to".
public double SnapAngleMultiple { get; set; }
value = rotatingTool.SnapAngleMultiple
rotatingTool.SnapAngleMultiple = value
Gets or sets the preferred angles for the selected element.
Methods
public override bool CanStart()
result = rotatingTool.CanStart()
The RotatingTool may run when there is a mouse-down event on a rotate handle.
protected virtual double ComputeRotate(Point newPoint)
result = rotatingTool.ComputeRotate(newPoint)
Compute the new angle given a Point.
- newPoint
- a Point in model coordinates
Returns: the new angle, in degrees
public override void DoCancel()
rotatingTool.DoCancel()
Restore the OriginalAngle of the AdornedElement and stop this tool.
public override void DoDeactivate()
rotatingTool.DoDeactivate()
This stops the current edit (StopTransaction).
public override void DoMouseMove()
rotatingTool.DoMouseMove()
Call Double) with a new angle determined by the mouse point.
public override void DoMouseUp()
rotatingTool.DoMouseUp()
Call Double) with an angle based on the most recent mouse point and raise an "object rotated" event before stopping the tool.
protected virtual void DoRotate(double newangle)
rotatingTool.DoRotate(newangle)
Change the angle of the AdornedElement.
- newangle
- the new angle, in degrees
public override void DoStart()
rotatingTool.DoStart()
Capture the mouse when starting this tool.
public override void DoStop()
rotatingTool.DoStop()
Release the mouse capture when stopping this tool.
public override void UpdateAdornments(Part part)
rotatingTool.UpdateAdornments(part)
Show an Adornment with a rotate handle at a point to the side of the AdornedElement, if the node is selected and visible and if CanRotate is true.
- part
Fields
public static readonly DependencyProperty SnapAngleEpsilonProperty
value = RotatingTool.SnapAngleEpsilonProperty
Identifies the SnapAngleEpsilon dependency property.
public static readonly DependencyProperty SnapAngleMultipleProperty
value = RotatingTool.SnapAngleMultipleProperty
Identifies the SnapAngleMultiple dependency property.