Only query visible layers for tooltips

This should fix #566