@bmlt-enabled/croutonjs 4.1.2 → 4.1.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.
package/crouton.js CHANGED
@@ -15283,7 +15283,7 @@ function Crouton(config) {
15283
15283
  self.currentView = "weekday";
15284
15284
  self.distanceTabAllowed = false;
15285
15285
  self.config = {
15286
- version: '4.1.2', // CroutonJS version for debugging
15286
+ version: '4.1.3', // CroutonJS version for debugging
15287
15287
  on_complete: null, // Javascript function to callback when data querying is completed.
15288
15288
  root_server: null, // The root server to use.
15289
15289
  placeholder_id: "bmlt-tabs", // The DOM id that will be used for rendering
@@ -17189,7 +17189,9 @@ function MeetingMap(inConfig) {
17189
17189
  }
17190
17190
  });
17191
17191
  }
17192
-
17192
+ function isFilterVisible() {
17193
+ return config.filter_visible && config.filter_visible == 1;
17194
+ }
17193
17195
  /************************************************************************************//**
17194
17196
  * \brief Load the map and set it up. *
17195
17197
  ****************************************************************************************/
@@ -17216,7 +17218,7 @@ function MeetingMap(inConfig) {
17216
17218
  if (handlebarMapOptions) loc = {latitude: handlebarMapOptions.lat, longitude: handlebarMapOptions.lng};
17217
17219
  if (gDelegate.createMap(inDiv, loc, hide)) {
17218
17220
  // crouton_map and filter_visible triggers a query, Otherwise, redraw markers
17219
- if (config.map_search && config.filter_visible) {
17221
+ if (config.map_search && isFilterVisible()) {
17220
17222
  gDelegate.addListener('idle', triggerCroutonMapNewQuery, false);
17221
17223
  } else {
17222
17224
  gDelegate.addListener('zoomend', function (ev) {
@@ -17514,7 +17516,7 @@ function MeetingMap(inConfig) {
17514
17516
  let lat_lngs = gAllMeetings.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[]);
17515
17517
  const maxRadius = config.maxTomatoWidth/2.0;
17516
17518
  if (gSearchPoint) lat_lngs.push([gSearchPoint.lat, gSearchPoint.lng]);
17517
- if (config.map_search && config.filter_visible) {
17519
+ if (config.map_search && isFilterVisible()) {
17518
17520
  lat_lngs.sort((a,b) => getDistance({"lat":a[0],"lng":a[1]},gSearchPoint) - getDistance({"lat":b[0],"lng":b[1]},gSearchPoint));
17519
17521
  while (getLatLngRadius(lat_lngs) > maxRadius && lat_lngs.length > 3) {
17520
17522
  lat_lngs = lat_lngs.slice(0, lat_lngs.length/2);
@@ -17526,7 +17528,7 @@ function MeetingMap(inConfig) {
17526
17528
  }
17527
17529
  searchResponseCallback();
17528
17530
  hideThrobber();
17529
- if (config.filter_visible || config.centerMe || config.goto) crouton.forceShowMap();
17531
+ if (isFilterVisible() || config.centerMe || config.goto) crouton.forceShowMap();
17530
17532
  if (config.centerMe) {
17531
17533
  if (navigator.geolocation) {
17532
17534
  navigator.geolocation.getCurrentPosition(
@@ -17535,7 +17537,7 @@ function MeetingMap(inConfig) {
17535
17537
  filterVisible(false);
17536
17538
  if (config.zoom) gDelegate.setZoom(false, config.zoom);
17537
17539
  gDelegate.setViewToPosition(coords, filterMeetingsAndBounds, () => {
17538
- filterVisible(config.filter_visible == 1);
17540
+ filterVisible(isFilterVisible());
17539
17541
  });
17540
17542
  gSearchPoint = {"lat": position.coords.latitude, "lng": position.coords.longitude};
17541
17543
  crouton.updateDistances();
@@ -17546,10 +17548,10 @@ function MeetingMap(inConfig) {
17546
17548
  showGeocodingDialog();
17547
17549
  }
17548
17550
  } else {
17549
- if ((!config.centerMe && !config.goto) && !(config.map_search && config.filter_visible)) {
17550
- gDelegate.afterInit(()=>filterVisible(config.filter_visible));
17551
+ if ((!config.centerMe && !config.goto) && !(config.map_search && isFilterVisible())) {
17552
+ gDelegate.afterInit(()=>filterVisible(isFilterVisible()));
17551
17553
  }
17552
- if (config.goto) gDelegate.callGeocoder(config.goto, config.filter_visible == 1 ? resetVisibleThenFilterMeetingsAndBounds : setVisibleThenFilterMeetingsAndBounds);
17554
+ if (config.goto) gDelegate.callGeocoder(config.goto, isFilterVisible() ? resetVisibleThenFilterMeetingsAndBounds : setVisibleThenFilterMeetingsAndBounds);
17553
17555
  }
17554
17556
  }
17555
17557
  function createCityHash(allMeetings) {
@@ -17858,7 +17860,7 @@ function MeetingMap(inConfig) {
17858
17860
  function onDragEnd() {
17859
17861
  isMouseDown = false;
17860
17862
  // if no [crouton_map], then turn filter visible back on.
17861
- if (config.map_search && config.filter_visible) triggerCroutonMapNewQuery(null);
17863
+ if (config.map_search && isFilterVisible()) triggerCroutonMapNewQuery(null);
17862
17864
  else filterVisible(true);
17863
17865
  }
17864
17866
  function triggerCroutonMapNewQuery(ev) {
@@ -18183,10 +18185,13 @@ function MapDelegate(config) {
18183
18185
  if (!gMainMap) return null;
18184
18186
  return gMainMap.getZoom();
18185
18187
  }
18188
+ function isFilterVisible() {
18189
+ return config.filter_visible && config.filter_visible == 1;
18190
+ }
18186
18191
  function getZoomAdjust(only_out,filterMeetings) {
18187
18192
  if (!gMainMap) return 12;
18188
18193
  var ret = gMainMap.getZoom();
18189
- if (config.map_search && config.filter_visible) return ret;
18194
+ if (config.map_search && isFilterVisible()) return ret;
18190
18195
  var center = gMainMap.getCenter();
18191
18196
  var bounds = gMainMap.getBounds();
18192
18197
  var zoomedOut = false;