ipyleaflet icon indicating copy to clipboard operation
ipyleaflet copied to clipboard

Search Control position bug

Open giswqs opened this issue 5 years ago • 2 comments

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))

giswqs avatar Jul 05 '20 01:07 giswqs

Interesting. It might be an issue with the way we create and add the Controls to the Map.

martinRenou avatar Jul 06 '20 07:07 martinRenou

@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.

giswqs avatar Jan 21 '22 03:01 giswqs

Is this fixed @giswqs ?

martinRenou avatar Jun 06 '23 07:06 martinRenou