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)
|
public synchronized void resetOverlay(final Overlay overlay)
|
||||||
{
|
{
|
||||||
final String locationKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_LOCATION;
|
overlay.setPreferredPosition(null);
|
||||||
final String positionKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_POSITION;
|
overlay.setPreferredSize(null);
|
||||||
final String sizeKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_SIZE;
|
overlay.setPreferredLocation(null);
|
||||||
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, locationKey);
|
saveOverlay(overlay);
|
||||||
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, positionKey);
|
|
||||||
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, sizeKey);
|
|
||||||
rebuildOverlayLayers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void rebuildOverlayLayers()
|
private synchronized void rebuildOverlayLayers()
|
||||||
|
|||||||
@@ -256,9 +256,6 @@ public class OverlayRenderer extends MouseListener implements KeyListener
|
|||||||
// detached overlays have no place to reset back to
|
// detached overlays have no place to reset back to
|
||||||
if (overlay.getPosition() != OverlayPosition.DETACHED)
|
if (overlay.getPosition() != OverlayPosition.DETACHED)
|
||||||
{
|
{
|
||||||
overlay.setPreferredPosition(null);
|
|
||||||
overlay.setPreferredSize(null);
|
|
||||||
overlay.setPreferredLocation(null);
|
|
||||||
overlayManager.resetOverlay(overlay);
|
overlayManager.resetOverlay(overlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user