Skip to content

Commit

Permalink
Removed Tooltips#hideAll and shown Seq
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Jan 3, 2024
1 parent d751224 commit e5a3dd8
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 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 @@ -159,13 +158,11 @@ 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));
/**
* Seconds from when an element is hovered to when the tooltip is shown. Default is 2. Call {@link #hideAll()} after changing to
* reset internal state.
* Seconds from when an element is hovered to when the tooltip is shown. Default is 2.
*/
public float initialTime = 2;
/** Once a tooltip is shown, this is used instead of {@link #initialTime}. Default is 0. */
Expand All @@ -176,8 +173,6 @@ public static class Tooltips{
public boolean enabled = true;
/** If false, tooltips will be shown without animations. Default is true. */
public boolean animations = false;
/** The maximum width. The label will wrap if needed. Default is Integer.MAX_VALUE. */
public float maxWidth = Integer.MAX_VALUE;
/** The distance from the mouse position to offset the tooltip element. Default is 15,19. */
public float offsetX = 15, offsetY = 19;
/**
Expand All @@ -204,7 +199,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 @@ -258,7 +252,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 @@ -281,17 +274,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 e5a3dd8

Please sign in to comment.