Optimize rendering of large number of pairs
This commit is contained in:
@@ -22,6 +22,7 @@ public abstract class DrawPairBase
|
||||
_displayHandler = uIDDisplayHandler;
|
||||
}
|
||||
|
||||
public string ImGuiID => _id;
|
||||
public string UID => _pair.UserData.UID;
|
||||
|
||||
public void DrawPairedClient()
|
||||
@@ -30,6 +31,20 @@ public abstract class DrawPairBase
|
||||
var pauseIconSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Play);
|
||||
var textSize = ImGui.CalcTextSize(_pair.UserData.AliasOrUID);
|
||||
|
||||
var startPos = ImGui.GetCursorStartPos();
|
||||
|
||||
var framePadding = ImGui.GetStyle().FramePadding;
|
||||
var lineHeight = textSize.Y + framePadding.Y * 2;
|
||||
|
||||
var off = startPos.Y;
|
||||
var height = UiSharedService.GetWindowContentRegionHeight();
|
||||
|
||||
if ((originalY + off) < -lineHeight || (originalY + off) > height)
|
||||
{
|
||||
ImGui.Dummy(new System.Numerics.Vector2(0f, lineHeight));
|
||||
return;
|
||||
}
|
||||
|
||||
var textPosY = originalY + pauseIconSize.Y / 2 - textSize.Y / 2;
|
||||
DrawLeftSide(textPosY, originalY);
|
||||
ImGui.SameLine();
|
||||
|
||||
Reference in New Issue
Block a user