Reduce code duplicity in resetOverlay method
Use saveOverlay and null all fields to achieve same result. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -191,13 +191,10 @@ public class OverlayManager
|
||||
*/
|
||||
public synchronized void resetOverlay(final Overlay overlay)
|
||||
{
|
||||
final String locationKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_LOCATION;
|
||||
final String positionKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_POSITION;
|
||||
final String sizeKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_SIZE;
|
||||
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, locationKey);
|
||||
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, positionKey);
|
||||
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, sizeKey);
|
||||
rebuildOverlayLayers();
|
||||
overlay.setPreferredPosition(null);
|
||||
overlay.setPreferredSize(null);
|
||||
overlay.setPreferredLocation(null);
|
||||
saveOverlay(overlay);
|
||||
}
|
||||
|
||||
private synchronized void rebuildOverlayLayers()
|
||||
|
||||
@@ -256,9 +256,6 @@ public class OverlayRenderer extends MouseListener implements KeyListener
|
||||
// detached overlays have no place to reset back to
|
||||
if (overlay.getPosition() != OverlayPosition.DETACHED)
|
||||
{
|
||||
overlay.setPreferredPosition(null);
|
||||
overlay.setPreferredSize(null);
|
||||
overlay.setPreferredLocation(null);
|
||||
overlayManager.resetOverlay(overlay);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user