DragZoomingTool
The DragZoomingTool lets the user zoom into a diagram by stretching a box to indicate the new contents of the diagram's viewport (the area of the model shown by the DiagramPanel).
Inherits: DiagramTool
Properties
protected Node Box { get; set; }
value = dragZoomingTool.Box
dragZoomingTool.Box = value
Gets or sets the temporary node acting as the "rubber-band" box that the user is stretching with a mouse drag.
public DataTemplate BoxTemplate { get; set; }
value = dragZoomingTool.BoxTemplate
dragZoomingTool.BoxTemplate = value
Gets or sets the DataTemplate that renders the "rubber-band" box that the user draws to specify the zoom area.
public Diagram ZoomedDiagram { get; set; }
value = dragZoomingTool.ZoomedDiagram
dragZoomingTool.ZoomedDiagram = value
Gets or sets the Diagram that will be scaled and scrolled according to the value of ComputeBoxBounds by Rect).
Methods
public override bool CanStart()
result = dragZoomingTool.CanStart()
This tool can run when there has been a mouse-drag, far enough away not to be a click.
protected virtual Rect ComputeBoxBounds()
result = dragZoomingTool.ComputeBoxBounds()
This just returns a Rect stretching from the mouse-down point to a point guided by the current mouse point and the aspect ratio of the ZoomedDiagram.
protected virtual Node CreateBox()
result = dragZoomingTool.CreateBox()
Create a Node using BoxTemplate as its DataTemplate.
Returns: a Node that is not bound to data
public override void DoActivate()
dragZoomingTool.DoActivate()
Call CreateBox to create the "rubber-band" box, remember it as the Box property, and add it to the diagram's PartsModel.
public override void DoMouseMove()
dragZoomingTool.DoMouseMove()
While dragging the mouse, position and size the Box according to the bounds produced by ComputeBoxBounds.
public override void DoMouseUp()
dragZoomingTool.DoMouseUp()
Upon the mouse-up, call Rect) with the value of ComputeBoxBounds and stop this tool.
public override void DoStart()
dragZoomingTool.DoStart()
Capture the mouse when starting this tool.
public override void DoStop()
dragZoomingTool.DoStop()
Release the mouse capture when stopping this tool.
public virtual void ZoomToRect(Rect brect)
dragZoomingTool.ZoomToRect(brect)
This method is called to zoom the ZoomedDiagram to match the given rectangle.
- brect
- a rectangle in model coordinates
Fields
public static readonly DependencyProperty BoxTemplateProperty
value = DragZoomingTool.BoxTemplateProperty
Identifies the BoxTemplate dependency property.
public static readonly DependencyProperty ZoomedDiagramProperty
value = DragZoomingTool.ZoomedDiagramProperty
Identifies the ZoomedDiagram dependency property.