Class: TouchCursor

ol.interaction. TouchCursor

Handle a touch cursor to defer event position on overlay position It can be used as abstract base class used for creating subclasses. The TouchCursor interaction modifies map browser event coordinate and pixel properties to force pointer on the graphic cursor on the screen to any interaction that them.


new TouchCursor(options)

Parameters:
Name Type Description
options olx.interaction.InteractionOptions

Options

Properties
Name Type Description
className string

cursor class name

coordinate ol.coordinate

position of the cursor

buttons Array.<*>

an array of buttons

maxButtons number

maximum number of buttons (default 5)

Extends

Methods


addButton(button)

Add a button element

Parameters:
Name Type Description
button *
options.className string

button class name

options.html DOMElement | string

button content

options.click function

onclick function

options.on *

an object with

options.before boolean

addOverlay(ov)

Add an overlay to the interacton

Parameters:
Name Type Description
ov ol.Overlay
Inherited From:
Overrides:

getButtonElement(button)

Get cursor button element

Parameters:
Name Type Description
button string | number

the button className or the button index

Returns:
Type
Element

getOverlay()

Get cursor overlay

Returns:
Type
ol.Overlay

getOverlayElement()

Get cursor overlay element

Returns:
Type
Element

getPixel()

Get pixel position

Returns:
Type
ol.pixel

getPosition()

Get the position of the target

Returns:
Type
ol.coordinate

offsetPosition(coord)

Offset the target position

Parameters:
Name Type Description
coord ol.coordinate

removeButton(button)

Remove a button element

Parameters:
Name Type Description
button string | number | undefined

the button className or the button index, if undefined remove all buttons, default remove all

Returns:
Type
Element

removeOverlay(ov)

Remove an overlay from the interacton

Parameters:
Name Type Description
ov ol.Overlay
Inherited From:
Overrides:

setActive(active, position)

Activate or deactivate the interaction.

Parameters:
Name Type Description
active boolean

Active.

position ol.coordinate | null

position of the cursor (when activating), default viewport center.


setMap(map)

Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass null to just remove the interaction from the current map.

Parameters:
Name Type Description
map _ol_Map_

Map.


setPosition(coord)

Set the position of the target

Parameters:
Name Type Description
coord ol.coordinate