Facepunch / sbox-issues

175 stars 12 forks source link

World Panels clip incorrectly if a background color isn't set #4062

Closed Fortune117 closed 10 months ago

Fortune117 commented 1 year ago

Describe the bug

I'm not actually entirely sure what this bug is but, if I have my world panels without a background color set, they will occasionally clip the text strangely like in this video:

https://github.com/sboxgame/issues/assets/7847372/25a03aba-ffcc-4e64-a5d0-f13991e3637d

But then if I set the background color, the strange clipping does not occur.

https://github.com/sboxgame/issues/assets/7847372/ca2986ad-36c0-429c-9333-ec3cdd986dd8

To Reproduce

  1. Create world panel with the following setup:

    public WorldNumberPanel()
    {
        var size = 300f;
        PanelBounds = new Rect { Width = size, Height = size, Position = new Vector2( -size/2f, -size/2f )};
        WorldScale = 1.5f;
    }
    .world-number-panel
    {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 1;
    
    background-color: rgba(#000, 0.5);
    
    justify-content: center;
    align-items: center;
    
    transition: all 2s ease-in;
    
    .label
    {
    width: 100%;
    height: 100%;
    
    color: white;
    align-items: center;
    text-align: center;
    
    font-family: $font-world-text;
    font-size: 100px;
    text-stroke: 16px black;
    }
    }
    //razor code
    <root class="world-number-panel damage-number">
    <label>50</label>
    </root>
    1. See that changing the background color in the css changes how the panel is clipped.

Expected behavior

Clipping doesn't occur.

Media/Files

No response

Additional context

Sorry Alex!

xezno commented 1 year ago

Can't repro this with the code you've sent

https://github.com/sboxgame/issues/assets/12881812/1c939731-e9b3-41f7-8b47-dd3412177267

Fortune117 commented 1 year ago

Can't repro this with the code you've sent sbox-dev_S7x5VucdCQ.mp4

try upping the font size, started becoming more noticeable at ~150 to 200

No background https://github.com/sboxgame/issues/assets/7847372/b4f9e207-5f77-4882-9fcd-cb55ad6a48f7

With background https://github.com/sboxgame/issues/assets/7847372/de67eef8-a6c5-4794-be08-2bbdd7826f8f

xezno commented 1 year ago

Still doesn't seem to happen, even if I make the text way larger than the panel (pink background, disabled halfway through the video):

https://github.com/sboxgame/issues/assets/12881812/9c4492d1-501b-4a19-8cfd-f97f0843f52c

Adjusting WorldScale, Position, Rotation doesn't cause this to happen either

Fortune117 commented 1 year ago

Alright, did a little testing and it seems to be some combination of the damage number panels and the info panels of the target dummy.

This thing: image

If I stop this panel from being created, I don't see the clipping issue. I could add you to my repo to make testing easier for you if you'd like.

xezno commented 1 year ago

Sure

Fortune117 commented 1 year ago

Done, just drag out a target dummy from the asset browser: image

xezno commented 1 year ago

Thanks