Skip to content

Commit

Permalink
pop
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackDeluxeCat committed Jul 17, 2023
1 parent 6957cf9 commit e763783
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mi2u/ui/PopupTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@
public class PopupTable extends Table{
public boolean shown = false;
public float fromx, fromy;
public float popupDuration = 0.15f;

public void popup(int align){
if(shown) return;
Core.scene.add(this);
shown = true;
setTransform(true);
clearActions();
float duration = 0.15f;
if(Align.isTop(align)){
actions(Actions.scaleTo(1f,0f), Actions.translateBy(0f, getPrefHeight()));
actions(Actions.parallel(Actions.scaleTo(1f, 1f, duration, Interp.fade), Actions.translateBy(0f , -getPrefHeight(), duration, Interp.fade), Actions.run(this::keepInScreen)));
actions(Actions.parallel(Actions.scaleTo(1f, 1f, popupDuration, Interp.fade), Actions.translateBy(0f , -getPrefHeight(), popupDuration, Interp.fade), Actions.run(this::keepInScreen)));
}else if(Align.isBottom(align)){
actions(Actions.scaleTo(1f,0f));
actions(Actions.parallel(Actions.scaleTo(1f, 1f, duration, Interp.fade), Actions.run(this::keepInScreen)));
actions(Actions.parallel(Actions.scaleTo(1f, 1f, popupDuration, Interp.fade), Actions.run(this::keepInScreen)));
}else if(Align.isLeft(align)){
actions(Actions.scaleTo(0f,1f));
actions(Actions.parallel(Actions.scaleTo(1f, 1f, duration, Interp.fade), Actions.run(this::keepInScreen)));
actions(Actions.parallel(Actions.scaleTo(1f, 1f, popupDuration, Interp.fade), Actions.run(this::keepInScreen)));
}else if(Align.isRight(align)){
actions(Actions.scaleTo(0f,1f), Actions.translateBy(getPrefWidth(), 0f));
actions(Actions.parallel(Actions.scaleTo(1f, 1f, duration, Interp.fade), Actions.translateBy(-getPrefWidth() , 0f, duration, Interp.fade), Actions.run(this::keepInScreen)));
actions(Actions.parallel(Actions.scaleTo(1f, 1f, popupDuration, Interp.fade), Actions.translateBy(-getPrefWidth() , 0f, popupDuration, Interp.fade), Actions.run(this::keepInScreen)));
}
}

Expand All @@ -45,7 +45,7 @@ public void popup(int align){
public void hide(){
if(!shown) return;
shown = false;
actions(Actions.scaleTo(1f,0f, 0.15f, Interp.fade), Actions.delay(0.15f), Actions.remove());
actions(Actions.scaleTo(1f,0f, popupDuration, Interp.fade), Actions.delay(popupDuration), Actions.remove());
}

public void snapTo(Element e){
Expand Down
1 change: 1 addition & 0 deletions src/mi2u/ui/PowerGraphTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public void rebuild(){

public void showDetailFor(PGInfo info, MI2Bar bar){
detailTable.shown = false;
detailTable.popupDuration = 0.05f;
detailTable.background(Styles.black6);
detailTable.clearChildren();
buildInfo(detailTable, info);
Expand Down

0 comments on commit e763783

Please sign in to comment.