@vtx/map 1.1.40 → 1.1.41
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/lib/VtxMap/OlMap/Map.js
CHANGED
|
@@ -432,10 +432,24 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
432
432
|
});
|
|
433
433
|
|
|
434
434
|
if (feature) {
|
|
435
|
-
var target = feature.getProperties();
|
|
435
|
+
var target = feature.getProperties();
|
|
436
|
+
var id = '';
|
|
437
|
+
var elementId = '';
|
|
438
|
+
|
|
439
|
+
if ((0, _lodash.isArray)(target.features)) {
|
|
440
|
+
// 处理聚合点击
|
|
441
|
+
var properties = target.features[0].getProperties();
|
|
442
|
+
id = properties.id;
|
|
443
|
+
elementId = properties.id;
|
|
444
|
+
target = target.features;
|
|
445
|
+
} else {
|
|
446
|
+
id = target.id;
|
|
447
|
+
elementId = target.element;
|
|
448
|
+
} // top: e.clientY,//当前点所在的位置(屏幕)
|
|
436
449
|
// left: e.clientX,
|
|
437
450
|
|
|
438
|
-
|
|
451
|
+
|
|
452
|
+
t.clickGraphic(id || elementId, evt, target);
|
|
439
453
|
} else {
|
|
440
454
|
t.clickMap(evt);
|
|
441
455
|
}
|
|
@@ -3299,9 +3313,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3299
3313
|
function clusterMemberStyle(clusterMember) {
|
|
3300
3314
|
var style = clusterMember.getStyle();
|
|
3301
3315
|
var image = style && style.getImage ? style.getImage() : null;
|
|
3316
|
+
var text = style && style.getText ? style.getText() : null;
|
|
3302
3317
|
return new ol.style.Style({
|
|
3303
|
-
|
|
3304
|
-
|
|
3318
|
+
image: image,
|
|
3319
|
+
text: text
|
|
3305
3320
|
});
|
|
3306
3321
|
}
|
|
3307
3322
|
|
|
@@ -3371,7 +3386,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3371
3386
|
function clusterStyle(feature) {
|
|
3372
3387
|
var size = feature.get('features').length;
|
|
3373
3388
|
|
|
3374
|
-
if (size >
|
|
3389
|
+
if (size > 2) {
|
|
3375
3390
|
return [new ol.style.Style({
|
|
3376
3391
|
image: new ol.style.Circle({
|
|
3377
3392
|
radius: 20,
|
|
@@ -3398,8 +3413,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3398
3413
|
})
|
|
3399
3414
|
})];
|
|
3400
3415
|
} else {
|
|
3401
|
-
|
|
3402
|
-
|
|
3416
|
+
return feature.get('features').map(function (originalFeature) {
|
|
3417
|
+
return clusterMemberStyle(originalFeature);
|
|
3418
|
+
});
|
|
3403
3419
|
}
|
|
3404
3420
|
}
|
|
3405
3421
|
}
|