airmash-refugees / airmash-frontend

"Semi-pristine" copy of last official Airmash app
https://airmash.online
43 stars 24 forks source link

Add scalingFactor slider and hotkeys #32

Closed ghost closed 4 years ago

ghost commented 4 years ago

Adds a scalingFactor slider and alternate mode quick toggle.

Normal mode:

image

Alternate:

image

3 new hotkeys (backspace is lame but 0 felt worse, I rebind it locally to Z since my fire key is \ and drop box key is X):

image

Overall UI impact:

Screenshot from 2020-07-09 15-10-15

Normal+alt scaling factor + alt mode toggle state is persisted to settings

congratulatio commented 3 years ago

This is a great improvement, thanks for making this.

I'll soon be updating the airmash.online frontend with this and other recent changes, so I'm taking a second look at the code after playing it for a while. One thing I'm unclear on: why does UI.setScalingFactor set a 100ms delay before Graphics.resizeRenderer is called?

ghost commented 3 years ago

IIRC "bad things happen" if you pump resizeRenderer() too quickly. Really stretching, but IIRC either something becomes extremely laggy (on Chrome / intel gfx / ubuntu 19.04 / non-composited WM) or there are permanent artefacts or similar.

ghost commented 3 years ago

Aah, it's also a leftover from the original code. It was originally a 250ms debounce timer for people dragging window resize with their mouse.

ghost commented 3 years ago

btw I inlined the SVG basically because I was bored. It definitely doesn't fit the rest of the codebase

congratulatio commented 3 years ago

Thanks, sounds good! It's live on airmash.online now. I've added a keybind for quickly returning to the default zoom as well.