Skip to main content

FeatureSelectionState

What useFeatureSelection returns: the selected set as the ui shows it, and every action on it.

This is an interface exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import type { FeatureSelectionState } from "@mapcairn/map";

interface FeatureSelectionState

Properties​

entries​

readonly entries: readonly SelectedEntry[];

The selected references in selection order, each resolved against the layers (see SelectedEntry).

limit​

readonly limit: number;

The most references the store holds.

selecting​

readonly selecting: boolean;

Whether select mode is on. It is only a flag: nothing here reads it.

Methods​

add​

add(refs: readonly FeatureRef[]): void;

Selects the references that are not yet selected and belong to a feed layer. The store refuses the whole batch when it would pass its limit.

  • refs (readonly FeatureRef[])

clear​

clear(): void;

Empties the selection.

remove​

remove(refs: readonly FeatureRef[]): void;

Deselects the references that are selected. Always allowed.

  • refs (readonly FeatureRef[])

setSelecting​

setSelecting(selecting: boolean): void;

Turns select mode on or off.

  • selecting (boolean)

toggle​

toggle(ref: FeatureRef): void;

Selects the feature, or deselects it when it is selected.

  • ref (FeatureRef)

See also​

Source: packages/map/src/layers/useFeatureSelection.ts:69