Class CanvasLayer

A map layer that provides a canvas over the slippy map and a callback system for efficient animation.

Extends google.maps.OverlayView.
Defined in: CanvasLayer.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
CanvasLayer(opt_options)
A map layer that provides a canvas over the slippy map and a callback system for efficient animation.
Field Summary
Field Attributes Field Name and Description
 
The canvas element.
Method Summary
Method Attributes Method Name and Description
 
 
A convenience method to get the current LatLng coordinate of the top left of the current view of the map.
 
 
Schedule a requestAnimationFrame callback to updateHandler.
 
setAnimate(animate)
Set the animated state of the layer.
 
setOptions(options)
Sets any options provided.
 
setPaneName(paneName)
Set the MapPane in which this layer will be displayed, by name.
 
setResizeHandler(opt_resizeHandler)
Set a function that will be called whenever the parent map and the overlay's canvas have been resized.
 
setUpdateHandler(opt_updateHandler)
Set a function that will be called when a repaint of the canvas is required.
Class Detail
CanvasLayer(opt_options)
A map layer that provides a canvas over the slippy map and a callback system for efficient animation. Requires canvas and CSS 2D transform support.
Parameters:
{CanvasLayerOptions} opt_options
Options to set in this CanvasLayer (optional). See CanvasLayerOptions.
Field Detail
canvas
The canvas element.
Method Detail
{string} getPaneName()
Returns:
{string} The name of the current container pane.

{google.maps.LatLng} getTopLeft()
A convenience method to get the current LatLng coordinate of the top left of the current view of the map.
Returns:
{google.maps.LatLng} The top left coordinate.

{boolean} isAnimated()
Returns:
{boolean} Whether the canvas is animated.

scheduleUpdate()
Schedule a requestAnimationFrame callback to updateHandler. If one is already scheduled, there is no effect.

setAnimate(animate)
Set the animated state of the layer. If true, updateHandler will be called repeatedly, once per frame. If false, updateHandler will only be called when a map property changes that could require the canvas content to be redrawn.
Parameters:
{boolean} animate
Whether the canvas is animated.

setOptions(options)
Sets any options provided. See CanvasLayerOptions for more information.
Parameters:
{CanvasLayerOptions} options
The options to set.

setPaneName(paneName)
Set the MapPane in which this layer will be displayed, by name. See google.maps.MapPanes for the panes available.
Parameters:
{string} paneName
The name of the desired MapPane.

setResizeHandler(opt_resizeHandler)
Set a function that will be called whenever the parent map and the overlay's canvas have been resized. If opt_resizeHandler is null or unspecified, any existing callback is removed.
Parameters:
{function} opt_resizeHandler
The resize callback function (optional).

setUpdateHandler(opt_updateHandler)
Set a function that will be called when a repaint of the canvas is required. If opt_updateHandler is null or unspecified, any existing callback is removed.
Parameters:
{function} opt_updateHandler
The update callback function (optional).