Fix scrolling and keep lists clear of the scrollbar
Scroll kept its position as an int, so wheel and trackpad deltas were truncated: small ones were lost in one direction and a wheel notch moved one unit. It now keeps a fractional position, scrolls 24 units a notch, sizes and places its thumb consistently, and the thumb can be dragged or the track clicked. PanelScreen's scrollWidth and scrollContentWidth keep every scrolling list clear of the bar. Sliders read a float step from its text, so 0.1 no longer shows 17 decimals, and show at most three; number boxes show at most three too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -33,7 +33,6 @@ public class ModSettings extends PanelScreen {
|
||||
private static final int PREVIEW_WIDTH = 280;
|
||||
private static final int PREVIEW_MAX_HEIGHT = 220;
|
||||
private static final int COLUMN_GAP = 22;
|
||||
private static final int SCROLLBAR_SPACE = 14;
|
||||
|
||||
private final Mod mod;
|
||||
|
||||
@@ -77,8 +76,9 @@ public class ModSettings extends PanelScreen {
|
||||
}
|
||||
|
||||
Scroll scroll = new Scroll(0).noBackground();
|
||||
PropertyList.draw(scroll, mod.getConfig().getProperties(), Set.of(ENABLED), listWidth, 0);
|
||||
draw(scroll.dimensions(listWidth + SCROLLBAR_SPACE, bodyHeight).position(contentX, bodyY));
|
||||
PropertyList.draw(scroll, mod.getConfig().getProperties(), Set.of(ENABLED), scrollContentWidth(listWidth),
|
||||
0);
|
||||
draw(scroll.dimensions(scrollWidth(listWidth), bodyHeight).position(contentX, bodyY));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user