Facepunch / sbox-issues

162 stars 11 forks source link

World Panel out of bounds visibility #3969

Open oniongithub opened 10 months ago

oniongithub commented 10 months ago

Describe the bug

If the origin of a world panel is out of your screen's bounds, it doesn't get rendered even if other parts of it would be visible.

To Reproduce

When you load in pop this for the client

var worldPanel = new Panel3D();
worldPanel.Position = worldPanel.Position + Vector3.Up * 100.0f;
worldPanel.PanelBounds = new Rect { Width = 2500.0f, Height = 2500.0f };

Then the styling I'm using

@using Sandbox;
@using Sandbox.UI;
@using System;

@namespace MyGame
@inherits WorldPanel
@attribute [StyleSheet]

<root>
    <div class="rows">
        <div class="collumns">
            <div class="rows" style="background-color: yellow; border-top-left-radius: 75px;">
            </div>
            <div class="rows" style="background-color: black;">
            </div>
            <div class="rows" style="background-color: yellow; border-bottom-left-radius: 75px;">
            </div>
        </div>
        <div class="collumns">
            <div class="rows" style="background-color: black;">
            </div>
            <div class="rows">
                <WebPanel @ref="video_panel" style="width: 100%; height: 100%;"></WebPanel>
            </div>
            <div class="rows" style="background-color: black;">
            </div>
        </div>
        <div class="collumns">
            <div class="rows" style="background-color: yellow; border-top-right-radius: 75px;">
            </div>
            <div class="rows" style="background-color: black;">
            </div>
            <div class="rows" style="background-color: yellow; border-bottom-right-radius: 75px;">
            </div>
        </div>
    </div>
</root>

@code {
    public WebPanel video_panel { get; set; }

    protected override void OnAfterTreeRender(bool firstTime)
    {
        base.OnAfterTreeRender(firstTime);

        if (firstTime)
        {
            video_panel.Surface.Url = "";
        }
    }

    [GameEvent.Tick]
    public void bigify_panel()
    {
        var rotate_time = 25.0f;
        var rotate_yaw = (float)((RealTime.GlobalNow - rotate_time * Math.Floor(RealTime.GlobalNow / rotate_time)) / rotate_time);
        this.Rotation = Rotation.From(new Angles(rotate_yaw * 360.0f - 180.0f, rotate_yaw * 360.0f - 180.0f, -rotate_yaw * 360.0f - 180.0f));
    }
}

Just go into the world at position 0, 0 and put the point of rotation outside of your screen's bounds and the other parts that should still be visible will disappear.

Expected behavior

I would expect that anything that can be rendered would be rendered, even if the origin point of the world panel is out of your screen's bounds.

Media/Files

https://streamable.com/4gx4a7

Additional context

I'm running:

Windows 11 Home 22H2 build 22621.2134 AMD Ryzen 9 5900X 32GB DDR4 RAM

trundlr commented 3 months ago

This should be triaged