@bmlt-enabled/croutonjs 3.19.2 → 3.19.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-map.js CHANGED
@@ -218,13 +218,14 @@ function MeetingMap(inConfig) {
218
218
  retrieveGeolocation().then(position => {
219
219
  showThrobber();
220
220
  crouton.searchByCoordinates(position.latitude, position.longitude, config.map_search.width);
221
+ if (activeModal == gSearchModal) closeModalWindow(gSearchModal);
221
222
  }).catch(error => {
222
223
  console.error(error.message);
224
+ if (activeModal != gSearchModal) showBmltSearchDialog();
223
225
  });
224
- showBmltSearchDialog();
225
- closeModalWindow(gSearchModal);
226
226
  };
227
227
  function clickSearch(e) {
228
+ croutonMap.showMap();
228
229
  gDelegate.clickSearch(e, function(lat,lng) {
229
230
  showThrobber();
230
231
  crouton.searchByCoordinates(lat, lng, config.map_search.width);
@@ -315,6 +316,9 @@ function MeetingMap(inConfig) {
315
316
  }, {});
316
317
  }
317
318
  var g_suspendedFullscreen = false;
319
+ var g_overflowX;
320
+ var activeModal = null;
321
+ var swipableModal = false;
318
322
  function closeModalWindow(modal) {
319
323
  gDelegate.modalOff();
320
324
  activeModal = null;
@@ -327,24 +331,43 @@ function MeetingMap(inConfig) {
327
331
  toggleFullscreen();
328
332
  }
329
333
  }
334
+ if (swipableModal) {
335
+ const body = document.getElementsByTagName("BODY")[0];
336
+ const scrollY = body.style.top;
337
+ body.style.overflowX = g_overflowX;
338
+ body.style.position = '';
339
+ body.style.top = '';
340
+ body.style.width = '';
341
+ window.scrollTo(0, parseInt(scrollY || '0') * -1);
342
+ }
330
343
  }
331
- var activeModal = null;
332
344
  document.addEventListener("keydown", function(event) {
333
345
  if (activeModal && event.key == "Escape") {
334
346
  closeModalWindow(activeModal);
335
347
  }
336
348
  }, true);
337
- function openModalWindow(modal) {
349
+ function openModalWindow(modal,swipe=false) {
338
350
  if (isFullscreen()) {
339
351
  g_suspendedFullscreen = true;
340
352
  toggleFullscreen();
341
353
  }
342
354
  modal.style.display = "block";
355
+ swipableModal = swipe;
343
356
  modal.focus();
344
357
  activeModal = modal;
345
358
  dd = document.getElementById("map-menu-dropdown");
346
359
  if (dd) dd.style.display = "none";
347
360
  gDelegate.modalOn();
361
+ if (swipableModal) {
362
+ const body = document.getElementsByTagName("BODY")[0];
363
+ g_overflowX = body.style.overflowX;
364
+ const newTop = -window.scrollY+'px';
365
+ const newWidth = window.width+'px';
366
+ body.style.overflowX = 'hidden';
367
+ body.style.position = 'fixed';
368
+ body.style.top = newTop;
369
+ body.style.width = newWidth;
370
+ }
348
371
  }
349
372
  function showFilterDialog(e) {
350
373
  openModalWindow(document.getElementById('filter_modal'));