Class: TouchCursorDraw

ol.interaction. TouchCursorDraw

TouchCursor interaction + ModifyFeature


new TouchCursorDraw(options)

Parameters:
Name Type Description
options olx.interaction.InteractionOptions

Options

Properties
Name Type Description
className string

cursor class name

coordinate ol.coordinate

cursor position

type string

geometry type

types Array.<string>

geometry types avaliable, default none

source ol.source.Vector

Destination source for the drawn features

features ol.Collection.<ol.Feature>

Destination collection for the drawn features

clickTolerance number

The maximum distance in pixels for "click" event to add a point/vertex to the geometry being drawn. default 6

snapTolerance number

Pixel distance for snapping to the drawing finish, default 12

maxPoints number

The number of points that can be drawn before a polygon ring or line string is finished. By default there is no restriction.

minPoints number

The number of points that must be drawn before a polygon ring or line string can be finished. Default is 3 for polygon rings and 2 for line strings.

style ol.style.Style

Style for sketch features.

geometryFunction function

Function that is called when a geometry's coordinates are updated.

geometryName string

Geometry name to use for features created by the draw interaction.

wrapX boolean

Wrap the world horizontally on the sketch overlay, default false

Fires:
  • event:drawend
  • change:type

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
Inherited From:
Overrides:

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

Inherited From:
Overrides:
Returns:
Type
Element

getOverlay()

Get cursor overlay

Inherited From:
Overrides:
Returns:
Type
ol.Overlay

getOverlayElement()

Get cursor overlay element

Inherited From:
Overrides:
Returns:
Type
Element

getPixel()

Get pixel position

Inherited From:
Overrides:
Returns:
Type
ol.pixel

getPosition()

Get the position of the target

Inherited From:
Overrides:
Returns:
Type
ol.coordinate

getType()

Get geometry type


offsetPosition(coord)

Offset the target position

Parameters:
Name Type Description
coord ol.coordinate
Inherited From:
Overrides:

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

Inherited From:
Overrides:
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.

Overrides:

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.

Overrides:

setPosition(coord)

Set the position of the target

Parameters:
Name Type Description
coord ol.coordinate
Inherited From:
Overrides:

setType(type)

Set Geometry type

Parameters:
Name Type Description
type string

Geometry type