@kizmann/pico-js 0.3.15 → 0.3.16
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/pico-js.js +1 -1
- package/dist/pico-js.js.map +1 -1
- package/package.json +1 -1
- package/src/library/map.js +11 -5
package/package.json
CHANGED
package/src/library/map.js
CHANGED
@@ -16,6 +16,8 @@ export default class Map
|
|
16
16
|
|
17
17
|
cluster = null;
|
18
18
|
|
19
|
+
clusterFilter = null;
|
20
|
+
|
19
21
|
clusterOptions = {};
|
20
22
|
|
21
23
|
static hideMarkers = true;
|
@@ -115,18 +117,22 @@ export default class Map
|
|
115
117
|
}
|
116
118
|
|
117
119
|
if ( this.cluster ) {
|
118
|
-
this.cluster.clearMarkers()
|
120
|
+
this.cluster.clearMarkers();
|
121
|
+
}
|
122
|
+
|
123
|
+
if ( Any.isFunction(filter) ) {
|
124
|
+
this.clusterFilter = filter;
|
119
125
|
}
|
120
126
|
|
121
127
|
let markers = Arr.filter(this.markers, (item) => {
|
122
128
|
|
123
129
|
let visible = this.getMarkerVisibility(item.key);
|
124
130
|
|
125
|
-
if ( ! Any.isFunction(
|
131
|
+
if ( ! Any.isFunction(this.clusterFilter) ) {
|
126
132
|
return visible;
|
127
133
|
}
|
128
134
|
|
129
|
-
return visible &&
|
135
|
+
return visible && this.clusterFilter.call(this, item);
|
130
136
|
});
|
131
137
|
|
132
138
|
this.cluster = new global.MarkerClusterer(this.map, Arr.each(markers, (item) => item.marker),
|
@@ -372,7 +378,7 @@ export default class Map
|
|
372
378
|
|
373
379
|
Obj.set(this.markers, key, item);
|
374
380
|
|
375
|
-
this.clusterMarkers(this.clusterOptions, false);
|
381
|
+
this.clusterMarkers(this.clusterOptions, null, false);
|
376
382
|
|
377
383
|
if ( ! Obj.has(options, 'html') ) {
|
378
384
|
return Obj.get(this.markers, key);
|
@@ -460,7 +466,7 @@ export default class Map
|
|
460
466
|
|
461
467
|
Obj.each(markers, (item) => this.showMarker(item.key));
|
462
468
|
|
463
|
-
this.clusterMarkers(this.clusterOptions, false);
|
469
|
+
this.clusterMarkers(this.clusterOptions, null, false);
|
464
470
|
|
465
471
|
return this;
|
466
472
|
}
|