Class OverlayPlacement

java.lang.Object
privbot.ui.overlay.OverlayPlacement

public final class OverlayPlacement extends Object
Where a flow's overlay panel goes on the game canvas: its anchor plus offsets, clamped inside the viewport, and moved off any panel placed before it.

Offsets are pixels from the anchor, measured inward: on a corner anchor a positive offsetX/offsetY moves the panel away from that corner towards the middle, and the corner itself sits EDGE px in from the canvas edge. FREE-anchor offsets are the panel's top-left in canvas pixels, with no edge margin.

Clamping is what keeps a saved FREE position visible on a smaller (or resized) window: the panel is pushed back inside [0, viewport - size] on both axes; a panel larger than the viewport sits at 0. Overlap with an earlier panel moves the panel below it (above it for the two bottom anchors, which grow upwards), then clamps again; when the viewport has no room left the panels may overlap rather than leave the screen.

Pure: no client, no AWT component, safe on any thread.

  • Field Details

    • EDGE

      public static final int EDGE
      Gap between a corner-anchored panel and the canvas edge.
      See Also:
    • GAP

      public static final int GAP
      Gap between stacked panels.
      See Also:
    • DEFAULT_VIEWPORT_WIDTH

      public static final int DEFAULT_VIEWPORT_WIDTH
      Fixed-size game frame used when the viewport is unknown.
      See Also:
    • DEFAULT_VIEWPORT_HEIGHT

      public static final int DEFAULT_VIEWPORT_HEIGHT
      Height of the fixed-size game frame used when the viewport is unknown.
      See Also:
    • NOMINAL_HEIGHT

      public static final int NOMINAL_HEIGHT
      Height assumed for a panel whose content is unmeasured.
      See Also:
  • Method Details

    • clamp

      public static Rectangle clamp(Rectangle r, Dimension viewport)
      r pushed inside viewport; a side longer than the viewport starts at 0.