Ax9D / pw-viz

Pipewire graph editor written in Rust. WIP⚠️
GNU General Public License v3.0
234 stars 14 forks source link

Basic implementation for interaction hints #10

Closed jansol closed 2 years ago

jansol commented 2 years ago

Closes #9

Basic implementation that just statically shows canvas controls at the bottom of the canvas.

I would like to replace the ASCII mouse button and alt key indicators with something more graphical, but while there is no shortage of general keyboard and mouse symbols there don't seem to be any for specific mouse buttons or the alt key. Yes there is ⎇ (U+2387) but I have never actually seen that being used. I expect event the mac equivalent ⌥ (U+2325) to be more widely understood. It seems the best way around this would be to either draw up icons for these and draw them as images among the labels or to craft a custom font that has the symbols in the unicode private use area and use that font for the labels. The font would probably be the better way to handle it since it scales automatically with DPI. I am however not familiar enough with egui so actually figuring out how to implement either solution will take a while. Pointers are welcome.

jansol commented 2 years ago

What the ASCII version looks like in action: image

Ax9D commented 2 years ago

Using font glyphs would indeed probably be better, because of auto scaling as you mentioned, adding a custom font to egui involves creating a custom FontDefinitions and setting it in the Context https://docs.rs/egui/latest/egui/struct.FontDefinitions.html

For font generation, there's icomoon which can create fonts from custom svg icons. I tested the generated fonts with egui, they seem to be working. image

The ascii version is still nice though and works for now, thanks!