ipyleaflet
ipyleaflet copied to clipboard
Search Control position bug
When multiple controls are using the same position, the Search Control position is not working as expected. In the four cases below, the Search Control is supposed to be placed between the FullScreenControl and ZoomControl. However, the Search Control is always placed beneath other controls when using topleft and topright positions. Similarly, the the Search Control is always placed above other controls when using bottomleft and bottomright positions.
from ipyleaflet import *
m = Map(center=[40, -100], zoom=4)
marker = Marker(icon=AwesomeIcon(name="check", marker_color='green', icon_color='darkgreen'))
position = 'topleft'
search = SearchControl(position=position,
url='https://nominatim.openstreetmap.org/search?format=json&q={s}',
zoom=5,
property_name='display_name',
marker=marker
)
m.clear_controls()
m.add_control(FullScreenControl(position=position))
m.add_control(search)
m.add_control(ZoomControl(position=position))
m
position = 'topleft'
m.add_control(FullScreenControl(position=position))
m.add_control(search)
m.add_control(ZoomControl(position=position))

position = 'topright'
m.add_control(FullScreenControl(position=position))
m.add_control(search)
m.add_control(ZoomControl(position=position))

position = 'bottomleft'
m.add_control(FullScreenControl(position=position))
m.add_control(search)
m.add_control(ZoomControl(position=position))

position = 'bottomright'
m.add_control(FullScreenControl(position=position))
m.add_control(search)
m.add_control(ZoomControl(position=position))

Interesting. It might be an issue with the way we create and add the Controls to the Map.
@sackh Do you have any advice for this issue? I looked into the ipyleaflet source code, but could not find how the search control position is specified.
Is this fixed @giswqs ?