Improved legend for tree-viewer popup. Fixes #390.