map-ol-utils 0.1.15 → 0.1.17

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 CHANGED
@@ -419,7 +419,7 @@ var buildMassMarksStyles = (getImgUrlFn) => {
419
419
  });
420
420
  const activeImage = getMarkerUrl(`${markerIcon}-${i}-active`, ".webp");
421
421
  massMarksStyles[i + statusNum] = new import_style.Style({
422
- zIndex: 102,
422
+ zIndex: 120,
423
423
  image: new import_style.Icon({
424
424
  width: x * activeScale,
425
425
  height: y * activeScale,
@@ -552,11 +552,12 @@ var addMassMarksLayer = (getImgUrlFn) => {
552
552
  isAutoFit,
553
553
  statusNum,
554
554
  markerIcon,
555
+ marksStyles,
555
556
  markerSize,
556
557
  activeScale,
557
558
  vectorConfig
558
559
  } = iconConfig;
559
- const massMarksStyles = buildMassMarksStyles(getImgUrlFn)({
560
+ const massMarksStyles = marksStyles ? marksStyles : buildMassMarksStyles(getImgUrlFn)({
560
561
  baseUrl,
561
562
  markerIcon,
562
563
  markerSize,
@@ -650,7 +651,14 @@ var createOverlay = (config = { id: "popup-container", positioning: "top-center"
650
651
  var createClusterLayer = (dataList, config) => {
651
652
  const count = dataList.length;
652
653
  const styleCache = {};
653
- const { distance, minDistance, openClick, buildStyle, singleStyles, computedRadius } = config;
654
+ const {
655
+ distance,
656
+ minDistance,
657
+ openClick,
658
+ buildStyle,
659
+ singleStyles,
660
+ computedRadius
661
+ } = config;
654
662
  const innerComputedRadius = (size) => Math.pow(size / count, 1 / 18);
655
663
  styleCache[1] = singleStyles;
656
664
  const innerBuildStyle = (feature) => {
@@ -681,7 +689,7 @@ var createClusterLayer = (dataList, config) => {
681
689
  }
682
690
  if (Array.isArray(style)) {
683
691
  const tempFeature = feature.get("features")[0];
684
- const index = tempFeature.get("styleIndex");
692
+ const index = tempFeature.get("styleIndex") || 0;
685
693
  tempFeature.setProperties({
686
694
  unActiveStyle: style[index],
687
695
  activeStyle: style[index + style.length / 2]
package/dist/index.d.cts CHANGED
@@ -77,6 +77,7 @@ type IconConfig = {
77
77
  markerIcon: string;
78
78
  activeScale?: number;
79
79
  isAutoFit?: boolean;
80
+ marksStyles?: Style[];
80
81
  vectorConfig?: VectorConfig;
81
82
  markerSize: [number, number];
82
83
  };
package/dist/index.d.ts CHANGED
@@ -77,6 +77,7 @@ type IconConfig = {
77
77
  markerIcon: string;
78
78
  activeScale?: number;
79
79
  isAutoFit?: boolean;
80
+ marksStyles?: Style[];
80
81
  vectorConfig?: VectorConfig;
81
82
  markerSize: [number, number];
82
83
  };
package/dist/index.js CHANGED
@@ -70,7 +70,13 @@ import VectorSource from "ol/source/Vector";
70
70
  import { Point } from "ol/geom";
71
71
  import { singleClick } from "ol/events/condition";
72
72
  import { boundingExtent, getCenter } from "ol/extent";
73
- import { Icon, Text, Fill, Style, Stroke } from "ol/style";
73
+ import {
74
+ Icon,
75
+ Text,
76
+ Fill,
77
+ Style,
78
+ Stroke
79
+ } from "ol/style";
74
80
  var removeOverlays = (key = "") => {
75
81
  if (instance) {
76
82
  const overlays = instance.getOverlays().getArray().filter((overlay) => overlay.get(key || "position"));
@@ -352,7 +358,7 @@ var buildMassMarksStyles = (getImgUrlFn) => {
352
358
  });
353
359
  const activeImage = getMarkerUrl(`${markerIcon}-${i}-active`, ".webp");
354
360
  massMarksStyles[i + statusNum] = new Style({
355
- zIndex: 102,
361
+ zIndex: 120,
356
362
  image: new Icon({
357
363
  width: x * activeScale,
358
364
  height: y * activeScale,
@@ -485,11 +491,12 @@ var addMassMarksLayer = (getImgUrlFn) => {
485
491
  isAutoFit,
486
492
  statusNum,
487
493
  markerIcon,
494
+ marksStyles,
488
495
  markerSize,
489
496
  activeScale,
490
497
  vectorConfig
491
498
  } = iconConfig;
492
- const massMarksStyles = buildMassMarksStyles(getImgUrlFn)({
499
+ const massMarksStyles = marksStyles ? marksStyles : buildMassMarksStyles(getImgUrlFn)({
493
500
  baseUrl,
494
501
  markerIcon,
495
502
  markerSize,
@@ -583,7 +590,14 @@ var createOverlay = (config = { id: "popup-container", positioning: "top-center"
583
590
  var createClusterLayer = (dataList, config) => {
584
591
  const count = dataList.length;
585
592
  const styleCache = {};
586
- const { distance, minDistance, openClick, buildStyle, singleStyles, computedRadius } = config;
593
+ const {
594
+ distance,
595
+ minDistance,
596
+ openClick,
597
+ buildStyle,
598
+ singleStyles,
599
+ computedRadius
600
+ } = config;
587
601
  const innerComputedRadius = (size) => Math.pow(size / count, 1 / 18);
588
602
  styleCache[1] = singleStyles;
589
603
  const innerBuildStyle = (feature) => {
@@ -614,7 +628,7 @@ var createClusterLayer = (dataList, config) => {
614
628
  }
615
629
  if (Array.isArray(style)) {
616
630
  const tempFeature = feature.get("features")[0];
617
- const index = tempFeature.get("styleIndex");
631
+ const index = tempFeature.get("styleIndex") || 0;
618
632
  tempFeature.setProperties({
619
633
  unActiveStyle: style[index],
620
634
  activeStyle: style[index + style.length / 2]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "map-ol-utils",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "description": "Openlayers utils library",
6
6
  "files": [