Options
All
  • Public
  • Public/Protected
  • All
Menu

A controller defines how user input events are interpreted. You can explicitly configure a controller by setting the controller property on the Map. If no controller is configured on the map, or the map's controller does not handle the event (does not return EVENT_HANDLED from onGestureEvent), the following defaults apply:

  • Mouse events
    • Dragging with the mouse on the map will pan the map
    • The scroll wheel is used to zoom in and out of the map
    • A single click translates to a selection operation
  • Touch events
    • Dragging a single finger on the screen pans the map
    • A pinch operation will zoom in and out of the map
    • A single tap selects an object under the finger
  • Keyboard events
    • There currently are no default keyboard events available
All controller implementations must have Controller in their prototype chain.

Hierarchy

Implements

Overview

Constructors

Protected constructor

Events

on

  • (event: "Invalidated", callback: (...args: any[]) => void, context?: object): Handle
  • An event indicating that this Controller is invalidated. Invalidated means that the Controller requests for its onDraw to be called during the next rendering pass (because its appearance has changed). This event fires when invalidate is called.

    Parameters

    • event: "Invalidated"
    • callback: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: object

    Returns Handle

Accessors

map

  • get map(): Map | null
  • set map(value: Map | null): void
  • The map on which this controller is currently active or null if this controller is not currently active. This property is read-only.

    Returns Map | null

  • The map on which this controller is currently active or null if this controller is not currently active. This property is read-only.

    Parameters

    • value: Map | null

    Returns any

Methods

invalidate

  • (): void
  • Call this method to indicate that the controller's appearance has changed. Calling this method ensures the onDraw will be called during the next rendering pass.

    Returns void

onActivate

  • (map: Map): void
  • Callback that is invoked when this controller is activated on a map. This method allows controller implementations to perform setup work.

    Parameters

    • map: Map

      the map on which the controller has been activated

    Returns void

onDeactivate

  • Callback that is invoked when this controller is deactivated on a map. This method allows controller implementations to perform cleanup work. This method must return either any resolved value or a promise to indicate completion of deactivation. This allows controller implementation to perform asynchronous deactivation work. During the period between this method being called and the resolution of the deactivation promise, this controller will no longer receive input events, but will still get the opportunity to draw itself.

    Parameters

    • map: Map

      the map on which the controller has been deactivated

    Returns Promise<any> | any

    a concrete value to indicate immediate deactivation or a deactivation promise.

onDraw

  • Callback that allows controller implementations to perform custom drawing on the map. Controller shapes and icons are drawn on top of all other content in the map. Note that the map may perform caching which may cause this method to only be invoked once. When a controller implementation's appearance changes the implementation should call invalidate on itself.

    Parameters

    • geoCanvas: GeoCanvas

      the GeoCanvas on which the controller can draw shapes.

    Returns void

onDrawLabel

  • Callback that allows controller implementations to draw labels on the map. Note that the map may perform caching which may cause this method to only be invoked once. When a controller implementation's appearance changes the implementation should call invalidate on itself.

    Parameters

    • labelCanvas: LabelCanvas

      the LabelCanvas on which the controller can draw labels.

    Returns void

onGestureEvent

  • Called when a gesture event has been received. This method must return a HandleEventResult value to indicate if the event was handled or not, If this method returns EVENT_IGNORED, the map will be given the opportunity to perform default gesture event behaviour. If default event handling is not desired, this method should return EVENT_HANDLED. (See the Controller class description for the default behavior.)

    Parameters

    Returns HandleEventResult

    the gesture event handling result.

onKeyEvent

  • Called when a key event has been received. This method must return a HandleEventResult value to indicate if the event was handled or not, If this method returns EVENT_IGNORED, the map will be given the opportunity to perform default key event behaviour. If default event handling is not desired, this method should return EVENT_HANDLED. (See the Controller class description for the default behavior.)

    Parameters

    • keyEvent: KeyEvent

      The key event to be handled. Note that this is a KeyEvent and not a DOMEvent. You can access the corresponding DOMEvent through KeyEvent.domEvent.

    Returns HandleEventResult

    The key event handling result.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method