GreenInfo-Network / seattle-building-dashboard

Energy benchmarking for Seattle
https://greeninfo-network.github.io/seattle-building-dashboard/
ISC License
1 stars 0 forks source link

Move building popup #64

Closed tomay closed 9 months ago

tomay commented 10 months ago

Building map popup is blocking the clicked building. Can it move to the right side of the screen?

tomay commented 10 months ago

Leaflet/Carto.js uses Javascript to position the popup every time it opens, so simple CSS positioning hacks alone won't work

We could create the popup from scratch, but that also means we have to rewrite any and all methods in place to track and respond to popup state, like on('popupclose') and on('popupopen')

tomay commented 10 months ago

I was able to hack the existing position. Seems to be working fine so far, but we should continue testing:

image

Unfortunately, I cannot easily move the zoom controls to the top left, because the sidebar overlaps the map, and this overlap is not consistent (sometimes less, sometimes more). With additional time, that could also be tracked down and fixed...

tomay commented 9 months ago

Mike would like for the map to center on the selected building.

At the moment, it seems like Leaflet/Carto is attempting to "auto pan" the map so that the popup stays in the viewport, even though that is no longer necessary, which might complicate this.

~I did see that the Leaflet option autoPan: false doesn't have any effect (could be a newer Leaflet option that is not present in cartodb.js)~ I must have been doing this wrong - it works

Auto pan, then center might not be great, but we can try and see how that works.

tomay commented 9 months ago

Done and deployed