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
Box : Node
Gets or sets the temporary node acting as the "rubber-band" box that the user is stretching with a mouse drag.
BoxTemplate : DataTemplate
Gets or sets the DataTemplate that renders the "rubber-band" box that the user draws to specify the zoom area.
ZoomedDiagram : Diagram
Gets or sets the Diagram that will be scaled and scrolled according to the value of ComputeBoxBounds by Rect).
Methods
CanStart() : bool
This tool can run when there has been a mouse-drag, far enough away not to be a click.
ComputeBoxBounds() : Rect
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.
CreateBox() : Node
Create a Node using BoxTemplate as its DataTemplate.
Returns: a Node that is not bound to data
DoActivate()
Call CreateBox to create the "rubber-band" box, remember it as the Box property, and add it to the diagram's PartsModel.
DoDeactivate()
Cleanup any Box.
DoMouseMove()
While dragging the mouse, position and size the Box according to the bounds produced by ComputeBoxBounds.
DoMouseUp()
Upon the mouse-up, call Rect) with the value of ComputeBoxBounds and stop this tool.
DoStart()
Capture the mouse when starting this tool.
DoStop()
Release the mouse capture when stopping this tool.
ZoomToRect(Rect)
This method is called to zoom the ZoomedDiagram to match the given rectangle.
- brect
- a rectangle in model coordinates
Fields
BoxTemplateProperty : DependencyProperty
Identifies the BoxTemplate dependency property.
ZoomedDiagramProperty : DependencyProperty
Identifies the ZoomedDiagram dependency property.