@@ -1895,18 +1895,14 @@ class SearchControl(Control):
1895
1895
layer = Instance (LayerGroup , allow_none = True , default_value = None ).tag (sync = True , ** widget_serialization )
1896
1896
1897
1897
_location_found_callbacks = Instance (CallbackDispatcher , ())
1898
- _feature_found_callbacks = Instance (CallbackDispatcher , ())
1899
1898
1900
1899
def __init__ (self , ** kwargs ):
1901
1900
super ().__init__ (** kwargs )
1902
1901
self .on_msg (self ._handle_leaflet_event )
1903
1902
1904
1903
def _handle_leaflet_event (self , _ , content , buffers ):
1905
1904
if content .get ('event' , '' ) == 'locationfound' :
1906
- if content .get ('feature' , None ) is not None :
1907
- self ._feature_found_callbacks (** content )
1908
- else :
1909
- self ._location_found_callbacks (** content )
1905
+ self ._location_found_callbacks (** content )
1910
1906
1911
1907
def on_feature_found (self , callback , remove = False ):
1912
1908
"""Add a found feature event listener for searching in GeoJSON layer.
@@ -1918,7 +1914,7 @@ def on_feature_found(self, callback, remove=False):
1918
1914
remove: boolean
1919
1915
Whether to remove this callback or not. Defaults to False.
1920
1916
"""
1921
- self ._feature_found_callbacks .register_callback (callback , remove = remove )
1917
+ self ._location_found_callbacks .register_callback (callback , remove = remove )
1922
1918
1923
1919
def on_location_found (self , callback , remove = False ):
1924
1920
"""Add a found location event listener. The callback will be called when a search result has been found.
0 commit comments