Selection plugin API

This reference describes the API of the Selection plugin.

The Selection plugin adds a mechanism for interactive selection of individual or multiple markers. See the Using selection plugin section for a high-level overview and basic code examples.

Properties

selection:selection

Array of currently selected points.

By default, the Selection plugin operates on points contained in the active layer, which by default is the bottom-most markers layer. When you get the value of the selection:selection property, you will receive an array of point instances corresponding to the currently selected active layer points.

When setting the selection:selection property, make sure you pass an array of references to point instances contained in the active layer. Points not belonging to the active layer will be ignored.

selection:hover

Array of points under the mouse pointer and ready for selection.

selection:mode

Determines the selection mode.

The selection mode determines which markers are included in the selection hover layer given the current position of the mouse pointer.

The selection:mode property supports the following values:

single

The hover layer contains a single marker that is closest to the current mouse pointer location.

circle

The hover layer contains all markers lying within a specified circle around the current mouse pointer location. The radius of the circle can be specified using the selection:clusterRadius property.

cluster

The hover layer contains all markers lying in the densely-populated region of the map determined by the current mouse pointer location. The size of the region can be adjusted using the selection:clusterRadius property.

selection:clusterRadius

Determines the selection size in the circle and cluster selection modes.

The larger the value of this property, the larger the number of points highlighted for selection.

selection:activeLayerProvider

Determines the layer whose points will be made selectable by this plugin.

Value of this property must be a function that returns the active layer given an array of all currently available layers. The default implementation of the active layer provider function returns the first (bottom-most) markers layer:

layers => layers.find(l => l.get("type") === "marker");

selection:layer:hoverOutline

The hover outline layer object.

This property is useful if you'd like to modify some visual properties of the hover outline layer added by this plugin:

dotAtlas.get("selection:layer:hoverOutline").set({
  "outlineFillColor": "hsla(40, 75%, 80%, 0.5)",
  "outlineBorderWidth": 0.65
});

selection:layer:hoverMarkers

The hover markers layer object.

Use this property to modify visual properties of the hover markers layer added by this plugin.

selection:layer:selectionOutline

The selection markers layer object.

Use this property to modify visual properties of the selection markers layer added by this plugin.

Events

selection:onSelectionChanged

Triggered after the selection has been changed by the user.

In addition to the common event details properties, this event comes with the following additional properties:

points

An array of point objects corresponding to the current selection.

Please note that this event will not be triggered when the selection was changed programmatically using the selection:selection property.

selection:onMouseMove

An enhanced version of the onMouseMove event with a list of points highlighted for selection.

In addition to the common event details properties, this event comes with the following additional properties:

points

An array of points highlighted for selection.

Please note that the set of highlighted points may also change as a result of selection:clusterRadius and selection:mode change. In those cases the selection:onMouseMove will not be triggered.

selection:onClusterRadiusChanged

An enhanced version of the onMouseWheel event with information about the cluster radius value.

In addition to the common event details properties, this event comes with the following additional properties:

clusterRadius

Current value of cluster radius.

Please note that this event will not be triggered when the selection was changed programmatically using the selection:clusterRadius property.