@bmlt-enabled/croutonjs 3.18.0 → 3.18.2

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
@@ -9,6 +9,7 @@ function MeetingMap(inConfig) {
9
9
  const config = inConfig;
10
10
  if (!config.maxZoom) config.maxZoom = 17;
11
11
  if (!config.minZoom) config.minZoom = 6;
12
+ if (!config.marker_contents_template) config.marker_contents_template = croutonDefaultTemplates.marker_contents_template;
12
13
  var gAllMeetings = null;
13
14
  var gMeetingIdsFromCrouton = null;
14
15
  var loadedCallbackFunction = null;
@@ -26,6 +27,7 @@ function MeetingMap(inConfig) {
26
27
 
27
28
  function loadMap(inDiv, menuContext, handlebarMapOptions=null,cb=null) {
28
29
  if (inDiv) {
30
+ crouton_Handlebars.registerPartial("markerContentsTemplate", config['marker_contents_template']);
29
31
  gInDiv = inDiv;
30
32
  createThrobber(inDiv);
31
33
  if (!config.map_search) showThrobber();
@@ -159,15 +161,15 @@ function MeetingMap(inConfig) {
159
161
  return controlDiv;
160
162
  }
161
163
 
162
- function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, callback) {
164
+ function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback) {
163
165
  if (!gDelegate.isApiLoaded()) {
164
- preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, callback]);
166
+ preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback]);
165
167
  gDelegate.loadApi();
166
168
  return;
167
169
  }
168
170
  let inDiv = document.getElementById(inDiv_id);
169
171
  loadMap(inDiv, menuContext, handlebarMapOptions,callback);
170
- loadAllMeetings(meetings_responseObject, true);
172
+ loadAllMeetings(meetings_responseObject, fitBounds, true);
171
173
  };
172
174
  function loadPopupMap(inDiv_id, meeting, handlebarMapOptions = null) {
173
175
  if (!gDelegate.isApiLoaded()) {
@@ -248,21 +250,23 @@ function MeetingMap(inConfig) {
248
250
  showThrobber();
249
251
  crouton.searchByCoordinates(latlng.lat, latlng.lng, config.map_search.width);
250
252
  }
251
- function loadAllMeetings(meetings_responseObject, fitAll=false) {
253
+ function loadAllMeetings(meetings_responseObject, fitBounds=true, fitAll=false) {
252
254
  if (meetings_responseObject === null && config.map_search) {
253
255
  if (config.map_search.auto) nearMeSearch();
254
256
  else if (config.map_search.coordinates_search) {
255
257
  showThrobber();
256
258
  config.map_search.coordinates_search = false;
257
- crouton.searchByCoordinates(config.map_search.latitude, config.map_search.longitude);
259
+ crouton.searchByCoordinates(config.map_search.latitude, config.map_search.longitude, config.map_search.width);
258
260
  }
259
261
  else if (config.map_search.location) gDelegate.callGeocoder(config.map_search.location, null, mapSearchGeocode);
260
262
  else showBmltSearchDialog();
261
263
  return;
262
264
  }
263
265
  gAllMeetings = meetings_responseObject.filter(m => m.venue_type != 2);
264
- const lat_lngs = gAllMeetings.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[]);
265
- gDelegate.fitBounds(lat_lngs);
266
+ if (fitBounds) {
267
+ const lat_lngs = gAllMeetings.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[]);
268
+ gDelegate.fitBounds(lat_lngs);
269
+ }
266
270
  searchResponseCallback();
267
271
  hideThrobber();
268
272
  if (config.centerMe) {