@wenle_2523097/agri-map 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -1
- package/dist/index.css +3867 -836
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +13595 -4147
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13669 -4172
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +13671 -4175
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -184,6 +184,69 @@ const markers: MarkerData[] = [
|
|
|
184
184
|
| `onCreate` | `(result) => void` | - | 新建回调 |
|
|
185
185
|
| `onMove` | `(result) => void` | - | 移动回调 |
|
|
186
186
|
| `onDelete` | `(result) => void` | - | 删除回调 |
|
|
187
|
+
| `cluster` | `boolean \| MarkerClusterConfig` | `false` | 聚合配置 |
|
|
188
|
+
| `onClusterClick` | `(count, markers) => void` | - | 聚合气泡点击回调 |
|
|
189
|
+
| `icons` | `MarkerIconsConfig` | - | 统一图标配置 |
|
|
190
|
+
|
|
191
|
+
#### 聚合功能
|
|
192
|
+
|
|
193
|
+
Marker 组件支持标注点聚合,在小缩放级别下将相近的标注点聚合为气泡显示,提升大量标注点时的渲染性能。
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
// 启用默认聚合
|
|
197
|
+
<Marker
|
|
198
|
+
dataSource={markers}
|
|
199
|
+
cluster={true}
|
|
200
|
+
/>
|
|
201
|
+
|
|
202
|
+
// 自定义聚合配置
|
|
203
|
+
<Marker
|
|
204
|
+
dataSource={markers}
|
|
205
|
+
cluster={{
|
|
206
|
+
radius: 60, // 聚合半径(像素),默认 40
|
|
207
|
+
maxZoom: 16, // 最大聚合 zoom 级别,默认 18
|
|
208
|
+
minPoints: 3, // 最小聚合点数,默认 2
|
|
209
|
+
onClickBehavior: 'expand', // 点击行为:'zoom' 或 'expand'
|
|
210
|
+
}}
|
|
211
|
+
onClusterClick={(count, markers) => {
|
|
212
|
+
console.log(`点击了包含 ${count} 个点的聚合`);
|
|
213
|
+
}}
|
|
214
|
+
/>
|
|
215
|
+
|
|
216
|
+
// 自定义聚合气泡图标
|
|
217
|
+
<Marker
|
|
218
|
+
dataSource={markers}
|
|
219
|
+
cluster={true}
|
|
220
|
+
icons={{
|
|
221
|
+
cluster: {
|
|
222
|
+
icon: 'marker-yellow',
|
|
223
|
+
colors: ['#1890ff', '#faad14', '#ff4d4f'],
|
|
224
|
+
animated: true,
|
|
225
|
+
showCount: true,
|
|
226
|
+
},
|
|
227
|
+
default: { icon: 'point', iconSize: [32, 32] },
|
|
228
|
+
selected: { icon: 'position-red' },
|
|
229
|
+
}}
|
|
230
|
+
/>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### MarkerClusterConfig
|
|
234
|
+
|
|
235
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
236
|
+
|------|------|--------|------|
|
|
237
|
+
| `radius` | `number` | `40` | 聚合半径(像素) |
|
|
238
|
+
| `maxZoom` | `number` | `18` | 聚合生效的最大 zoom 级别 |
|
|
239
|
+
| `minPoints` | `number` | `2` | 最小聚合点数 |
|
|
240
|
+
| `onClickBehavior` | `'zoom' \| 'expand'` | `'zoom'` | 点击聚合气泡后的行为 |
|
|
241
|
+
|
|
242
|
+
#### MarkerIconsConfig
|
|
243
|
+
|
|
244
|
+
| 属性 | 类型 | 说明 |
|
|
245
|
+
|------|------|------|
|
|
246
|
+
| `default` | `MarkerIconItemConfig` | 默认状态图标配置 |
|
|
247
|
+
| `selected` | `MarkerIconItemConfig` | 选中状态图标配置 |
|
|
248
|
+
| `editing` | `MarkerIconItemConfig` | 编辑中状态图标配置 |
|
|
249
|
+
| `cluster` | `ClusterIconConfig` | 聚合气泡图标配置 |
|
|
187
250
|
|
|
188
251
|
---
|
|
189
252
|
|
|
@@ -343,7 +406,7 @@ import { ConfigProvider } from 'agri-map';
|
|
|
343
406
|
```tsx
|
|
344
407
|
import {
|
|
345
408
|
Icons,
|
|
346
|
-
|
|
409
|
+
PlotRedrawIcon,
|
|
347
410
|
ClipIcon,
|
|
348
411
|
MoveIcon,
|
|
349
412
|
DeleteIcon,
|