Skip to content

Commit

Permalink
Fix tooltip mem leak
Browse files Browse the repository at this point in the history
  • Loading branch information
buthed010203 committed Jan 4, 2024
1 parent 6ba4653 commit cfe25db
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions arc-core/src/arc/scene/ui/Tooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import arc.scene.*;
import arc.scene.event.*;
import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*;
import arc.util.Timer.*;

Expand Down Expand Up @@ -154,7 +153,6 @@ public void hide(){
*/
public static class Tooltips{
private static Tooltips instance;
final Seq<Tooltip> shown = new Seq<>();

/** Default text tooltip provider. */
public Func<String, Tooltip> textProvider = text -> new Tooltip(t -> t.add(text));
Expand Down Expand Up @@ -199,7 +197,6 @@ public void run(){
if(stage == null) return;
stage.add(showTooltip.container);
showTooltip.container.toFront();
shown.add(showTooltip);

showTooltip.container.clearActions();
showAction(showTooltip);
Expand Down Expand Up @@ -247,7 +244,6 @@ public void hide(Tooltip tooltip){
showTooltip = null;
showTask.cancel();
if(tooltip.container.hasParent()){
shown.remove(tooltip, true);
hideAction(tooltip);
resetTask.cancel();
Timer.schedule(resetTask, resetTime);
Expand All @@ -270,17 +266,6 @@ protected void hideAction(Tooltip tooltip){
.addAction(sequence(parallel(alpha(0.2f, 0.2f, fade), scaleTo(0.05f, 0.05f, 0.2f, Interp.fade)), remove()));
}

public void hideAll(){
resetTask.cancel();
showTask.cancel();
time = initialTime;
showTooltip = null;

for(Tooltip tooltip : shown)
tooltip.hide();
shown.clear();
}

/** Shows all tooltips on hover without a delay for {@link #resetTime} seconds. */
public void instant(){
time = 0;
Expand Down

0 comments on commit cfe25db

Please sign in to comment.