File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ class SearchService {
150150 padding,
151151 maxZoom : 15.6 ,
152152 callback : ( ) => {
153- this . searches [ selectedItem . section ] . openPopup ( this . popupItem ) ;
153+ this . searches [ selectedItem . section ] . openPopup ( this . popupItem , this . map ) ;
154154 } ,
155155 } ) ;
156156 }
Original file line number Diff line number Diff line change @@ -46,19 +46,24 @@ class HandicapStopFinder extends Search {
4646 return item . properties . name ;
4747 }
4848
49- openPopup ( item ) {
49+ openPopup ( item , map ) {
5050 const { layerService } = this . props ;
5151 const layer = layerService . getLayer ( "ch.sbb.netzkarte.stationen" ) ;
5252
5353 if ( ! layer ) {
5454 return ;
5555 }
56+ this . map = map ;
5657 this . popupItem = item ;
5758
5859 // We try to display the overlay only when the stations layer is ready and has all the stations loaded.
5960 if ( layer . ready ) {
6061 this . onIdle ( ) ;
6162 } else {
63+ // disable map interactions to avoid clicking on wrong station
64+ this . map . getInteractions ( ) . forEach ( ( interaction ) => {
65+ interaction . setActive ( false ) ;
66+ } ) ;
6267 layer . once ( "datarendered" , this . onIdle ) ;
6368 }
6469 }
@@ -106,6 +111,11 @@ class HandicapStopFinder extends Search {
106111 this . featureInfos = featInfos . filter ( ( { features } ) => features . length ) ;
107112 dispatchSetFeatureInfo ( this . featureInfos ) ;
108113 } ) ;
114+
115+ // reactivate map interactions
116+ this . map . getInteractions ( ) . forEach ( ( interaction ) => {
117+ interaction . setActive ( true ) ;
118+ } ) ;
109119 }
110120
111121 clearPopup ( ) {
Original file line number Diff line number Diff line change @@ -63,19 +63,24 @@ class StopFinder extends Search {
6363 return item . properties . name ;
6464 }
6565
66- openPopup ( item ) {
66+ openPopup ( item , map ) {
6767 const { layerService } = this . props ;
6868 const layer = layerService . getLayer ( "ch.sbb.netzkarte.stationen" ) ;
6969
7070 if ( ! layer ) {
7171 return ;
7272 }
73+ this . map = map ;
7374 this . popupItem = item ;
7475
7576 // We try to display the overlay only when the stations layer is ready and has all the stations loaded.
7677 if ( layer . ready ) {
7778 this . onIdle ( ) ;
7879 } else {
80+ // disable map interactions to avoid clicking on wrong station
81+ this . map . getInteractions ( ) . forEach ( ( interaction ) => {
82+ interaction . setActive ( false ) ;
83+ } ) ;
7984 layer . once ( "datarendered" , this . onIdle ) ;
8085 }
8186 }
@@ -119,6 +124,11 @@ class StopFinder extends Search {
119124 ) ;
120125 dispatchSetFeatureInfo ( this . featureInfos ) ;
121126 } ) ;
127+
128+ // reactivate map interactions
129+ this . map . getInteractions ( ) . forEach ( ( interaction ) => {
130+ interaction . setActive ( true ) ;
131+ } ) ;
122132 }
123133
124134 clearPopup ( ) {
You can’t perform that action at this time.
0 commit comments