Show/hide legend when switching map layers