fix flexo window border offsets (#209)

This commit is contained in:
ThatGamerBlue
2019-05-09 02:38:50 +02:00
committed by Kyleeld
parent ea80c686fd
commit cb19e7d8a1
2 changed files with 16 additions and 1 deletions

View File

@@ -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();
}
}

View File

@@ -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()) {