DinkydauSet / ExploreFractals

A tool for testing the effect of Mandelbrot set Julia morphings
GNU General Public License v3.0
5 stars 1 forks source link

Consider DPI / windows zoom level #30

Open DinkydauSet opened 3 years ago

DinkydauSet commented 3 years ago

Nana somehow knows the windows zoom level. Setting a weight of 10 on a widget results in the widget being 15 pixels large if the windows zoom level is 150%. I can't find a nana API function to get the DPI / zoom level. I can measure it with this stupid trick:

    double ratio = ([](){
        class test : form {
        public:
            place pl{ *this };
            panel<false> testpanel{ *this };

            test() : form(API::make_center(500, 1))
            {
                pl.div("<x weight=100>");
                pl["x"] << testpanel;
                pl.collocate();
            }
        };

        return test().testpanel.size().width / 100.0;
    })();

    cout << "ratio:  "<< ratio << endl;

by creating an actual form with a widget and asking nana how wide it is in pixels.

I don't really know what to do with the zoom level though. On of the difficult problems is that to do it right, the size of widgets should change when the window is moved to a monitor with a different DPI. Nana takes care of that automatically when widget size is set by weight (instead of pixels). I use pixels for some things to make it easier and I use a text size of 10 points. I don't know if text size in points is automatically adjusted for different DPI.