Why isn't my UI text aligning right in overlay?

Any idea why HitText isn’t aligning to the right?

image

I want a 2 texts on the top row, one aligned left, one right.

BarSize := vector2{X:= 500.0, Y := 40.0}

return canvas_slot:
    SizeToContent := true
    Offsets := margin:
        Left := (1920.0 - BarSize.X) / 2.0
        Top := 1080.0 - 200.0
    Widget := stack_box:
        Orientation := orientation.Vertical
        Slots := array:
            # Level/Hit
            stack_box_slot:
                HorizontalAlignment := horizontal_alignment.Left
                Widget := overlay:
                    Slots := array:
                        overlay_slot:
                            Widget := LevelText
                            HorizontalAlignment := horizontal_alignment.Left
                        overlay_slot:
                            Widget := HitText
                            HorizontalAlignment := horizontal_alignment.Right
            # Progress Bar
            stack_box_slot:
                Widget := overlay:
                    Slots := array:
                        overlay_slot:
                            Widget := texture_block:
                                DefaultImage := Textures.T_UI_Whitebox128
                                DefaultDesiredSize := BarSize
                                DefaultTint := MakeColorFromHex("#C70000FF")
                        overlay_slot:
                            Widget := ProgressText
            # Next Hit
            stack_box_slot:
                Widget := NextHitText
                HorizontalAlignment := horizontal_alignment.Right

I ended up sorting it myself!

It must have been aligning for the space both the texts took up instead of the whole with of the outer stack. I added an empty canvas with padding to make it the full width.

Here’s what I did for people of the future to look back at.

Widget := overlay:
    Slots := array:
        overlay_slot:
            Widget := canvas{}
            Padding := margin{Left := 500.0}
        overlay_slot:
            Widget := LevelText
            HorizontalAlignment := horizontal_alignment.Left
        overlay_slot:
            Widget := HitText
            HorizontalAlignment := horizontal_alignment.Right

image

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.