From 93fca60a59b3d269abd0125c7e9e84d053b6eb9c Mon Sep 17 00:00:00 2001 From: Jason Jones Date: Tue, 11 Dec 2012 12:39:52 -0900 Subject: [PATCH] Update marker display on zoom as well as pan The app was using the 'dragend' event on the map to listen for changes that should prompt the display of markers, but that event only triggers when the map is panned. Changing to the 'idle' event ensures that the display is updated on both zoom and pan instead of requiring users to slightly pan the map after zooming to get new data. This has the side effect of making the initial markers display immediately upon loading the page, rather than waiting for the user to pan, as the idle event occurs when the map is initially loaded. --- app/assets/javascripts/main.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/main.js.erb b/app/assets/javascripts/main.js.erb index 68be148..b37c2b8 100644 --- a/app/assets/javascripts/main.js.erb +++ b/app/assets/javascripts/main.js.erb @@ -128,7 +128,7 @@ $(function() { } }); } - google.maps.event.addListener(map, 'dragend', function() { + google.maps.event.addListener(map, 'idle', function() { var center = map.getCenter(); addMarkersAround(center.lat(), center.lng()); });