From 7c3c322449ebee6def9a06c1ea34379c2f88000d Mon Sep 17 00:00:00 2001 From: "Hanson.xyz Dev" Date: Tue, 16 Dec 2025 00:58:59 -0600 Subject: [PATCH] Replace heatmap with density dots for all zoom levels Remove Leaflet.heat in favor of consistent density dot visualization: - Zoom 1-5: Density dots with 40% more density (24px spacing) - Zoom 6-11: Density dots with normal spacing (40px) - Zoom 12-15: Numbered cluster circles - Zoom 16+: Individual property markers Density dots provide clearer visualization than heatmap blobs for high-density property data. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../includes/class-mls-cluster.php | 25 +++++++++------ .../themes/homeproz/archive-property.php | 2 -- .../themes/homeproz/dist/assets/main.js | 2 +- .../property/property-filters.js | 32 ++----------------- 4 files changed, 19 insertions(+), 42 deletions(-) diff --git a/wp-content/plugins/mls-by-hansonxyz/includes/class-mls-cluster.php b/wp-content/plugins/mls-by-hansonxyz/includes/class-mls-cluster.php index 127d00e2..aa720fd5 100644 --- a/wp-content/plugins/mls-by-hansonxyz/includes/class-mls-cluster.php +++ b/wp-content/plugins/mls-by-hansonxyz/includes/class-mls-cluster.php @@ -28,6 +28,11 @@ class MLS_Cluster { */ const DENSITY_DOT_SPACING = 40; + /** + * Denser spacing for very zoomed out views (40% more dense = 60% of normal) + */ + const DENSITY_DOT_SPACING_DENSE = 24; + /** * Maximum properties to return as individual markers * Above this threshold, return clusters @@ -37,8 +42,8 @@ class MLS_Cluster { /** * Zoom thresholds for visualization modes */ - const ZOOM_HEATMAP_MAX = 7; // 3-7: heatmap only - const ZOOM_DENSITY_MAX = 11; // 8-11: density dots + const ZOOM_DENSE_MAX = 5; // 1-5: density dots (40% more dense) + const ZOOM_DENSITY_MAX = 11; // 6-11: density dots (normal) const ZOOM_CLUSTER_MAX = 15; // 12-15: numbered clusters // 16+: individual markers @@ -274,14 +279,14 @@ class MLS_Cluster { $zoom = (int) $args['zoom']; // Determine visualization mode based on zoom level - // Zoom 3-7: Heatmap (just return points for client-side heatmap) - if ($zoom <= self::ZOOM_HEATMAP_MAX) { - return $this->get_heatmap_data($where_sql, $values, $total); + // Zoom 1-5: Density dots (40% more dense) + if ($zoom <= self::ZOOM_DENSE_MAX) { + return $this->get_density_data($where_sql, $values, $zoom, $center_lat, $total, self::DENSITY_DOT_SPACING_DENSE); } - // Zoom 8-11: Density dots (small colored circles without numbers) + // Zoom 6-11: Density dots (normal spacing) if ($zoom <= self::ZOOM_DENSITY_MAX) { - return $this->get_density_data($where_sql, $values, $zoom, $center_lat, $total); + return $this->get_density_data($where_sql, $values, $zoom, $center_lat, $total, self::DENSITY_DOT_SPACING); } // Zoom 12-15: Numbered clusters (or individual if low count) @@ -347,15 +352,17 @@ class MLS_Cluster { * @param int $zoom Map zoom level * @param float $center_lat Center latitude for Mercator adjustment * @param int $total Total count + * @param int $pixel_spacing Pixel spacing for grid cells * @return array */ - private function get_density_data($where_sql, $values, $zoom, $center_lat, $total) { + private function get_density_data($where_sql, $values, $zoom, $center_lat, $total, $pixel_spacing = null) { global $wpdb; $table = $this->db->properties_table(); + $pixel_spacing = $pixel_spacing ?: self::DENSITY_DOT_SPACING; // Use smaller grid cells for density dots - list($lat_step, $lng_step) = $this->get_grid_step_for_zoom($zoom, $center_lat, self::DENSITY_DOT_SPACING); + list($lat_step, $lng_step) = $this->get_grid_step_for_zoom($zoom, $center_lat, $pixel_spacing); $sql = "SELECT FLOOR(latitude / %f) as lat_cell, diff --git a/wp-content/themes/homeproz/archive-property.php b/wp-content/themes/homeproz/archive-property.php index 578fe4fd..19c33ed3 100755 --- a/wp-content/themes/homeproz/archive-property.php +++ b/wp-content/themes/homeproz/archive-property.php @@ -131,8 +131,6 @@ if (function_exists('mls_get_property_count')) { - -