diff options
author | RossTheRoss <mstrapp@protonmail.com> | 2021-02-23 21:41:54 -0600 |
---|---|---|
committer | RossTheRoss <mstrapp@protonmail.com> | 2021-02-23 21:41:54 -0600 |
commit | 75d079b3443fa65777e4183f083a21cd36dac5a6 (patch) | |
tree | 51a40b40686bc11c1d50a05a2af7903dda06ba17 | |
parent | JS sucks (diff) | |
download | homework-75d079b3443fa65777e4183f083a21cd36dac5a6.tar homework-75d079b3443fa65777e4183f083a21cd36dac5a6.tar.gz homework-75d079b3443fa65777e4183f083a21cd36dac5a6.tar.bz2 homework-75d079b3443fa65777e4183f083a21cd36dac5a6.tar.lz homework-75d079b3443fa65777e4183f083a21cd36dac5a6.tar.xz homework-75d079b3443fa65777e4183f083a21cd36dac5a6.tar.zst homework-75d079b3443fa65777e4183f083a21cd36dac5a6.zip |
it works POG????????
-rw-r--r-- | csci4131/hw3/contacts.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/csci4131/hw3/contacts.js b/csci4131/hw3/contacts.js index 8701aae..e5fffc2 100644 --- a/csci4131/hw3/contacts.js +++ b/csci4131/hw3/contacts.js @@ -113,7 +113,7 @@ function addPointsSearch(locations, isOther) { for (x in locations) { var marker; if (isOther) { - if (google.maps.geometry.spherical.computeDistanceBetween(locations[x].geometry.location, center) < parseInt(otherRadius)) { + if (google.maps.geometry.spherical.computeDistanceBetween(locations[x].geometry.location, map.getCenter()) < parseInt(otherRadius)) { marker = new google.maps.Marker({ map, title: locations[x].name, @@ -135,14 +135,15 @@ function addPointsSearch(locations, isOther) { }, }); } - - marker.addListener('click', function () { - if (!this.infoWindow) { - this.infoWindow = new google.maps.InfoWindow({ - content: this.data.content, - }); - this.infoWindow.open(map, this); - } - }) + if (marker) { + marker.addListener('click', function () { + if (!this.infoWindow) { + this.infoWindow = new google.maps.InfoWindow({ + content: this.data.content, + }); + this.infoWindow.open(map, this); + } + }) + } } } |