Giter VIP home page Giter VIP logo

Comments (3)

Sychic avatar Sychic commented on June 13, 2024

Should be fixed by #75

from elementa.

SashaSemenishchev avatar SashaSemenishchev commented on June 13, 2024

Should be fixed by #75

I wish it’d get merged, it’s more than a year since 😭

from elementa.

Johni0702 avatar Johni0702 commented on June 13, 2024

I've closed the referenced PR as it has several shortcomings that make it unfit for general use.
If it works in your case, you could just create a local copy of it for your use.

Internally we've come to do something similar but with different tradeoffs than that PR, namely that it accounts for all SiblingConstraint-induced padding (or more generally any PaddingConstraint-induced padding) but not any offset induced in any other way. In particular your y = SiblingConstraint(3f) + 5f.pixels (which, given the aren't any preceding siblings (?) is just 5.pixels) wouldn't work. We've come to instead use dummy spacer components of appropriate size whenever we need extra padding at the very start/end.

Here's the relevant part of FillConstraint (at least the width; height works analogous) which we've modified:

        return if (useSiblings) {
            target.getWidth() - target.children.filter { it != component }.sumOf {
                it.getWidth().toDouble() + ((it.constraints.x as? PaddingConstraint)?.getHorizontalPadding(it) ?: 0f).toDouble()
            }.toFloat()
        } else target.getRight() - component.getLeft() + ((target.constraints.x as? PaddingConstraint)?.getHorizontalPadding(target) ?: 0f)

Beware that we only ever use it with useSiblings = true, so that else case is completely untested (and looking at it, idk what that's supposed to do; doesn't look right to me).

from elementa.

Related Issues (20)

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.