google.maps.Rectangle class
A rectangle overlay.
This class extends MVCObject.
Constructor
Rectangle([opts])
Parameters:
- opts: RectangleOptions optional
Create a rectangle using the passed RectangleOptions, which specify the bounds and style.
Methods
getBounds()
Parameters: None
Return Value: LatLngBounds
Returns the bounds of this rectangle.
getDraggable()
Parameters: None
Return Value: boolean
Returns whether this rectangle can be dragged by the user.
getEditable()
Parameters: None
Return Value: boolean
Returns whether this rectangle can be edited by the user.
getMap()
Parameters: None
Return Value: Map
Returns the map on which this rectangle is displayed.
getVisible()
Parameters: None
Return Value: boolean
Returns whether this rectangle is visible on the map.
setBounds(bounds)
Parameters:
- bounds: LatLngBounds|LatLngBoundsLiteral
Return Value: None
Sets the bounds of this rectangle.
setDraggable(draggable)
Parameters:
- draggable: boolean
Return Value: None
If set to true, the user can drag this rectangle over the map.
setEditable(editable)
Parameters:
- editable: boolean
Return Value: None
If set to true, the user can edit this rectangle by dragging the control points shown at the corners and on each edge.
setMap(map)
Parameters:
- map: Map
Return Value: None
Renders the rectangle on the specified map. If map is set to null, the rectangle will be removed.
setOptions(options)
Parameters:
- options: RectangleOptions
Return Value: None
setVisible(visible)
Parameters:
- visible: boolean
Return Value: None
Hides this rectangle if set to false.
Events
function()
Arguments: None
This event is fired when the rectangle's bounds are changed.
function(event)
Arguments:
- event: MouseEvent
This event is fired when the DOM click event is fired on the rectangle.
function(event)
Arguments:
- event: MouseEvent
This event is fired when the DOM dblclick event is fired on the rectangle.
function(event)
Arguments:
- event: MouseEvent
This event is repeatedly fired while the user drags the rectangle.
function(event)
Arguments:
- event: MouseEvent
This event is fired when the user stops dragging the rectangle.
function(event)
Arguments:
- event: MouseEvent
This event is fired when the user starts dragging the rectangle.
function(event)
Arguments:
- event: MouseEvent
This event is fired when the DOM mousedown event is fired on the rectangle.
function(event)
Arguments:
- event: MouseEvent
This event is fired when the DOM mousemove event is fired on the rectangle.
function(event)
Arguments:
- event: MouseEvent
This event is fired on rectangle mouseout.
function(event)
Arguments:
- event: MouseEvent
This event is fired on rectangle mouseover.
function(event)
Arguments:
- event: MouseEvent
This event is fired when the DOM mouseup event is fired on the rectangle.
function(event)
Arguments:
- event: MouseEvent
This event is fired when the rectangle is right-clicked on.