Class OverlayMoveInput

java.lang.Object
privbot.ui.overlay.OverlayMoveInput
All Implemented Interfaces:
AutoCloseable

public final class OverlayMoveInput extends Object implements AutoCloseable
Feeds the game canvas's mouse into an OverlayMoveMode while "Move overlay" is on. Attach it when the mode turns on and close() it when it turns off, so nothing listens the rest of the time.
  • RuneLite (the client is an AWT component): a RuneLite MouseManager listener. Its events are already in game-canvas pixels (stretched mode included), and a consumed press never reaches the game.
  • Impact, Elorin and SpawnPK (no RuneLite MouseManager receives the canvas's mouse there): an OverlayMoveEventFilter pushed on the AWT event queue for client.getCanvas(). It drops the canvas's mouse events over a panel (and during a panel drag), so the game never sees them, and feeds them to the mode. Points are scaled from the canvas component's size to the size the overlay paints in, so a stretched canvas hits the right panel. close() pops it.
Only the left button moves panels; every other button passes through untouched.
  • Method Details

    • attach

      public static OverlayMoveInput attach(net.runelite.api.Client client, net.runelite.client.input.MouseManager mouseManager, OverlayMoveMode mode, Supplier<Dimension> overlayViewport)
      Starts listening, or returns null when there is no mouse source to listen to.
      Parameters:
      mouseManager - RuneLite's, or null where there is none
      overlayViewport - the size the overlay paints in (for scaling canvas-listener points), may give null
    • blocksGameInput

      public boolean blocksGameInput()
      True when a consumed press is kept from the game (both paths now).
    • close

      public void close()
      Stops listening (unregisters the listener or pops the event filter). Safe to call twice.
      Specified by:
      close in interface AutoCloseable