mobility-toolbox-js 1.7.3 → 1.7.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.
@@ -407,6 +407,9 @@ const TrackerLayerMixin = (Base) =>
407
407
  return traj2.delay - traj1.delay;
408
408
  };
409
409
  }
410
+
411
+ // Update filter function based on convenient properties
412
+ this.updateFilters();
410
413
  }
411
414
 
412
415
  /**
@@ -467,7 +470,6 @@ const TrackerLayerMixin = (Base) =>
467
470
  */
468
471
  start() {
469
472
  this.stop();
470
- this.updateFilters();
471
473
  this.tracker.setVisible(true);
472
474
  this.renderTrajectories();
473
475
  this.startUpdateTime();
@@ -686,13 +688,21 @@ const TrackerLayerMixin = (Base) =>
686
688
  updateFilters() {
687
689
  // Setting filters from the permalink if no values defined by the layer.
688
690
  const parameters = qs.parse(window.location.search.toLowerCase());
689
- // filter is the property in TrackerLayerMixin.
690
- this.filter = createFilters(
691
- this.publishedLineName || parameters[LINE_FILTER],
692
- this.tripNumber || parameters[ROUTE_FILTER],
693
- this.operator || parameters[OPERATOR_FILTER],
694
- this.regexPublishedLineName,
695
- );
691
+ const publishedName = this.publishedLineName || parameters[LINE_FILTER];
692
+ const tripNumber = this.tripNumber || parameters[ROUTE_FILTER];
693
+ const operator = this.operator || parameters[OPERATOR_FILTER];
694
+ const { regexPublishedLineName } = this;
695
+
696
+ // Only overrides filter function if one of this property exists.
697
+ if (publishedName || tripNumber || operator || regexPublishedLineName) {
698
+ // filter is the property in TrackerLayerMixin.
699
+ this.filter = createFilters(
700
+ publishedName,
701
+ tripNumber,
702
+ operator,
703
+ regexPublishedLineName,
704
+ );
705
+ }
696
706
  }
697
707
 
698
708
  /**