Options
All
  • Public
  • Public/Protected
  • All
Menu

Available only in the v=beta channel: https://goo.gle/3oAthT3. The WebGL Overlay View provides direct access to the same WebGL rendering context Google Maps Platform uses to render the vector basemap. This use of a shared rendering context provides benefits such as depth occlusion with 3D building geometry, and the ability to sync 2D/3D content with basemap rendering.

With WebGL Overlay View you can add content to your maps using WebGL directly, or popular Graphics libraries like Three.js or deck.gl. To use the overlay, you can extend google.maps.WebglOverlayView and provide an implementation for each of the following lifecycle hooks: google.maps.WebglOverlayView.onAdd, google.maps.WebglOverlayView.onContextRestored, google.maps.WebglOverlayView.onDraw, google.maps.WebglOverlayView.onContextLost and google.maps.WebglOverlayView.onRemove.

You must call google.maps.WebglOverlayView.setMap with a valid google.maps.Map object to trigger the call to the onAdd() method and setMap(null) in order to trigger the onRemove() method. The setMap() method can be called at the time of construction or at any point afterward when the overlay should be re-shown after removing. The onDraw() method will then be called whenever a map property changes that could change the position of the element, such as zoom, center, or map type. WebglOverlayView may only be added to a vector map having a google.maps.MapOptions.mapId.

Hierarchy

Index

Constructors

constructor

Methods

addListener

  • Adds the given listener function to the given event name. Returns an identifier for this listener that can be used with google.maps.event.removeListener.

    Parameters

    • eventName: string
    • handler: Function

    Returns MapsEventListener

bindTo

  • bindTo(key: string, target: MVCObject, targetKey?: null | string, noNotify?: boolean): void
  • Binds a View to a Model.

    Parameters

    • key: string
    • target: MVCObject
    • Optional targetKey: null | string
    • Optional noNotify: boolean

    Returns void

get

  • get(key: string): any
  • Gets a value.

    Parameters

    • key: string

    Returns any

getMap

  • getMap(): undefined | null | Map
  • Returns undefined | null | Map

notify

  • notify(key: string): void
  • Notify all observers of a change on this property. This notifies both objects that are bound to the object's property as well as the object that it is bound to.

    Parameters

    • key: string

    Returns void

onAdd

  • onAdd(): void
  • Implement this method to fetch or create intermediate data structures before the overlay is drawn that don’t require immediate access to the WebGL rendering context.

    Returns void

onContextLost

  • onContextLost(): void
  • This method is called when the rendering context is lost for any reason, and is where you should clean up any pre-existing GL state, since it is no longer needed.

    Returns void

onContextRestored

  • onContextRestored(gl: WebGLRenderingContext): void
  • This method is called once the rendering context is available. Use it to initialize or bind any WebGL state such as shaders or buffer objects.

    Parameters

    • gl: WebGLRenderingContext

      rendering context for developers to access WebGL.

    Returns void

onDraw

  • Implement this method to draw WebGL content directly on the map. Note that if the overlay needs a new frame drawn then call google.maps.WebglOverlayView.requestRedraw.

    Parameters

    • gl: WebGLRenderingContext

      rendering context for developers to access WebGL.

    • transformer: CoordinateTransformer

      convenience class for providing camera transforms to center objects at latitude/longitude coordinates.

    Returns void

onRemove

  • onRemove(): void
  • This method is called when the overlay is removed from the map with WebglOverlayView.setMap(null), and is where you should remove all intermediate objects.

    Returns void

requestRedraw

  • requestRedraw(): void
  • Triggers the map to redraw a frame.

    Returns void

set

  • set(key: string, value: any): void
  • Sets a value.

    Parameters

    • key: string
    • value: any

    Returns void

setMap

  • setMap(map?: null | Map): void
  • Adds the overlay to the map.

    Parameters

    • Optional map: null | Map

      The map to access the div, model and view state.

    Returns void

setValues

  • setValues(values?: null | object): void
  • Sets a collection of key-value pairs.

    Parameters

    • Optional values: null | object

    Returns void

unbind

  • unbind(key: string): void
  • Removes a binding. Unbinding will set the unbound property to the current value. The object will not be notified, as the value has not changed.

    Parameters

    • key: string

    Returns void

unbindAll

  • unbindAll(): void

Generated using TypeDoc