nanogui icon indicating copy to clipboard operation
nanogui copied to clipboard

Grid layout fill alignment not working as expected

Open Mario1159 opened this issue 5 years ago • 0 comments

My screen have attached a grid layout with a resolution of 3, the first widget (tool bar) have a minimum alignment, the second one (image view) a fill alignement and the last one (window with color wheel) a maximum alignment. I expect to see the first widget left aligned with the minimum size that can have to fit each children correctly, as well as the third one but right aligned. The problem is that the image view doesn't take all the space that can fill in the right and left direction as show in the following image:

imagen

Is there something that i'm missing or is it really an issue?

Here is my code:

class Application : public Screen
{
public:
    Application() : Screen(Vector2i(640, 480), "NanoGUI App")
    {
        set_resize_callback([this](Vector2i size) { OnResizeWindow(size); });

        GridLayout *screenLayout = new GridLayout(
            Orientation::Horizontal, 3,
            Alignment::Fill);
        screenLayout->set_row_alignment(Alignment::Fill);
        screenLayout->set_col_alignment(
            {Alignment::Minimum, Alignment::Fill, Alignment::Maximum});
        set_layout(screenLayout);

        Window *toolbar = new Window(this, "");
        // setting up toolbar (...)
        ImageView* imgView = new ImageView(this);
        // uploading image (...)
        Window *rightPanel = new Window(this, "Color wheel");
        // adding stuff to the window (...)
    }
    void OnResizeWindow(nanogui::Vector2i size)
    {
        perform_layout();
    }
};

int main()
{
    nanogui::init();
    Application app;
    app.draw_all();
    app.set_visible(true);
    app.perform_layout();
    nanogui::mainloop(-1.f);
    nanogui::shutdown();
    return 0;
}

Mario1159 avatar Jul 21 '20 04:07 Mario1159