Giter Site home page Giter Site logo

Comments (2)

ebassi avatar ebassi commented on August 26, 2024

If resizing changes the layout it's because the layout as defined by the constraints is not stable; this is usually caused by too few, or contradictory constraints.

Let's break down the VFL:

  • |-[w1(200)]-(>=0)-| expands to:
    • the parent's leading attribute is equal to the leading attribute of w1, minus a constant default spacing
    • the width attribute of w1 is set to be a constant value of 200
    • the trailing attribute of the parent is equal to, or greater than the trailing attribute of w1, plus a constant spacing of 0

All these constraints are set to be required to solve the layout.

This is similar to the line below of |-[w2(300)]-(>=0)-| but the width is now different. The solver will try to size the parent into something that can contain both w1 and w2, but since there's no way to get a stable layout with all these required constraints, you're going to get into an unstable layout.

You can set a priority; for instance, you may want to lower the priority of the spacing between the trailing attribute of w1 and the parent's own trailing attribute; this would give precedence to the constraint between w2 and the parent.

You can also remove the constraint between the trailing attribute of w1 and the trailing attribute of the parent; after all, if you hardcode the width of w1 and you expect w2 to be bigger, then you don't need to attach the trailing edges together.

from emeus.

ptomato avatar ptomato commented on August 26, 2024

I don't understand though why the >= operators don't make the layout stable. You can satisfy all the required constraints with a width of (300 + default spacing). Or am I misunderstanding how the greater-or-equal operator works? It sounds like instead of (>=0) I should be adding a (==0) constraint with a low priority.

from emeus.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.