Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CustomSnap

Hierarchy

  • Snap
    • CustomSnap

Index

Constructors

constructor

Methods

addEventListener

  • addEventListener(type: string, listener: Listener): void
  • Parameters

    • type: string

      Type.

    • listener: Listener

      Listener.

    Returns void

addFeature

  • addFeature(feature: any, opt_listen?: boolean | undefined): void
  • Add a feature to the collection of features that we may snap to.

    api

    Parameters

    • feature: any

      Feature.

    • Optional opt_listen: boolean | undefined

      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: BaseEvent | string): boolean | undefined
  • 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: BaseEvent | string

      Event object.

    Returns boolean | undefined

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

dispose

  • dispose(): void
  • Clean up.

    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(): Array<string>
  • Get a list of object property names.

    api

    Returns Array<string>

    List of property names.

getListeners

  • getListeners(type: string): Array<Listener> | undefined
  • 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 Array<Listener> | undefined

    Listeners.

getMap

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

    api

    Returns PluggableMap

    Map.

getPointerCount

  • getPointerCount(): number
  • Returns the current number of pointers involved in the interaction, e.g. 2 when two fingers are used.

    api

    Returns number

    The number of pointers.

getProperties

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

    api

    Returns {}

    Object.

    • [x: string]: any

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(mapBrowserEvent: any): boolean
  • Handles the {@link module:ol/MapBrowserEvent map browser event}.

    api

    Parameters

    • mapBrowserEvent: any

      Map browser event.

    Returns boolean

    false to stop event propagation.

hasListener

  • hasListener(opt_type?: string | undefined): boolean
  • Parameters

    • Optional opt_type: string | undefined

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

    Returns boolean

    Has listeners.

hasProperties

  • hasProperties(): boolean
  • Returns boolean

    The object has properties.

notify

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

    • key: string

      Key name.

    • oldValue: any

      Old value.

    Returns void

on

  • on(type: string | Array<string>, listener: (arg0: unknown) => unknown): { listener: ListenerFunction; target: EventTargetLike; type: string } | Array<{ listener: ListenerFunction; target: EventTargetLike; type: string }>
  • Listen for a certain type of event.

    api

    Parameters

    • type: string | Array<string>

      The event type or array of event types.

    • listener: (arg0: unknown) => unknown

      The listener function.

        • (arg0: unknown): unknown
        • Parameters

          • arg0: unknown

          Returns unknown

    Returns { listener: ListenerFunction; target: EventTargetLike; type: string } | Array<{ listener: ListenerFunction; target: EventTargetLike; type: string }>

    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 | Array<string>, listener: (arg0: unknown) => unknown): { listener: ListenerFunction; target: EventTargetLike; type: string } | Array<{ listener: ListenerFunction; target: EventTargetLike; type: string }>
  • Listen once for a certain type of event.

    api

    Parameters

    • type: string | Array<string>

      The event type or array of event types.

    • listener: (arg0: unknown) => unknown

      The listener function.

        • (arg0: unknown): unknown
        • Parameters

          • arg0: unknown

          Returns unknown

    Returns { listener: ListenerFunction; target: EventTargetLike; type: string } | Array<{ listener: ListenerFunction; target: EventTargetLike; type: string }>

    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: Listener): void
  • Parameters

    • type: string

      Type.

    • listener: Listener

      Listener.

    Returns void

removeFeature

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

    api

    Parameters

    • feature: any

      Feature

    • Optional opt_unlisten: boolean | undefined

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

    Returns void

set

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

    api

    Parameters

    • key: string

      Key name.

    • value: any

      Value.

    • Optional opt_silent: boolean | undefined

      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: PluggableMap): void
  • Remove the interaction from its current map and attach it to the new map. Subclasses may set up event handlers to get notified about changes to the map here.

    Parameters

    • map: PluggableMap

      Map.

    Returns void

setProperties

  • setProperties(values: {}, opt_silent?: boolean | undefined): 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: {}

      Values.

      • [x: string]: any
    • Optional opt_silent: boolean | undefined

      Update without triggering an event.

    Returns void

snapTo

  • snapTo(pixel: Array, pixelCoordinate: Array, map: PluggableMap): Result
  • Parameters

    • pixel: Array

      Pixel

    • pixelCoordinate: Array

      Coordinate

    • map: PluggableMap

      Map.

    Returns Result

    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 | Array<string>, listener: (arg0: unknown) => unknown): void
  • Unlisten for a certain type of event.

    api

    Parameters

    • type: string | Array<string>

      The event type or array of event types.

    • listener: (arg0: unknown) => unknown

      The listener function.

        • (arg0: unknown): unknown
        • Parameters

          • arg0: unknown

          Returns unknown

    Returns void

unset

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

    api

    Parameters

    • key: string

      Key name.

    • Optional opt_silent: boolean | undefined

      Unset without triggering an event.

    Returns void

Generated using TypeDoc