Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed (w/h)Align center for containers with min width #396

Conversation

jonah-iden
Copy link
Contributor

@jonah-iden jonah-iden commented Nov 3, 2023

Fixes #106

This fixes center alignment for when the parent node or the compartments parent has a set minWidth.

How to test:
Take the class diagram example
configure the first node as follows (model-source.ts:155)

            layout: 'vbox',
            layoutOptions: {
                minWidth: 200,
            },
            children: [
                <SCompartment>{
                    id: 'node0_header',
                    type: 'comp:header',
                    layout: 'vbox',
                    layoutOptions: {
                        hAlign: 'center',
                    },
                    children: [
                        <SLabel>{
                            id: 'node0_classname',
                            type: 'label:heading',
                            text: 'Foo'
                        },
                        <SLabel>{
                            id: 'node0_classname_2',
                            type: 'label:heading',
                            text: 's'
                        },
                    ]

you shouold now see both text items are aligned correctly in the center. Previous to this fix they would be aligned left even though hAlign center was set

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Copy link
Contributor

@spoenemann spoenemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@spoenemann spoenemann added this to the v1.1.0 milestone Nov 6, 2023
@spoenemann spoenemann merged commit 727c224 into eclipse-sprotty:master Nov 6, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vbox and hbox layout do not center children properly in presence of 'minWidth', 'maxWidth' option
2 participants