Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Fix calculateCenter and resize function #69

Merged
merged 1 commit into from
Mar 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
save calculateCenter to usable variable and use it to setCenter on re…
…size.
  • Loading branch information
shua123 committed Feb 24, 2018
commit 969d67ab781c447e7ab7709c97c620192e92d1f0
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