Start with marker clusterer
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 3 Apr 2018 19:12:18 +0000 (15:12 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 3 Apr 2018 19:12:18 +0000 (15:12 -0400)
Add markerclusterer from nearme to member map.

models/front/members/list.php
views/front/members/list.html

index b24bdc1..a1f5455 100644 (file)
@@ -148,6 +148,16 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
      */
     public function modelAction ($actionData = false)
     {
+        // Enqueue the Marker Clusterer Script
+        wp_register_script(
+            'glm-members-admin-google-maps-marker-clusterer',
+            GLM_MEMBERS_PLUGIN_URL . 'js/googleMapsMarkerClusterer/markerclustererplus.js',
+            array(
+                    'jquery'
+            ),
+            GLM_MEMBERS_PLUGIN_VERSION
+        );
+        wp_enqueue_script('glm-members-admin-google-maps-marker-clusterer', false, array('jquery'), false, true);
 
         $where                = '';
         $whereSep             = '';
index 54878a5..b6fb122 100644 (file)
                             //});
                         //}
 
+
                 {if $mapItems}
+                    var markers = [];
                     {foreach $mapItems as $m}
                       {if $m.lat != 0 && $m.lon != 0}
 
                             infowindow.open(map,this);
                         });
 
+                        markers.push(marker);
+
                         // Extend the map bounds to include this marker
                         bounds.extend(marker.position);
 
                      {/if}
                     {/foreach}
 
+                        var markerCluster = new MarkerClusterer(map, markers,
+                        {
+                            imagePath: '{$baseUrl}/js/googleMapsMarkerClusterer/images/m',
+                            gridSize: 30,
+                            maxZoom: 14,
+                            minimunClusterSize: 3
+                        });
+
                         // Fit map to bounds of all markers
                         map.fitBounds(bounds);