Class: SnapGuides

ol.interaction. SnapGuides

Interaction to snap to guidelines


new SnapGuides(options)

Parameters:
Name Type Description
options *
Properties
Name Type Description
pixelTolerance number | undefined

distance (in px) to snap to a guideline, default 10 px

enableInitialGuides bool | undefined

whether to draw initial guidelines based on the maps orientation, default false.

style ol.style.Style | Array.<ol.style.Style> | undefined

Style for the sektch features.

vectorClass *

a vector layer class to create the guides with ol6, use ol/layer/VectorImage using ol6

Extends

  • ol.interaction.Interaction

Methods


addGuide(v)

Add a new guide to snap to

Parameters:
Name Type Description
v Array.<ol.coordinate>

the direction vector

Returns:

feature guide

Type
ol.Feature

addOrthoGuide(v)

Add a new orthogonal guide to snap to

Parameters:
Name Type Description
v Array.<ol.coordinate>

the direction vector

Returns:

feature guide

Type
ol.Feature

clearGuides(features)

Clear previous added guidelines

Parameters:
Name Type Description
features Array.<ol.Feature> | undefined

a list of feature to remove, default remove all feature


getGuides()

Get guidelines

Returns:

guidelines features

Type
ol.Collection

setActive(active)

Activate or deactivate the interaction.

Parameters:
Name Type Description
active boolean

setDrawInteraction(drawi)

Listen to draw event to add orthogonal guidelines on the first and last point.

Parameters:
Name Type Description
drawi _ol_interaction_Draw_

a draw interaction to listen to


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.


setModifyInteraction(modifyi)

Listen to modify event to add orthogonal guidelines relative to the currently dragged point

Parameters:
Name Type Description
modifyi _ol_interaction_Modify_

a modify interaction to listen to