@bmlt-enabled/croutonjs 4.3.2 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15465,7 +15465,7 @@ function Crouton(config) {
15465
15465
  self.distanceTabAllowed = false;
15466
15466
  self.favoritesOn = false;
15467
15467
  self.config = {
15468
- version: '4.3.2', // CroutonJS version for debugging
15468
+ version: '4.3.3', // CroutonJS version for debugging
15469
15469
  on_complete: null, // Javascript function to callback when data querying is completed.
15470
15470
  root_server: null, // The root server to use.
15471
15471
  placeholder_id: "bmlt-tabs", // The DOM id that will be used for rendering
@@ -17744,7 +17744,7 @@ function MeetingMap(inConfig) {
17744
17744
  filterVisible(false);
17745
17745
  gSearchPoint = {"lat": position.lat, "lng": position.lng};
17746
17746
  crouton.updateDistances();
17747
- const locationSearchResult = gDelegate.getZoomAdjustedBounds(gSearchPoint, filterMeetingsAndBounds, config.locationSearchZoom ?? 12);
17747
+ const locationSearchResult = gDelegate.getZoomAdjustedBounds(gSearchPoint, filterMeetingsAndBounds, config.locationSearchZoom ?? 12, findClosestMeetingLatLng(gSearchPoint));
17748
17748
  gDelegate.flyToFixedZoom(position, locationSearchResult.zoom, filterVisible);
17749
17749
  filterVisible(true);
17750
17750
  setLocationSearchButtonLabel(crouton.localization.getWord('closest meetings'));
@@ -17908,7 +17908,7 @@ function MeetingMap(inConfig) {
17908
17908
  const centerAndBounds = gDelegate.getGeocodeCenterAndBounds(resp, i);
17909
17909
  if (!centerAndBounds) return;
17910
17910
  const zoom = calcZoomThatContainsBoundingBox(centerAndBounds);
17911
- const locationSearchResult = gDelegate.getZoomAdjustedBounds(gSearchPoint, filterMeetingsAndBounds, zoom);
17911
+ const locationSearchResult = gDelegate.getZoomAdjustedBounds(gSearchPoint, filterMeetingsAndBounds, zoom, findClosestMeetingLatLng(gSearchPoint));
17912
17912
  gDelegate.flyToFixedZoom(gSearchPoint, locationSearchResult.zoom, filterVisible);
17913
17913
  searchResponseCallback();
17914
17914
  })
@@ -17972,6 +17972,16 @@ function MeetingMap(inConfig) {
17972
17972
  function locationSearchGeocodeInitial(resp) {
17973
17973
  locationSearchGeocode(resp, true);
17974
17974
  }
17975
+ function findClosestMeetingLatLng(center) {
17976
+ return filterMeetings(gAllMeetings).reduce((closest, meeting) => {
17977
+ const meetingLocation = {lat: meeting.latitude, lng: meeting.longitude};
17978
+ const distance = getDistance(center, meetingLocation);
17979
+ if (distance < closest.distance) {
17980
+ return {meetingLocation: meetingLocation, distance: distance};
17981
+ }
17982
+ return closest;
17983
+ }, {meetingLocation: null, distance: Infinity}).meetingLocation;
17984
+ }
17975
17985
  function locationSearchGeocode(resp, initial=false) {
17976
17986
  chooseResponse('bmlt_location_search_modal', resp, function(resp, i) {
17977
17987
  closeModalWindow(gLocationSearchModal);
@@ -17980,7 +17990,8 @@ function MeetingMap(inConfig) {
17980
17990
  let center = centerAndBounds.center;
17981
17991
  filterVisible(false);
17982
17992
  let zoom = calcZoomThatContainsBoundingBox(centerAndBounds);
17983
- gLocationSearchResult = gDelegate.getZoomAdjustedBounds(center, filterMeetingsAndBounds, zoom);
17993
+
17994
+ gLocationSearchResult = gDelegate.getZoomAdjustedBounds(center, filterMeetingsAndBounds, zoom, findClosestMeetingLatLng(center));
17984
17995
  gSearchPoint = {"lat": gLocationSearchResult.center.lat, "lng": gLocationSearchResult.center.lng};
17985
17996
  filterVisible(true, gLocationSearchResult.bounds);
17986
17997
  crouton.updateDistances(initial);
@@ -18045,13 +18056,13 @@ function MeetingMap(inConfig) {
18045
18056
  retrieveGeolocation().then(function(coords) {
18046
18057
  filterVisible(false);
18047
18058
  if (isMapVisible() || !makeFilterVisible) {
18048
- const locationSearchResult = gDelegate.getZoomAdjustedBounds(coords, filterMeetingsAndBounds, config.locationSearchZoom ?? 12);
18059
+ const locationSearchResult = gDelegate.getZoomAdjustedBounds(coords, filterMeetingsAndBounds, config.locationSearchZoom ?? 12, findClosestMeetingLatLng(coords));
18049
18060
  gDelegate.flyToFixedZoom(coords, locationSearchResult.zoom, () => {
18050
18061
  filterVisible(makeFilterVisible);
18051
18062
  if (makeFilterVisible) setLocationSearchButtonLabel(crouton.localization.getWord('closest meetings'));
18052
18063
  });
18053
18064
  } else {
18054
- gLocationSearchResult = gDelegate.getZoomAdjustedBounds(coords, filterMeetingsAndBounds, config.locationSearchZoom ?? 12);
18065
+ gLocationSearchResult = gDelegate.getZoomAdjustedBounds(coords, filterMeetingsAndBounds, config.locationSearchZoom ?? 12, findClosestMeetingLatLng(coords));
18055
18066
  filterVisible(true, gLocationSearchResult.bounds);
18056
18067
  setLocationSearchButtonLabel(crouton.localization.getWord('closest meetings'));
18057
18068
  }