fix record list widget
All checks were successful
Build fabric mod / build (push) Successful in 11m51s

This commit is contained in:
MeexReay 2025-06-18 15:57:29 +03:00
parent c65e906500
commit ac1ee8ec6d

View File

@ -38,20 +38,28 @@ public class RecordListWidget extends ScrollableWidget {
@Override
protected void renderWidget(DrawContext ctx, int mouseX, int mouseY, float delta) {
int y = 0;
ctx.fill(this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.getHeight(), 0xff000000);
ctx.enableScissor(this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.getHeight());
int y = (int) -this.getScrollY();
for (RecordWidget wid: widgets) {
wid.setY(y);
wid.render(ctx, mouseX, (int) (mouseY + this.getScrollY()), delta);
wid.render(ctx, mouseX, (int) (mouseY), delta);
y += wid.getHeight();
y += 2;
}
ctx.disableScissor();
this.drawScrollbar(ctx);
}
public void addWidget(RecordState record) {
RecordWidget widget = new RecordWidget(0, 0, width, 55, record, this);
RecordWidget widget = new RecordWidget(0, 0, width - 6, 55, record, this);
widget.init(null);
widgets.add(0, widget);
widgets.addFirst(widget);
}
public void removeWidget(RecordState record) {
@ -125,7 +133,7 @@ public class RecordListWidget extends ScrollableWidget {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
return checkTransportNF(mouseX, mouseY + getScrollY(), button) || super.mouseClicked(mouseX, mouseY, button);
return checkTransportNF(mouseX, mouseY, button) || super.checkScrollbarDragged(mouseX, mouseY, button);
}
@Override