Clear children in LocationOverlay

Clear children each frame in LocationOverlay to prevent infinite adding
of components there.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-05-07 10:25:23 +02:00
parent 1f17de5d18
commit 2db26a69ff

View File

@@ -46,9 +46,10 @@ public class LocationOverlay extends Overlay
@Inject @Inject
LocationOverlay(Client client, DevToolsPlugin plugin) LocationOverlay(Client client, DevToolsPlugin plugin)
{ {
setPosition(OverlayPosition.TOP_LEFT);
this.client = client; this.client = client;
this.plugin = plugin; this.plugin = plugin;
panelComponent.setPreferredSize(new Dimension(150, 0));
setPosition(OverlayPosition.TOP_LEFT);
} }
@Override @Override
@@ -59,8 +60,7 @@ public class LocationOverlay extends Overlay
return null; return null;
} }
panelComponent.setPreferredSize(new Dimension(150, 0)); panelComponent.getChildren().clear();
WorldPoint localWorld = client.getLocalPlayer().getWorldLocation(); WorldPoint localWorld = client.getLocalPlayer().getWorldLocation();
LocalPoint localPoint = client.getLocalPlayer().getLocalLocation(); LocalPoint localPoint = client.getLocalPlayer().getLocalLocation();