Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Search/SearchService.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class SearchService {
padding,
maxZoom: 15.6,
callback: () => {
this.searches[selectedItem.section].openPopup(this.popupItem);
this.searches[selectedItem.section].openPopup(this.popupItem, this.map);
},
});
}
Expand Down
12 changes: 11 additions & 1 deletion src/searches/HandicapStopFinder/HandicapStopFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,24 @@ class HandicapStopFinder extends Search {
return item.properties.name;
}

openPopup(item) {
openPopup(item, map) {
const { layerService } = this.props;
const layer = layerService.getLayer("ch.sbb.netzkarte.stationen");

if (!layer) {
return;
}
this.map = map;
this.popupItem = item;

// We try to display the overlay only when the stations layer is ready and has all the stations loaded.
if (layer.ready) {
this.onIdle();
} else {
// disable map interactions to avoid clicking on wrong station
this.map.getInteractions().forEach((interaction) => {
interaction.setActive(false);
});
layer.once("datarendered", this.onIdle);
}
}
Expand Down Expand Up @@ -106,6 +111,11 @@ class HandicapStopFinder extends Search {
this.featureInfos = featInfos.filter(({ features }) => features.length);
dispatchSetFeatureInfo(this.featureInfos);
});

// reactivate map interactions
this.map.getInteractions().forEach((interaction) => {
interaction.setActive(true);
});
}

clearPopup() {
Expand Down
12 changes: 11 additions & 1 deletion src/searches/StopFinder/StopFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,24 @@ class StopFinder extends Search {
return item.properties.name;
}

openPopup(item) {
openPopup(item, map) {
const { layerService } = this.props;
const layer = layerService.getLayer("ch.sbb.netzkarte.stationen");

if (!layer) {
return;
}
this.map = map;
this.popupItem = item;

// We try to display the overlay only when the stations layer is ready and has all the stations loaded.
if (layer.ready) {
this.onIdle();
} else {
// disable map interactions to avoid clicking on wrong station
this.map.getInteractions().forEach((interaction) => {
interaction.setActive(false);
});
layer.once("datarendered", this.onIdle);
}
}
Expand Down Expand Up @@ -119,6 +124,11 @@ class StopFinder extends Search {
);
dispatchSetFeatureInfo(this.featureInfos);
});

// reactivate map interactions
this.map.getInteractions().forEach((interaction) => {
interaction.setActive(true);

@oterral oterral Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I m wondering if you activate here some interactions that were inactivate before the call to openPopup

});
}

clearPopup() {
Expand Down
Loading