client/locations-list-map.js
/**
 * Adjusts stats in header above map to call out number of markers currently being rendered.
 */
Adjusts stats in header above map to call out number of markers currently being rendered.
Adjusts stats in header above map to call out number of markers currently being rendered .
function updateStats() {
  let countShown = gLocationsListEntries.length;
  if (!gMap) {
    return;
  }
  const mapBounds = gMap.getBounds();
  if (!mapBounds) {
    return;
  }
  const countInBounds = (count, marker) => count + mapBounds.contains(marker.getPosition());
  countShown = gPrimaryMarkers.filter((marker) => marker.datasetKey === gDataset).reduce(countInBounds, 0);
  countShown += gSecondaryMarkers.filter((marker) => marker.datasetKey === gDataset).reduce(countInBounds, 0);
  const prettyMarkerCount = numberFormat(countShown, 0);
  const prettyTotalCount = numberFormat(totalEntries, 0);
  const $stats = $('#list-stats');
  if (gDataset === 'makers') {
    $stats.html($.i18n('ftm-makers-count', prettyMarkerCount, prettyTotalCount));
  } else {
    $stats.html($.i18n('ftm-requesters-count', prettyMarkerCount, prettyTotalCount));
  }
}
function updateStats ( ) { let countShown = gLocationsListEntries . length ; if ( ! gMap ) { return ; } const mapBounds = gMap . getBounds ( ) ; if ( ! mapBounds ) { return ; } const countInBounds = ( count , marker ) => count + mapBounds . contains ( marker . getPosition ( ) ) ; countShown = gPrimaryMarkers . filter ( ( marker ) => marker . datasetKey === gDataset ) . reduce ( countInBounds , 0 ) ; countShown += gSecondaryMarkers . filter ( ( marker ) => marker . datasetKey === gDataset ) . reduce ( countInBounds , 0 ) ; const prettyMarkerCount = numberFormat ( countShown , 0 ) ; const prettyTotalCount = numberFormat ( totalEntries , 0 ) ; const $stats = $ ( '#list-stats' ) ; if ( gDataset === 'makers' ) { $stats . html ( $ . i18n ( 'ftm-makers-count' , prettyMarkerCount , prettyTotalCount ) ) ; } else { $stats . html ( $ . i18n ( 'ftm-requesters-count' , prettyMarkerCount , prettyTotalCount ) ) ; } }
Adjusts stats in header above map to call out number of markers currently being rendered.
Adjusts stats in header above map to call out number of markers currently being rendered .
// Start with count of location list rows ... // ... but defer to count of markers in map bounds, when applicable.