osm-fr / osmose-frontend

Part of osmose that shows results on the website http://osmose.openstreetmap.fr
GNU General Public License v3.0
41 stars 39 forks source link

Wide popups usually half off-screen #507

Closed Famlam closed 1 month ago

Famlam commented 1 month ago

For very wide popups, you (usually) don't see the full popup. When opening it it's dependent on the map, but after dragging the map a little bit, it is always half.

Example here

Either it looks like this: image Or like this: image

Occasionally I get it like this, which isn't perfect either, but at least 90% is visible: image

Ideally, it would limit the popup width to for instance 50% of the "map region" width, either by word-wrapping the text if it's too long, or having a horizontal scroll bar for the tags.

frodrigo commented 1 month ago

Max width is already implemented, but does not work.

https://github.com/osm-fr/osmose-frontend/blob/master/web/static/map/Osmose.Marker.ts#L24

Famlam commented 1 month ago

Just a stupid suggestion, but in the defaults I see a unit is specified (https://github.com/maplibre/maplibre-gl-js/blob/0b4688b5c34bfa4dab4e956d0e67d2703bd1ec95/src/ui/popup.ts#L20) while in Osmose it isn't.

If I use 200 for css, nothing happens: image

If I use 200px for css, I get image

frodrigo commented 1 month ago

Good catch! I miss this point when I look at this before.

frodrigo commented 1 month ago

Fixed. Thank you.