Skip to content

Commit

Permalink
Reset repositioned tooltip overlays
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Apr 7, 2020
1 parent 6abc433 commit 1fccba9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import net.runelite.client.ui.overlay.WidgetOverlay;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxOverlay;
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
import net.runelite.client.ui.overlay.tooltip.TooltipOverlay;
import net.runelite.client.ui.overlay.worldmap.WorldMapOverlay;
import net.runelite.client.ws.PartyService;
Expand Down Expand Up @@ -127,6 +128,9 @@ public class RuneLite
@Inject
private OverlayManager overlayManager;

@Inject
private TooltipManager tooltipManager;

@Inject
private Provider<PartyService> partyService;

Expand Down Expand Up @@ -336,6 +340,7 @@ public void start() throws Exception
eventBus.register(overlayManager);
eventBus.register(drawManager);
eventBus.register(infoBoxManager);
eventBus.register(tooltipManager);

if (!isOutdated)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,27 @@
*/
package net.runelite.client.ui.overlay.tooltip;

import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.Getter;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;

@Singleton
public class TooltipManager
{
private final ConfigManager configManager;

@Inject
private TooltipManager(final ConfigManager configManager)
{
this.configManager = configManager;
}

@Getter
private final List<Tooltip> tooltips = new ArrayList<>();

Expand All @@ -49,4 +62,17 @@ public void clear()
{
tooltips.clear();
}

@Subscribe
public void onConfigChanged(final ConfigChanged event)
{
// Temporary fix for resetting repositioned tooltip overlay
// TODO: Remove this eventually
if (event.getGroup().equals("runelite") &&
event.getKey().equals("TooltipOverlay_preferredLocation") &&
!Strings.isNullOrEmpty(event.getNewValue()))
{
configManager.unsetConfiguration(event.getGroup(), event.getKey());
}
}
}

0 comments on commit 1fccba9

Please sign in to comment.