diff --git a/runelite-client/src/main/java/net/runelite/client/flexo/Flexo.java b/runelite-client/src/main/java/net/runelite/client/flexo/Flexo.java index a5bc44e85e..3427279226 100644 --- a/runelite-client/src/main/java/net/runelite/client/flexo/Flexo.java +++ b/runelite-client/src/main/java/net/runelite/client/flexo/Flexo.java @@ -52,6 +52,7 @@ public class Flexo extends Robot { public static boolean isActive; public static double scale; public static Client client; + public static ClientUI clientUI; public static int fixedWidth = 765; public static int fixedHeight = 503; public static boolean isStretched; @@ -108,7 +109,7 @@ public class Flexo extends Robot { public synchronized void mouseMove(int x, int y) { try { //TODO: Must be better way to determine titlebar width - currentMouseMotionFactory.build(ClientUI.frame.getX()+x, ClientUI.frame.getY()+y+20).move(); + currentMouseMotionFactory.build(ClientUI.frame.getX()+x+determineHorizontalOffset(), ClientUI.frame.getY()+y+determineVerticalOffset()).move(); this.delay(getMinDelay()); } catch (InterruptedException e) { e.printStackTrace(); @@ -269,5 +270,13 @@ public class Flexo extends Robot { public void delay(int ms) { pauseMS(ms); } + + public int determineHorizontalOffset() { + return clientUI.getCanvasOffset().getX(); + } + + public int determineVerticalOffset() { + return clientUI.getCanvasOffset().getY(); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/flexo/FlexoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/flexo/FlexoPlugin.java index 441af6adab..66a9fb0477 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/flexo/FlexoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/flexo/FlexoPlugin.java @@ -53,6 +53,7 @@ import net.runelite.client.plugins.PluginType; import net.runelite.client.plugins.grounditems.GroundItem; import net.runelite.client.plugins.grounditems.GroundItemsPlugin; import net.runelite.client.plugins.stretchedmode.StretchedModeConfig; +import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.overlay.OverlayManager; import javax.inject.Inject; @@ -80,6 +81,9 @@ public class FlexoPlugin extends Plugin { @Inject private Client client; + + @Inject + private ClientUI clientUI; @Inject private ConfigManager configManager; @@ -112,6 +116,8 @@ public class FlexoPlugin extends Plugin { public void onBeforeRender(BeforeRender event) { if (Flexo.client==null) Flexo.client = client; + if (Flexo.clientUI==null) + Flexo.clientUI = clientUI; overlay.clickAreas = new ArrayList<>(); overlay.clickPoints = new ArrayList<>(); if (getConfig(configManager).getDebugNPCs()) {