python-visualization / branca

This library is a spinoff from folium, that would host the non-map-specific features.
https://python-visualization.github.io/branca/
MIT License
111 stars 63 forks source link

More flexible _parse_size #125

Closed Conengmo closed 1 year ago

Conengmo commented 1 year ago

I wanted to pass a value in pixels to the width and height parameters of Map, but found I couldn't. That seemed weird to me. Turns out there are two issues:

Lengths in CSS can have many units other than '%' or 'px': https://developer.mozilla.org/en-US/docs/Web/CSS/length. I think we should trust our users to know what unit they want to use. Change _parse_size to allow any unit. Add tests.

Other

In another change in folium I'll propose we'll remove the duplicate utility functions and use the ones from branca instead: https://github.com/python-visualization/folium/pull/1676

Why does _parse_size return the value and the unit separately? It makes our templates more verbose. We could just as well make it convert integers to strings, then returning those. But that's a bigger change.