Skip to content

ElementBounds.FixedUnder() Behaviour #45

@tacf

Description

@tacf

Hi,

I was attempting to do some simple ui stacking of elements using the available FixedUnder(). Basically iterating over the same bounds by doing X.FlatCopy().FixedUnder(X) which given the documentation associated with the function was the behaviour i expecetd. Unfortunately i found that there was a cumulative drift wit the elements. Upon digging i found out that as opposed to other similar functions, namely, FixedLeftOf and FixedRightOf the FixedUnder seems to be using += instead of =, hence accumulating and explaining the behavior i'm experiencing. The following lines is the one in question.

public ElementBounds FixedUnder(ElementBounds refBounds, double spacing = 0)
{
fixedY += refBounds.fixedY + refBounds.fixedHeight + spacing;

For reference here are the other similar functions,

public ElementBounds FixedRightOf(ElementBounds refBounds, double leftSpacing = 0)
{
fixedX = refBounds.fixedX + refBounds.fixedWidth + leftSpacing;

public ElementBounds FixedLeftOf(ElementBounds refBounds, double rightSpacing = 0)
{
fixedX = refBounds.fixedX - fixedWidth - rightSpacing;

As im not sure how is the contribution policy for the project, i've opted for not associating a PR with this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions