nx10 / httpgd

Asynchronous http server graphics device for R.
https://nx10.github.io/httpgd
GNU General Public License v2.0
379 stars 19 forks source link

restore or indicate "neutral" size #8

Closed r2evans closed 4 years ago

r2evans commented 4 years ago

Nice package! Its timely reveal to me might better enable working in WSL2 where I don't want to rely on an x-server in windows to show the plots. (I still have to test it in wsl2, networking b/w wsl2 and windows is allegedly not always perfect.)

The ability to increase/decrease fonts is nice, but if I had a moment of caffeine-induced impatience and pressed it several times, I don't know how many clicks it takes to restore to "neutral" (default). I can reload the page, but then I lose the image cache.

Two suggestions, not necessarily exclusive:

nx10 commented 4 years ago

Thank you for your suggestion! The R graphic engine is DPI based which makes it a bit hard to define the zoom level in percent. I will think about this further. In the meanwhile I have set up the 0 key on the keyboard to reset zoom level. (You can zoom in and out with + and -)

r2evans commented 4 years ago

With percent, I was thinking "difference from the default value", where 100% means no change, press - once and go to 90% (or however the reduction works internally). I realize in hindsight that there was vagueness: in the first example, the 0 is clickable, meaning "reset to the default zoom; in the second example, the percentage labels were just indicators, not clickables, just to indicate where in the increase/decrease range the display was showing, making it easier numerically to return to default. Sorry about that.

I think adding 0 is a great step, percentage is not critical or wholly necessary. Thanks!

renkun-ken commented 4 years ago

Clicking the zoom level could be made revert to normal, just like it in Firefox and other web browsers:

image
nx10 commented 4 years ago

I have just added the visual zoom level indicator. I also looked at how browsers handle this. Clicking on it resets the zoom level. The displayed value is default scaling factor divided by current scaling factor.

r2evans commented 4 years ago

That actually brings a very interesting point (to me):

To me, that says I don't need the additional +/- buttons on my page, I can instead use the browser-level increase/decrease, get the same effect, and have the browser builtin Ctrl 0 to reset. (Muscle-memory is preserved!)

If the page +/- is intended to be a convenience, calling the same JS mechanisms as the browser, then there is some minor difference. If this is just coincidence, however, then ... I don't know. Regardless, do you need the +/- buttons? I suspect most browsers provide zoom capability themselves, likely with keyboard shortcuts and/or known reset mechanisms.

Unless I am misunderstanding something, you can close this issue. Thanks!

renkun-ken commented 4 years ago

I guess a major use case of +/- buttons is showing the webpage in an R code editor such as showing in a WebView in VSCode. Although VSCode also has zoom just like a browser, but it applies to everything from UI to code.