Classes
Type Definitions
-
Options{Object}
-
Point: A one-dimensional segment (e.g.[[10, 20]]) representing the point.LineString: One two-dimensional segment (e.g.[[10, 20], [30, 40]]) for each segment of the linestring.Polygon: One two-dimensional segment for each segment of the exterior ring and the interior rings.Circle: One two-dimensional segment for each segment of a regular polygon with 32 points representing the circle circumference.GeometryCollection: All segments of the contained geometries.MultiPoint: One one-dimensional segment for each point.MultiLineString: One two-dimensional segment for each segment of the linestrings.MultiPolygon: One two-dimensional segment for each segment of the polygons.
Properties:
Name Type Description featuresCollection<Feature> | undefined Snap to these features. Either this option or source should be provided.
sourceVectorSource | undefined Snap to features from this source. Either this option or features should be provided
edgeboolean
(defaults to true)Snap to edges.
vertexboolean
(defaults to true)Snap to vertices.
intersectionboolean
(defaults to false)Snap to intersections between segments.
pixelTolerancenumber
(defaults to 10)Pixel tolerance for considering the pointer close enough to a segment or vertex for snapping.
segmentersSegmenters | undefined Custom segmenters by
Type. By default, the following segmenters are used: -
Segment{Array<Coordinate>}
-
An array of two coordinates representing a line segment, or an array of one coordinate representing a point.
-
SegmentData{Object}
-
-
Segmenters{Object}
-
Each segmenter specified here will override the default segmenter for the corresponding geometry type. To exclude all geometries of a specific geometry type from being snapped to, set the segmenter to
null.Properties:
Name Type Description PointSegmenter<Point> | null | undefined Point segmenter.
LineStringSegmenter<LineString> | null | undefined LineString segmenter.
PolygonSegmenter<Polygon> | null | undefined Polygon segmenter.
CircleSegmenter<Circle> | null | undefined Circle segmenter.
GeometryCollectionSegmenter<GeometryCollection> | null | undefined GeometryCollection segmenter.
MultiPointSegmenter<MultiPoint> | null | undefined MultiPoint segmenter.
MultiLineStringSegmenter<MultiLineString> | null | undefined MultiLineString segmenter.
MultiPolygonSegmenter<MultiPolygon> | null | undefined MultiPolygon segmenter.
-
SnappedInfo{Object}
-
Information about the last snapped state.
Properties:
Name Type Description vertexCoordinate | null The snapped vertex.
vertexPixelPixel | null The pixel of the snapped vertex.
featureFeature | null The feature being snapped.
segmentSegment | null Segment, or
nullif snapped to a vertex.