Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CustomSnap

Hierarchy

  • Snap
    • CustomSnap

Index

Constructors

constructor

Methods

addEventListener

  • addEventListener(type: string, listener: {}): void
  • Parameters

    • type: string

      Type.

    • listener: {}

      Listener.

    Returns void

addFeature

  • addFeature(feature: Feature<any>, opt_listen: boolean): void
  • Add a feature to the collection of features that we may snap to.

    api

    Parameters

    • feature: Feature<any>

      Feature.

    • opt_listen: boolean

      Whether to listen to the feature change or not Defaults to true.

    Returns void

changed

  • changed(): void
  • Increases the revision counter and dispatches a 'change' event.

    api

    Returns void

dispatchEvent

  • dispatchEvent(event: string | BaseEvent | { propagationStopped: boolean; target: Target | EventTarget; type: string }): boolean
  • Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a type property.

    api

    Parameters

    • event: string | BaseEvent | { propagationStopped: boolean; target: Target | EventTarget; type: string }

    Returns boolean

    false if anyone called preventDefault on the event object or if any of the listeners returned false.

dispose

  • dispose(): void
  • Clean up.

    Returns void

disposeInternal

  • disposeInternal(): void
  • inheritdoc

    Returns void

get

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

    api

    Parameters

    • key: string

      Key name.

    Returns any

    Value.

getActive

  • getActive(): boolean
  • Return whether the interaction is currently active.

    observable
    api

    Returns boolean

    true if the interaction is active, false otherwise.

getKeys

  • getKeys(): string[]
  • Get a list of object property names.

    api

    Returns string[]

    List of property names.

getListeners

  • getListeners(type: string): {}[]
  • Get the listeners for a specified event type. Listeners are returned in the order that they will be called in.

    Parameters

    • type: string

      Type.

    Returns {}[]

    Listeners.

getMap

  • getMap(): PluggableMap
  • Get the map associated with this interaction.

    api

    Returns PluggableMap

    Map.

getProperties

  • getProperties(): Object
  • Get an object of all property names and values.

    api

    Returns Object

    Object.

getRevision

  • getRevision(): number
  • Get the version number for this object. Each time the object is modified, its version number will be incremented.

    api

    Returns number

    Revision.

handleEvent

  • handleEvent(evt: any): boolean
  • inheritdoc

    Parameters

    • evt: any

    Returns boolean

handleUpEvent

  • handleUpEvent(evt: any): boolean
  • inheritdoc

    Parameters

    • evt: any

    Returns boolean

hasListener

  • hasListener(opt_type: string): boolean
  • Parameters

    • opt_type: string

      Type. If not provided, true will be returned if this event target has any listeners.

    Returns boolean

    Has listeners.

notify

  • notify(key: string, oldValue: any): void
  • Parameters

    • key: string

      Key name.

    • oldValue: any

      Old value.

    Returns void

on

  • on(type: string | string[], listener: {}): {} | {}[]
  • Listen for a certain type of event.

    api

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: {}

      The listener function.

    Returns {} | {}[]

    Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.

once

  • once(type: string | string[], listener: {}): {} | {}[]
  • Listen once for a certain type of event.

    api

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: {}

      The listener function.

    Returns {} | {}[]

    Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.

removeEventListener

  • removeEventListener(type: string, listener: {}): void
  • Parameters

    • type: string

      Type.

    • listener: {}

      Listener.

    Returns void

removeFeature

  • removeFeature(feature: Feature<any>, opt_unlisten: boolean): void
  • Remove a feature from the collection of features that we may snap to.

    api

    Parameters

    • feature: Feature<any>

      Feature

    • opt_unlisten: boolean

      Whether to unlisten to the feature change or not. Defaults to true.

    Returns void

set

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

    api

    Parameters

    • key: string

      Key name.

    • value: any

      Value.

    • opt_silent: boolean

      Update without triggering an event.

    Returns void

setActive

  • setActive(active: boolean): void
  • Activate or deactivate the interaction.

    observable
    api

    Parameters

    • active: boolean

      Active.

    Returns void

setMap

  • setMap(map: any): void
  • inheritdoc

    Parameters

    • map: any

    Returns void

setProperties

  • setProperties(values: Object, opt_silent: boolean): void
  • Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).

    api

    Parameters

    • values: Object

      Values.

    • opt_silent: boolean

      Update without triggering an event.

    Returns void

snapTo

  • snapTo(pixel: number[], pixelCoordinate: number[], map: PluggableMap): {}
  • Parameters

    • pixel: number[]

      Pixel

    • pixelCoordinate: number[]

      Coordinate

    • map: PluggableMap

      Map.

    Returns {}

    Snap result

stopDown

  • stopDown(handled: boolean): boolean
  • This function is used to determine if "down" events should be propagated to other interactions or should be stopped.

    Parameters

    • handled: boolean

      Was the event handled by the interaction?

    Returns boolean

    Should the down event be stopped?

un

  • un(type: string | string[], listener: {}): void
  • Unlisten for a certain type of event.

    api

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: {}

      The listener function.

    Returns void

unset

  • unset(key: string, opt_silent: boolean): void
  • Unsets a property.

    api

    Parameters

    • key: string

      Key name.

    • opt_silent: boolean

      Unset without triggering an event.

    Returns void

Generated using TypeDoc