diff --git a/html/modules/custom/ghi_blocks/js/map/map.circle.js b/html/modules/custom/ghi_blocks/js/map/map.circle.js
index 013d9ad5e..90933d6cc 100644
--- a/html/modules/custom/ghi_blocks/js/map/map.circle.js
+++ b/html/modules/custom/ghi_blocks/js/map/map.circle.js
@@ -78,7 +78,7 @@
continue;
}
let location_data = Drupal.hpc_map.getLocationDataById(state, object_id);
- let radius = Drupal.hpc_map.getRadius(location_data, scale, base_radius/scale);
+ let radius = Drupal.hpc_map.getRadius(state, location_data, scale, base_radius/scale);
offset += radius + (base_radius + 3)/scale;
}
return offset;
@@ -168,7 +168,7 @@
.transition()
.duration(250)
.attr('fill', d => Drupal.hpc_map_circle.getColor(d, map_state, map_id))
- .attr('r', d => Drupal.hpc_map.getRadius(d, scale, radius) + base_radius/scale)
+ .attr('r', d => Drupal.hpc_map.getRadius(map_state, d, scale, radius) + base_radius/scale)
.attr('opacity', d => Drupal.hpc_map_circle.getOpacity(d, map_state, map_id));
}
else {
@@ -188,7 +188,7 @@
.attr('cursor', attrs.cursor)
.attr('opacity', d => Drupal.hpc_map_circle.getOpacity(d, map_state, map_id))
.attr('fill', d => Drupal.hpc_map_circle.getColor(d, map_state, map_id))
- .attr('r', d => Drupal.hpc_map.getRadius(d, scale, radius));
+ .attr('r', d => Drupal.hpc_map.getRadius(map_state, d, scale, radius));
}
}
@@ -249,7 +249,7 @@
.duration(500)
.attr('cursor', attrs.cursor)
.attr('fill', d => Drupal.hpc_map_circle.getColor(d, state, map_id))
- .attr('r', d => Drupal.hpc_map.getRadius(d, scale, radius))
+ .attr('r', d => Drupal.hpc_map.getRadius(state, d, scale, radius))
.attr('stroke-width', strokeWidth)
.attr('opacity', d => Drupal.hpc_map_circle.getOpacity(d, state, map_id));
},
@@ -260,7 +260,7 @@
.attr('stroke', attrs.stroke)
.attr('cursor', attrs.cursor)
.attr('fill', d => Drupal.hpc_map_circle.getColor(d, state, map_id))
- .attr('r', d => Drupal.hpc_map.getRadius(d, scale, radius))
+ .attr('r', d => Drupal.hpc_map.getRadius(state, d, scale, radius))
.attr('stroke-width', strokeWidth)
.attr('opacity', d => Drupal.hpc_map_circle.getOpacity(d, state, map_id));
},
diff --git a/html/modules/custom/ghi_blocks/js/map/map.donut.js b/html/modules/custom/ghi_blocks/js/map/map.donut.js
index 4cabf1205..e84f7ca18 100644
--- a/html/modules/custom/ghi_blocks/js/map/map.donut.js
+++ b/html/modules/custom/ghi_blocks/js/map/map.donut.js
@@ -251,7 +251,7 @@
let group_keys = Object.keys(object[state.index]);
let primary_key = group_keys[0];
- let r = object[state.index][primary_key] > 0 ? Drupal.hpc_map.getRadius(object, 1, base_radius, object.radius_factor / scale, min_radius / Math.sqrt(scale)) : min_radius;
+ let r = object[state.index][primary_key] > 0 ? Drupal.hpc_map.getRadius(state, object, 1, base_radius, object.radius_factor / scale, min_radius / Math.sqrt(scale)) : min_radius;
let x = proj.latLngToLayerPoint(object.latLng).x;
let y = proj.latLngToLayerPoint(object.latLng).y;
diff --git a/html/modules/custom/ghi_blocks/js/map/map.js b/html/modules/custom/ghi_blocks/js/map/map.js
index de4d70773..355e6863b 100644
--- a/html/modules/custom/ghi_blocks/js/map/map.js
+++ b/html/modules/custom/ghi_blocks/js/map/map.js
@@ -807,11 +807,6 @@
if (focus_state) {
Drupal.hpc_map.moveLocationToFront(contained_element);
}
- // else if (state.active_location) {
- // let active_element = Drupal.hpc_map.getElementFromDataObject(state.active_location, state);
- // Drupal.hpc_map.moveLocationToFront(active_element);
- // }
-
}
// Change the admin level.
@@ -893,13 +888,16 @@
}
// Get the factor for the radius.
- Drupal.hpc_map.getRadiusFactor = function(d) {
+ Drupal.hpc_map.getRadiusFactor = function(d, state) {
if (typeof d == 'undefined') {
return 1;
}
if (typeof d.radius_factor_grouped != 'undefined') {
return d.radius_factor_grouped;
}
+ if (typeof d.radius_factors != 'undefined' && typeof d.radius_factors[state.index] != 'undefined') {
+ return d.radius_factors[state.index];
+ }
if (typeof d.radius_factor != 'undefined') {
return d.radius_factor;
}
@@ -907,10 +905,10 @@
}
// Calculate the radius for the given data point.
- Drupal.hpc_map.getRadius = function(d, scale, base_radius, radius_factor, min_radius) {
+ Drupal.hpc_map.getRadius = function(state, d, scale, base_radius, radius_factor, min_radius) {
var admin_level = typeof d.admin_level != 'undefined' ? d.admin_level : 1;
if (typeof radius_factor == 'undefined') {
- radius_factor = Drupal.hpc_map.getRadiusFactor(d);
+ radius_factor = Drupal.hpc_map.getRadiusFactor(d, state);
}
let radius = (base_radius + (radius_factor / scale)) / admin_level;
return (typeof min_radius != 'undefined') ? (radius > min_radius ? radius : min_radius) : radius;