map-ol-utils 0.1.10 → 0.1.11
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/dist/index.cjs +15 -5
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -144,9 +144,7 @@ var removeOverlays = (key = "") => {
|
|
|
144
144
|
overlays.forEach((overlay) => instance.removeOverlay(overlay));
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
|
-
var removeAnimationMarker = () =>
|
|
148
|
-
removeOverlays("_isAnimationMarker");
|
|
149
|
-
};
|
|
147
|
+
var removeAnimationMarker = () => removeOverlays("_isAnimationMarker");
|
|
150
148
|
var createAnimationMarker = (imgUrl, data) => {
|
|
151
149
|
removeAnimationMarker();
|
|
152
150
|
const { width, height, lnglat, crsForm } = data;
|
|
@@ -636,7 +634,7 @@ var createOverlay = (config = { id: "popup-container", positioning: "top-center"
|
|
|
636
634
|
var createClusterLayer = (dataList, config) => {
|
|
637
635
|
const count = dataList.length;
|
|
638
636
|
const styleCache = {};
|
|
639
|
-
const { distance, minDistance, buildStyle, singleStyles, computedRadius } = config;
|
|
637
|
+
const { distance, minDistance, openClick, buildStyle, singleStyles, computedRadius } = config;
|
|
640
638
|
const innerComputedRadius = (size) => Math.pow(size / count, 1 / 18);
|
|
641
639
|
styleCache[1] = singleStyles;
|
|
642
640
|
const innerBuildStyle = (feature) => {
|
|
@@ -668,11 +666,15 @@ var createClusterLayer = (dataList, config) => {
|
|
|
668
666
|
if (Array.isArray(style)) {
|
|
669
667
|
const tempFeature = feature.get("features")[0];
|
|
670
668
|
const index = tempFeature.get("styleIndex");
|
|
669
|
+
tempFeature.setProperties({
|
|
670
|
+
unActiveStyle: style[index],
|
|
671
|
+
activeStyle: style[index + style.length / 2]
|
|
672
|
+
});
|
|
671
673
|
return style[index];
|
|
672
674
|
}
|
|
673
675
|
return style;
|
|
674
676
|
};
|
|
675
|
-
|
|
677
|
+
const vectorLayer = new import_Vector.default({
|
|
676
678
|
zIndex: 200,
|
|
677
679
|
style: (feature) => buildStyle ? buildStyle(feature) : innerBuildStyle(feature),
|
|
678
680
|
source: new import_Cluster.default({
|
|
@@ -687,6 +689,14 @@ var createClusterLayer = (dataList, config) => {
|
|
|
687
689
|
})
|
|
688
690
|
})
|
|
689
691
|
});
|
|
692
|
+
vectorLayer.setProperties({
|
|
693
|
+
_isCustom: true,
|
|
694
|
+
_isVectorLayer: true
|
|
695
|
+
});
|
|
696
|
+
if (openClick) {
|
|
697
|
+
createSelectByLayer(vectorLayer);
|
|
698
|
+
}
|
|
699
|
+
return vectorLayer;
|
|
690
700
|
};
|
|
691
701
|
|
|
692
702
|
// src/create-map.ts
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -77,9 +77,7 @@ var removeOverlays = (key = "") => {
|
|
|
77
77
|
overlays.forEach((overlay) => instance.removeOverlay(overlay));
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
var removeAnimationMarker = () =>
|
|
81
|
-
removeOverlays("_isAnimationMarker");
|
|
82
|
-
};
|
|
80
|
+
var removeAnimationMarker = () => removeOverlays("_isAnimationMarker");
|
|
83
81
|
var createAnimationMarker = (imgUrl, data) => {
|
|
84
82
|
removeAnimationMarker();
|
|
85
83
|
const { width, height, lnglat, crsForm } = data;
|
|
@@ -569,7 +567,7 @@ var createOverlay = (config = { id: "popup-container", positioning: "top-center"
|
|
|
569
567
|
var createClusterLayer = (dataList, config) => {
|
|
570
568
|
const count = dataList.length;
|
|
571
569
|
const styleCache = {};
|
|
572
|
-
const { distance, minDistance, buildStyle, singleStyles, computedRadius } = config;
|
|
570
|
+
const { distance, minDistance, openClick, buildStyle, singleStyles, computedRadius } = config;
|
|
573
571
|
const innerComputedRadius = (size) => Math.pow(size / count, 1 / 18);
|
|
574
572
|
styleCache[1] = singleStyles;
|
|
575
573
|
const innerBuildStyle = (feature) => {
|
|
@@ -601,11 +599,15 @@ var createClusterLayer = (dataList, config) => {
|
|
|
601
599
|
if (Array.isArray(style)) {
|
|
602
600
|
const tempFeature = feature.get("features")[0];
|
|
603
601
|
const index = tempFeature.get("styleIndex");
|
|
602
|
+
tempFeature.setProperties({
|
|
603
|
+
unActiveStyle: style[index],
|
|
604
|
+
activeStyle: style[index + style.length / 2]
|
|
605
|
+
});
|
|
604
606
|
return style[index];
|
|
605
607
|
}
|
|
606
608
|
return style;
|
|
607
609
|
};
|
|
608
|
-
|
|
610
|
+
const vectorLayer = new VectorLayer({
|
|
609
611
|
zIndex: 200,
|
|
610
612
|
style: (feature) => buildStyle ? buildStyle(feature) : innerBuildStyle(feature),
|
|
611
613
|
source: new Cluster({
|
|
@@ -620,6 +622,14 @@ var createClusterLayer = (dataList, config) => {
|
|
|
620
622
|
})
|
|
621
623
|
})
|
|
622
624
|
});
|
|
625
|
+
vectorLayer.setProperties({
|
|
626
|
+
_isCustom: true,
|
|
627
|
+
_isVectorLayer: true
|
|
628
|
+
});
|
|
629
|
+
if (openClick) {
|
|
630
|
+
createSelectByLayer(vectorLayer);
|
|
631
|
+
}
|
|
632
|
+
return vectorLayer;
|
|
623
633
|
};
|
|
624
634
|
|
|
625
635
|
// src/create-map.ts
|