Skip to content

Align Measure always return maxWidth even when I explicitly set Width #1910

@LittleLittleCloud

Description

@LittleLittleCloud

Information

  • OS: Windows
  • Terminal: [e.g Windows Terminal]

Describe the bug
Align doesn't override measure from Renderable, so it's measured width is always maxWidth. It bothers me when using Align inside Panel with border (Panel border will be expanded no matter if I set Panel width or not)

Potential solution
If it's not by-design, maybe considering override Measure?

    protected override Measurement Measure(RenderOptions options, int maxWidth)
    {
        var width = Math.Min(Width ?? maxWidth, maxWidth);
        var height = Height ?? options.Height;
        var measurement = _renderable.Measure(options with { Height = height }, width);
        return new Measurement(measurement.Min, width);
    }

Please upvote 👍 this issue if you are interested in it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo 🕑

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions