Package me.hackware.api.gui
Class ScrollList
java.lang.Object
me.hackware.api.gui.ScrollList
A scrollable, clipped viewport. Holds its own scroll offset (target + smoothed)
and draws a rounded scrollbar thumb, reusing the
ModulePanelComponent
scroll math. The host provides the total content height each frame, draws its
rows at the returned offset inside a begin(me.hackware.api.gui.UiContext, int, int, int, int, int)/end(me.hackware.api.gui.UiContext) pair, and
routes wheel events to mouseScrolled(double, int).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintClamps + animates the scroll, opens the scissor, and returns the pixel offset to add to content Y (negative when scrolled down).intAsbegin(UiContext, int, int, int, int, int), butvClipInsiderounds the viewport's top/bottom clip edges inward so rows can't bleed a pixel over an adjacent divider or border at fractional panel scales.intbeginSnapped(UiContext ui, int x, int y, int w, int h, int contentHeight, boolean vClipInside) Asbegin(UiContext, int, int, int, int, int, boolean), but the offset is snapped to whole GUI pixels and the sub-pixel remainder is exposed viascrollFrac()for the caller to ride on the pose (translate by-scrollFrac()around the row loop).floatCurrent (smoothed) scroll offset from the top of the content.voidDraws the scrollbar thumb (2px pill) with its left edge atx.voidCloses the scissor opened bybegin(me.hackware.api.gui.UiContext, int, int, int, int, int).voidmouseScrolled(double amount, int rowStep) floatHow much scrollable content remains below the viewport (0 = at the end).voidreset()floatSub-panel-pixel scroll remainder from the lastbeginSnapped(me.hackware.api.gui.UiContext, int, int, int, int, int, boolean); ride it on the pose.booleanthumbMouseDragged(double my) booleanthumbMousePressed(double mx, double my) Press near the thumb/track (generous ±4px zone around the 2px pill) starts a drag; pressing the empty track jumps the thumb to the cursor and drags.void
-
Constructor Details
-
ScrollList
public ScrollList()
-
-
Method Details
-
begin
Clamps + animates the scroll, opens the scissor, and returns the pixel offset to add to content Y (negative when scrolled down). -
begin
Asbegin(UiContext, int, int, int, int, int), butvClipInsiderounds the viewport's top/bottom clip edges inward so rows can't bleed a pixel over an adjacent divider or border at fractional panel scales. -
beginSnapped
public int beginSnapped(UiContext ui, int x, int y, int w, int h, int contentHeight, boolean vClipInside) Asbegin(UiContext, int, int, int, int, int, boolean), but the offset is snapped to whole GUI pixels and the sub-pixel remainder is exposed viascrollFrac()for the caller to ride on the pose (translate by-scrollFrac()around the row loop). Entity/item preview blits can only land on the gui-px grid, so without this they jumppanelScalepixels per scroll step and wiggle against the finer-rasterized text; snapping makes rows glide in lockstep at gui-pixel granularity. -
scrollFrac
public float scrollFrac()Sub-panel-pixel scroll remainder from the lastbeginSnapped(me.hackware.api.gui.UiContext, int, int, int, int, int, boolean); ride it on the pose. -
end
Closes the scissor opened bybegin(me.hackware.api.gui.UiContext, int, int, int, int, int). Draw the thumb separately. -
drawThumb
Draws the scrollbar thumb (2px pill) with its left edge atx. -
thumbMousePressed
public boolean thumbMousePressed(double mx, double my) Press near the thumb/track (generous ±4px zone around the 2px pill) starts a drag; pressing the empty track jumps the thumb to the cursor and drags. -
thumbMouseDragged
public boolean thumbMouseDragged(double my) -
thumbMouseReleased
public void thumbMouseReleased() -
remainingScroll
public float remainingScroll()How much scrollable content remains below the viewport (0 = at the end). -
currentScroll
public float currentScroll()Current (smoothed) scroll offset from the top of the content. -
mouseScrolled
public void mouseScrolled(double amount, int rowStep) -
reset
public void reset()
-