@bmlt-enabled/croutonjs 4.1.2 → 4.1.4

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-gmaps.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.4', // 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
@@ -16100,8 +16100,12 @@ function Crouton(config) {
16100
16100
  });
16101
16101
  }
16102
16102
  const sorted = parent.children().sort(function (a, b) {
16103
- const distanceA =parseFloat( jQuery(a).data('distance'));
16104
- const distanceB =parseFloat( jQuery(b).data('distance'));
16103
+ const idA =parseFloat( jQuery(a).data('meetingid').replace("meeting-data-row-", ""));
16104
+ const idB =parseFloat( jQuery(b).data('meetingid').replace("meeting-data-row-", ""));
16105
+ const dataA = self.meetingData.find((m) => m.id_bigint==idA);
16106
+ const dataB = self.meetingData.find((m) => m.id_bigint==idB);
16107
+ const distanceA = dataA ? parseFloat(dataA['distance_in_km']) : Number.POSITIVE_INFINITY;
16108
+ const distanceB = dataB ? parseFloat(dataB['distance_in_km']) : Number.POSITIVE_INFINITY;
16105
16109
  return (distanceA < distanceB) ? -1 : (distanceA > distanceB) ? 1 : 0;
16106
16110
  });
16107
16111
  parent.html(sorted);
@@ -17189,7 +17193,9 @@ function MeetingMap(inConfig) {
17189
17193
  }
17190
17194
  });
17191
17195
  }
17192
-
17196
+ function isFilterVisible() {
17197
+ return config.filter_visible && config.filter_visible == 1;
17198
+ }
17193
17199
  /************************************************************************************//**
17194
17200
  * \brief Load the map and set it up. *
17195
17201
  ****************************************************************************************/
@@ -17216,7 +17222,7 @@ function MeetingMap(inConfig) {
17216
17222
  if (handlebarMapOptions) loc = {latitude: handlebarMapOptions.lat, longitude: handlebarMapOptions.lng};
17217
17223
  if (gDelegate.createMap(inDiv, loc, hide)) {
17218
17224
  // crouton_map and filter_visible triggers a query, Otherwise, redraw markers
17219
- if (config.map_search && config.filter_visible) {
17225
+ if (config.map_search && isFilterVisible()) {
17220
17226
  gDelegate.addListener('idle', triggerCroutonMapNewQuery, false);
17221
17227
  } else {
17222
17228
  gDelegate.addListener('zoomend', function (ev) {
@@ -17514,7 +17520,7 @@ function MeetingMap(inConfig) {
17514
17520
  let lat_lngs = gAllMeetings.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[]);
17515
17521
  const maxRadius = config.maxTomatoWidth/2.0;
17516
17522
  if (gSearchPoint) lat_lngs.push([gSearchPoint.lat, gSearchPoint.lng]);
17517
- if (config.map_search && config.filter_visible) {
17523
+ if (config.map_search && isFilterVisible()) {
17518
17524
  lat_lngs.sort((a,b) => getDistance({"lat":a[0],"lng":a[1]},gSearchPoint) - getDistance({"lat":b[0],"lng":b[1]},gSearchPoint));
17519
17525
  while (getLatLngRadius(lat_lngs) > maxRadius && lat_lngs.length > 3) {
17520
17526
  lat_lngs = lat_lngs.slice(0, lat_lngs.length/2);
@@ -17526,7 +17532,7 @@ function MeetingMap(inConfig) {
17526
17532
  }
17527
17533
  searchResponseCallback();
17528
17534
  hideThrobber();
17529
- if (config.filter_visible || config.centerMe || config.goto) crouton.forceShowMap();
17535
+ if (isFilterVisible() || config.centerMe || config.goto) crouton.forceShowMap();
17530
17536
  if (config.centerMe) {
17531
17537
  if (navigator.geolocation) {
17532
17538
  navigator.geolocation.getCurrentPosition(
@@ -17535,7 +17541,7 @@ function MeetingMap(inConfig) {
17535
17541
  filterVisible(false);
17536
17542
  if (config.zoom) gDelegate.setZoom(false, config.zoom);
17537
17543
  gDelegate.setViewToPosition(coords, filterMeetingsAndBounds, () => {
17538
- filterVisible(config.filter_visible == 1);
17544
+ filterVisible(isFilterVisible());
17539
17545
  });
17540
17546
  gSearchPoint = {"lat": position.coords.latitude, "lng": position.coords.longitude};
17541
17547
  crouton.updateDistances();
@@ -17546,10 +17552,10 @@ function MeetingMap(inConfig) {
17546
17552
  showGeocodingDialog();
17547
17553
  }
17548
17554
  } else {
17549
- if ((!config.centerMe && !config.goto) && !(config.map_search && config.filter_visible)) {
17550
- gDelegate.afterInit(()=>filterVisible(config.filter_visible));
17555
+ if ((!config.centerMe && !config.goto) && !(config.map_search && isFilterVisible())) {
17556
+ gDelegate.afterInit(()=>filterVisible(isFilterVisible()));
17551
17557
  }
17552
- if (config.goto) gDelegate.callGeocoder(config.goto, config.filter_visible == 1 ? resetVisibleThenFilterMeetingsAndBounds : setVisibleThenFilterMeetingsAndBounds);
17558
+ if (config.goto) gDelegate.callGeocoder(config.goto, isFilterVisible() ? resetVisibleThenFilterMeetingsAndBounds : setVisibleThenFilterMeetingsAndBounds);
17553
17559
  }
17554
17560
  }
17555
17561
  function createCityHash(allMeetings) {
@@ -17858,7 +17864,7 @@ function MeetingMap(inConfig) {
17858
17864
  function onDragEnd() {
17859
17865
  isMouseDown = false;
17860
17866
  // if no [crouton_map], then turn filter visible back on.
17861
- if (config.map_search && config.filter_visible) triggerCroutonMapNewQuery(null);
17867
+ if (config.map_search && isFilterVisible()) triggerCroutonMapNewQuery(null);
17862
17868
  else filterVisible(true);
17863
17869
  }
17864
17870
  function triggerCroutonMapNewQuery(ev) {
@@ -18180,10 +18186,13 @@ function MapDelegate(in_config) {
18180
18186
  gAllMarkers = [];
18181
18187
  gOpenMarker = false;
18182
18188
  };
18189
+ function isFilterVisible() {
18190
+ return config.filter_visible && config.filter_visible == 1;
18191
+ }
18183
18192
  function getZoomAdjust(only_out,filterMeetings) {
18184
18193
  if (!gMainMap) return 12;
18185
18194
  var ret = gMainMap.getZoom();
18186
- if (config.map_search && config.filter_visible) return ret;
18195
+ if (config.map_search && isFilterVisible()) return ret;
18187
18196
  var center = gMainMap.getCenter();
18188
18197
  var bounds = gMainMap.getBounds();
18189
18198
  var zoomedOut = false;
@@ -18247,10 +18256,6 @@ function MapDelegate(in_config) {
18247
18256
  var worldPoint = gMainMap.getProjection().fromLatLngToPoint(latLng);
18248
18257
  return new google.maps.Point(worldPoint.x * scale, worldPoint.y * scale);
18249
18258
  };
18250
- function setZoom(filterMeetings) {
18251
- if (!gMainMap) return;
18252
- gMainMap.setZoom(getZoomAdjust(false,filterMeetings));
18253
- }
18254
18259
  function createClusterLayer() {
18255
18260
  gIsClustering = true;
18256
18261
  }