pxt
pxt copied to clipboard
Scale Tutorial Text Alongside Workspace
Fixes https://github.com/microsoft/pxt-minecraft/issues/2050 by making tutorial text size increase when the workspace is zoomed in.
I went through a few different approaches to this. Initially, I hooked into the zoom button events directly, but you could get out of sync if you used "ctrl + mouse wheel" to zoom the workspace, so I decided to track change-in-scale events instead.
I also opted to scale the text relative to zoom % of the workspace (as opposed to increasing/decreasing by a fixed amount on every zoom in/out). I did this because different ways of zooming (mouse wheel vs workspace buttons vs "ctrl +/-" in monaco) would zoom in different amounts, and it looked strange to always use a fixed change to the tutorial-text size regardless. It also led to some unexpected behavior if you zoomed in with one technique but out with another.
Lastly, I prevent the tutorial text from ever shrinking beyond its initial size, just because it gets very hard to read and looks a little silly when that happens. I'm not sure there's a realistic use case for it.
Upload target: https://minecraft.makecode.com/app/bfd4e1e83bcc22c2b26d7062d853a80e4555fb59-9dbaf7a159
not sure if this should be behind a target flag or not. are we sure we'll want this in all targets?
Putting this on hold. Sounds like we probably don't want this - or at the very least, we may only want to scope it to HoC. But even then, browser zoom would be preferable.