You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Select features or place markers on the map. The interact plugin provides a unified way to handle user interactions for selecting map features or placing location markers.
3
+
The interact plugin provides a unified way to handle user interactions for selecting map features or placing location markers.
@@ -34,20 +40,136 @@ Array of mode identifiers. When set, the plugin does not render when the app is
34
40
35
41
---
36
42
43
+
### `interactionMode`
44
+
**Type:**`'marker' | 'select' | 'auto'`
45
+
**Default:**`'marker'`
46
+
47
+
Controls how user clicks are interpreted.
48
+
49
+
-`'marker'` — clicking always places a location marker at the clicked coordinates
50
+
-`'select'` — clicking attempts to match a feature from `dataLayers`; click outside clears selection (unless `deselectOnClickOutside` is `false`)
51
+
-`'auto'` — attempts feature matching first, falls back to placing a marker if no feature is found
52
+
53
+
---
54
+
55
+
### `dataLayers`
56
+
**Type:**`Array<DataLayer>`
57
+
**Default:**`[]`
58
+
59
+
Array of map layer configurations that are selectable. Each entry specifies which layer to watch and how to identify features.
60
+
61
+
```js
62
+
dataLayers: [
63
+
{ layerId:'my-polygons', idProperty:'id' },
64
+
{ layerId:'my-lines' }
65
+
]
66
+
```
67
+
68
+
#### `DataLayer` properties
69
+
70
+
| Property | Type | Description |
71
+
|----------|------|-------------|
72
+
|`layerId`|`string`|**Required.** The map layer identifier to enable selection on |
73
+
|`idProperty`|`string`| Property name used as the feature's unique identifier. If omitted, features are matched by index |
74
+
|`selectedStroke`|`string`| Overrides the global `selectedStroke` for this layer |
75
+
|`selectedFill`|`string`| Overrides the global `selectedFill` for this layer |
76
+
|`selectedStrokeWidth`|`number`| Overrides the global `selectedStrokeWidth` for this layer |
77
+
78
+
---
79
+
80
+
### `multiSelect`
81
+
**Type:**`boolean`
82
+
**Default:**`false`
83
+
84
+
When `true`, clicking additional features adds them to the selection rather than replacing it.
85
+
86
+
---
87
+
88
+
### `contiguous`
89
+
**Type:**`boolean`
90
+
**Default:**`false`
91
+
92
+
When `true`, only features that touch or overlap the existing selection can be added. Uses spatial intersection to determine contiguity. Works with polygons, lines, and points.
93
+
94
+
---
95
+
96
+
### `deselectOnClickOutside`
97
+
**Type:**`boolean`
98
+
**Default:**`false`
99
+
100
+
When `true`, clicking outside any selectable layer clears the current selection.
101
+
102
+
---
103
+
104
+
### `tolerance`
105
+
**Type:**`number`
106
+
**Default:**`10`
107
+
108
+
Click detection radius in pixels. Increases the hit area around the cursor when matching features, which is useful for lines and points.
109
+
110
+
---
111
+
112
+
### `closeOnAction`
113
+
**Type:**`boolean`
114
+
**Default:**`true`
115
+
116
+
When `true`, the app closes after the user clicks "Done" or "Cancel".
117
+
118
+
---
119
+
120
+
### `markerColor`
121
+
**Type:**`string`
122
+
**Default:**`'rgba(212,53,28,1)'`
123
+
124
+
Color of the location marker placed on the map.
125
+
126
+
---
127
+
128
+
### `selectedStroke`
129
+
**Type:**`string`
130
+
**Default:**`'rgba(212,53,28,1)'`
131
+
132
+
Stroke color used to highlight selected features. Can be overridden per layer via `dataLayers`.
133
+
134
+
---
135
+
136
+
### `selectedFill`
137
+
**Type:**`string`
138
+
**Default:**`'rgba(255, 0, 0, 0.1)'`
139
+
140
+
Fill color used to highlight selected features. Can be overridden per layer via `dataLayers`.
141
+
142
+
---
143
+
144
+
### `selectedStrokeWidth`
145
+
**Type:**`number`
146
+
**Default:**`2`
147
+
148
+
Stroke width used to highlight selected features. Can be overridden per layer via `dataLayers`.
149
+
150
+
---
151
+
37
152
## Methods
38
153
39
154
Methods are called on the plugin instance after the map is ready.
40
155
41
156
---
42
157
43
-
### `enable()`
158
+
### `enable(options?)`
159
+
160
+
Enable interaction mode. Shows action buttons and enables feature selection or marker placement. Accepts an optional options object to override any of the factory options at runtime.
44
161
45
-
Enable interaction mode. Shows action buttons and enables feature selection or marker placement.
162
+
| Parameter | Type | Description |
163
+
|-----------|------|-------------|
164
+
|`options`|`Object`| Optional. Any factory options to apply for this session |
0 commit comments