Open penpendede opened 8 years ago
A possible solution would be to at least dynamically choose a fitting size whenever the data available for display in the menu changes (e.g. start, switching language).
It is open to discussion whether to update it whenever the data that is actually shown changes. Imagine that you have quite short category names and lengthy names of individual layers within the categories. You perhaps want to the width of the menu depend on whether the category has been expanded or not.
It should be possible to set a minimal and a maximal width so that the layer selector neither becomes ridiculously narrow or covers most of the map.
One issue is finding out the width of a text measured in pixels. For this it may be helpful to look into http://stackoverflow.com/questions/118241/calculate-text-width-with-javascript
If the text does not fit into the given width it may be a good idea to add a tooltip that shows the full layer name (an approach quite common in other applications).
Currently the layer selector has a pre-defined width. If you add a lengthy layer name you may need to modify this length. And not only that: If the layer names are available in English and Chinese you either have a menu that does not properly fit the English text or one that is much too wide for the Chinese text.