@maptiler/geocoding-control 0.0.91-git.896be4 → 0.0.91-git.9f388b

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.
@@ -71,6 +71,7 @@ let cachedFeatures = [];
71
71
  let abortController;
72
72
  let searchTimeoutRef;
73
73
  let focusedDelayed;
74
+ let prevIdToFly;
74
75
  const dispatch = createEventDispatcher();
75
76
  $: if (!trackProximity) {
76
77
  proximity = undefined;
@@ -81,19 +82,22 @@ $: if (showFullGeometry &&
81
82
  picked.geometry.type === "Point") {
82
83
  search(picked.id, { byId: true }).catch((err) => (error = err));
83
84
  }
84
- $: if (mapController && picked && flyTo) {
85
- if (!picked.bbox ||
86
- (picked.bbox[0] === picked.bbox[2] && picked.bbox[1] === picked.bbox[3])) {
87
- mapController.flyTo(picked.center, picked.id.startsWith("poi.") || picked.id.startsWith("address.")
88
- ? maxZoom
89
- : zoom);
90
- }
91
- else {
92
- mapController.fitBounds(unwrapBbox(picked.bbox), 50, maxZoom);
85
+ $: {
86
+ if (mapController && picked && picked.id !== prevIdToFly && flyTo) {
87
+ if (!picked.bbox ||
88
+ (picked.bbox[0] === picked.bbox[2] && picked.bbox[1] === picked.bbox[3])) {
89
+ mapController.flyTo(picked.center, picked.id.startsWith("poi.") || picked.id.startsWith("address.")
90
+ ? maxZoom
91
+ : zoom);
92
+ }
93
+ else {
94
+ mapController.fitBounds(unwrapBbox(picked.bbox), 50, maxZoom);
95
+ }
96
+ listFeatures = undefined;
97
+ markedFeatures = undefined;
98
+ selectedItemIndex = -1;
93
99
  }
94
- listFeatures = undefined;
95
- markedFeatures = undefined;
96
- selectedItemIndex = -1;
100
+ prevIdToFly = picked?.id;
97
101
  }
98
102
  $: if (markedFeatures !== listFeatures) {
99
103
  markedFeatures = undefined;
@@ -449,7 +453,7 @@ function unwrapBbox(bbox0) {
449
453
  on:mouseleave={() => (selectedItemIndex = -1)}
450
454
  on:blur={() => undefined}
451
455
  >
452
- {#each listFeatures as feature, i (feature.id)}
456
+ {#each listFeatures as feature, i (feature.id + (feature.address ? "," + feature.address : ""))}
453
457
  <FeatureItem
454
458
  {feature}
455
459
  {showPlaceType}