Skip to content

Commit

Permalink
Update marker display on zoom as well as pan
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ralreegorganon committed Dec 11, 2012
1 parent c88a8f7 commit 93fca60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/assets/javascripts/main.js.erb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ $(function() {
} }
}); });
} }
google.maps.event.addListener(map, 'dragend', function() { google.maps.event.addListener(map, 'idle', function() {
var center = map.getCenter(); var center = map.getCenter();
addMarkersAround(center.lat(), center.lng()); addMarkersAround(center.lat(), center.lng());
}); });
Expand Down

0 comments on commit 93fca60

Please sign in to comment.