Class Index | File Index

Classes


Class pv.Behavior.pan


Extends pv.Behavior.
Implements interactive panning starting with mousedown events. Register this behavior on panels to allow panning. This behavior can be used in tandem with pv.Behavior.zoom to allow both panning and zooming:

    .event("mousedown", pv.Behavior.pan())
    .event("mousewheel", pv.Behavior.zoom())
The pan behavior currently supports only mouse events; support for keyboard shortcuts to improve accessibility may be added in the future.

After the initial mousedown event is triggered, this behavior listens for mousemove and mouseup events on the window. This allows panning to continue even if the mouse temporarily leaves the panel that is being panned, or even the root panel.

The implementation of this behavior relies on the panel's transform property, which specifies a matrix transformation that is applied to child marks. Note that the transform property only affects the panel's children, but not the panel itself; therefore the panel's fill and stroke will not change when the contents are panned.

Panels have transparent fill styles by default; this means that panels may not receive the initial mousedown event to start panning. To fix this problem, either given the panel a visible fill style (such as "white"), or set the events property to "all" such that the panel receives events despite its transparent fill.

The pan behavior has optional support for bounding. If enabled, the user will not be able to pan the panel outside of the initial bounds. This feature is designed to work in conjunction with the zoom behavior; otherwise, bounding the panel effectively disables all panning.
Defined in: Pan.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Returns a new pan behavior to be registered on mousedown events.
Method Summary
Method Attributes Method Name and Description
 
bound(x)
Sets or gets the bound parameter.
Class Detail
pv.Behavior.pan()
Returns a new pan behavior to be registered on mousedown events.
See:
pv.Behavior.zoom
pv.Panel#transform
Method Detail
{pv.Behavior.pan} bound(x)
Sets or gets the bound parameter. If bounding is enabled, the user will not be able to pan outside the initial panel bounds; this typically applies only when the pan behavior is used in tandem with the zoom behavior. Bounding is not enabled by default.

Note: enabling bounding after panning has already occurred will not immediately reset the transform. Bounding should be enabled before the panning behavior is applied.

Parameters:
{boolean} x Optional
the new bound parameter.
Returns:
{pv.Behavior.pan} this, or the current bound parameter.

Documentation generated by JsDoc Toolkit 2.3.2 on Sun May 30 2010 18:10:23 GMT-0700 (PDT)