Class Index | File Index

Classes


Class pv.Behavior.zoom


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

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

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 zoomed. The built-in support for transforms only supports uniform scaling and translates, which is sufficient for panning and zooming. Note that this is not a strict geometric transformation, as the lineWidth property is scale-aware: strokes are drawn at constant size independent of scale.

Panels have transparent fill styles by default; this means that panels may not receive mousewheel events to zoom. 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 zoom behavior has optional support for bounding. If enabled, the user will not be able to zoom out farther than the initial bounds. This feature is designed to work in conjunction with the pan behavior.
Defined in: Zoom.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Returns a new zoom behavior to be registered on mousewheel events.
Method Summary
Method Attributes Method Name and Description
 
bound(x)
Sets or gets the bound parameter.
Class Detail
pv.Behavior.zoom(speed)
Returns a new zoom behavior to be registered on mousewheel events.
Parameters:
{number} speed
See:
pv.Panel#transform
pv.Mark#scale
Method Detail
{pv.Behavior.zoom} bound(x)
Sets or gets the bound parameter. If bounding is enabled, the user will not be able to zoom out farther than the initial panel bounds. Bounding is not enabled by default. If this behavior is used in tandem with the pan behavior, both should use the same bound parameter.

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

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

Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT)