class DragZoomControl

This class lets you add a control to the map which, when clicked, will let the map user zoom by dragging a rectangle on the map. It extends GControl.

Constructor

Constructor Description
DragZoomControl(opts_boxStyle, opts_other, opts_callbacks ) Creates a DragZoomControl with the specified options (hashes). All parameters are required, even if empty hashes.

class DragZoomBoxStyleOptions

Instances of this class are used in the opts_boxStyle argument to the constructor of the DragZoomControl class. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

Properties

As the name of this class indicates, all properties are optional.

Properties Type Description
opacity Number Opacity of the veil from 0-1. Default is 0.2.
fillColor String Hex value of fill color. Default is "#000".
border String CSS-style declaration of border. Default is "2px solid blue".

class DragZoomOtherOptions

Instances of this class are used in the opts_other argument to the constructor of the DragZoomControl class. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

Properties

As the name of this class indicates, all properties are optional.

Properties Type Description
buttonHTML String The zoom button HTML in non-activated state. Default is "zoom..".
buttonStartingStyle Object A hash of CSS styles for the zoom button which are common to both un-activated and activated state. Default is {width: '52px', border: '1px solid black', padding: '2px'}.
buttonStyle Object A hash of CSS styles for the zoom button which will be applied when the button is in un-activated state. Default is {background: '#FFF'}.
buttonZoomingHTML String HTML which is placed in the zoom button when the button is activated. Default is "Drag a region on the map".
buttonZoomingStyle Object A hash of CSS styles for the zoom button which will be applied when the button is activated. Default is {background: '#FF0'}.
overlayRemoveTime Number The number of milliseconds to wait before removing the rectangle indicating the zoomed-in area after the zoom has happened. Default is 6000.
stickyZoomEnabled Boolean Whether or not the control stays in "zoom mode" until turned off. When true, the user can zoom repeatedly, until clicking on the zoom button again to turn zoom mode off. Defaults to false.

class DragZoomCallbacks

Instances of this class are used in the opts_callbacks argument to the constructor of the DragZoomControl class, and allow you to set callback functions for various DragZoom events. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

Properties

As the name of this class indicates, all properties are optional.

Properties Type Description
buttonclick Function Called when the DragZoom is activated by clicking on the "zoom" button.
dragstart Function Called when user starts to drag a rectangle. Callback args are x,y -- the pixel values, relative to the upper-left-hand corner of the map, where the user began dragging.
dragging Function Called repeatedly while the user is dragging. Callback args are startX,startY, currentX,currentY -- the pixel values of the start of the drag, and the current drag point, respectively.
dragend Function Called when the user releases the mouse button after dragging the rectangle. Callback args are: NW {GLatLng}, NE {GLatLng}, SE {GLatLng}, SW {GLatLng}, NW {GPoint}, NE {GPoint}, SE {GPoint}, SW {GPoint}. The first 4 are the latitudes/longitudes; the last 4 are the pixel coords on the map.