Class ScrollList

java.lang.Object
me.hackware.api.gui.ScrollList

public final class ScrollList extends Object
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 Details

    • ScrollList

      public ScrollList()
  • Method Details

    • begin

      public int begin(UiContext ui, int x, int y, int w, int h, int contentHeight)
      Clamps + animates the scroll, opens the scissor, and returns the pixel offset to add to content Y (negative when scrolled down).
    • begin

      public int begin(UiContext ui, int x, int y, int w, int h, int contentHeight, boolean vClipInside)
      As begin(UiContext, int, int, int, int, int), but vClipInside rounds 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)
      As begin(UiContext, int, int, int, int, int, boolean), but the offset is snapped to whole GUI pixels and the sub-pixel remainder is exposed via scrollFrac() 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 jump panelScale pixels 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 last beginSnapped(me.hackware.api.gui.UiContext, int, int, int, int, int, boolean); ride it on the pose.
    • end

      public void end(UiContext ui)
      Closes the scissor opened by begin(me.hackware.api.gui.UiContext, int, int, int, int, int). Draw the thumb separately.
    • drawThumb

      public void drawThumb(UiContext ui, int x, int y, int h)
      Draws the scrollbar thumb (2px pill) with its left edge at x.
    • 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()