Skip to content

Commit

Permalink
save calculateCenter to usable variable and use it to setCenter on re…
Browse files Browse the repository at this point in the history
…size.
  • Loading branch information
shua123 committed Feb 24, 2018
1 parent 34d1527 commit 969d67a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/maps_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
// center that your map defaults to
this.map_centroid = new google.maps.LatLng(options.map_center[0], options.map_center[1]);

// the current center of the map
this.current_center = this.map_centroid

// marker image for your searched address
if (typeof options.addrMarkerImage !== 'undefined') {
if (options.addrMarkerImage != "")
Expand All @@ -55,7 +58,7 @@
self.calculateCenter();
});
google.maps.event.addDomListener(window, 'resize', function () {
self.map.setCenter(self.map_centroid);
self.map.setCenter(this.current_center);
});
self.searchrecords = null;

Expand Down Expand Up @@ -314,7 +317,7 @@
// maintains map centerpoint for responsive design
MapsLib.prototype.calculateCenter = function () {
var self = this;
center = self.map.getCenter();
this.current_center = self.map.getCenter();
};

//converts a slug or query string in to readable text
Expand Down

0 comments on commit 969d67a

Please sign in to comment.