fix(gui): wrap PanelClickGui body in Renderer.render so search stays aligned

The previous attempt only made Renderer.render share GuiGraphics.pose()
with DrawContext when guiGraphics was non-null. But every sub-panel
call (drawSearchBar, drawToasts, ModuleListPanel, SettingsPanel,
CategoryBar, ProfileWidget, SettingsPopup, KeybindOverlay,
ScaleSwitchOverlay) used Renderer.renderConsumer, which falls back
to Renderer.render(null, ...) when currentCanvas == null — that's
exactly the Screen.render path. With guiGraphics == null the
DrawContext still got a private new PoseStack(), so any element
rendered through DrawContext was identity-posed while the search
background drawn via guiGraphics.pose() rode along with
pushPose + scale(0.98+0.02*eased), and the two drifted apart.

Wrap the entire PanelClickGui body inside Renderer.render(
guiGraphics, ...). That sets currentCanvas to a DrawContext whose
PoseStack is GuiGraphics.pose(), so every nested renderConsumer
short-circuits into the same DrawContext and shares the same
matrix. Search icon, placeholder, query text and the blinking
cursor now sit on the same scaled pose as the search background.
Toasts get the fix for free.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Shirona1337
2026-05-22 00:38:41 +08:00
parent 7c0eaa1018
commit fc95f56fc8
+12 -7
View File
@@ -144,13 +144,18 @@ extends Screen {
int panelY = centerY - panelHeight / 2;
float effectiveAlpha = this.panelAlpha * dup;
if (effectiveAlpha > 0.005f) {
this.drawPanelGlow(guiGraphics, panelX, panelY, partialTicks, effectiveAlpha);
this.categoryBar.render(guiGraphics, panelX, panelY, mouseX, mouseY, this.currentScale, effectiveAlpha);
this.moduleListPanel.render(guiGraphics, panelX, panelY, mouseX, mouseY, this.getSelectedCategory(), this.currentScale, effectiveAlpha);
this.settingsPanel.render(guiGraphics, panelX, panelY, mouseX, mouseY, this.moduleListPanel.getHoveredModule(), this.currentScale, effectiveAlpha);
this.profileWidget.render(guiGraphics, panelX, panelY, mouseX, mouseY, this.currentScale, effectiveAlpha);
this.drawSearchBar(guiGraphics, panelX, panelY, mouseX, mouseY, effectiveAlpha);
this.drawToasts(guiGraphics, panelX, panelY, effectiveAlpha);
final float finalAlpha = effectiveAlpha;
final int fPanelX = panelX;
final int fPanelY = panelY;
Renderer.render(guiGraphics, drawContext -> {
this.drawPanelGlow(guiGraphics, fPanelX, fPanelY, partialTicks, finalAlpha);
this.categoryBar.render(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, this.currentScale, finalAlpha);
this.moduleListPanel.render(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, this.getSelectedCategory(), this.currentScale, finalAlpha);
this.settingsPanel.render(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, this.moduleListPanel.getHoveredModule(), this.currentScale, finalAlpha);
this.profileWidget.render(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, this.currentScale, finalAlpha);
this.drawSearchBar(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, finalAlpha);
this.drawToasts(guiGraphics, fPanelX, fPanelY, finalAlpha);
});
}
super.render(guiGraphics, mouseX, mouseY, partialTicks);
guiGraphics.pose().popPose();