glato / emerge

Emerge is a browser-based interactive codebase and dependency visualization tool for many different programming languages. It supports some basic code quality and graph metrics and provides a simple and intuitive way to explore and analyze a codebase by using graph structures.
MIT License
783 stars 46 forks source link

Use fixed size node tooltip #42

Closed tonysyu closed 1 year ago

tonysyu commented 1 year ago

Overview

Currently, the tooltip overlay displayed when hovering over a node is scaled with the canvas---if the you zoom out, the overlay shrinks with the nodes; if you zoom in, it grows.

This zooming behavior is not desirable in many cases since the tooltips are meant to be read. If it's too small to read, it's not very useful; if it's larger than the desired font size, then it's taking up unnecessary real estate on the screen. The tooltip should be treated the same way as the menu pane, which remains fixed size.

Current Behavior

For example, here's the current behavior at 0.5x zoom, where the text is barely legible:

current-zoom-factor-0 5

And at 2x zoom, it much more screen space than needed:

current-zoom-factor-2 0

New Behavior

After the changes in this pull request, the tooltip is a fixed size regardless of the zoom level. The same examples of 0.5x and 2x zoom look like the following on this branch:

fixed-scale-zoom-factor-0 5 fixed-scale-zoom-factor-2 0
glato commented 1 year ago

@tonysyu Awesome! That's a super meaningful contribution. Thanks a lot for your work! 💪