v0.9.3: hero info window can now resize if needed

This commit is contained in:
Evan Debenham 2021-06-02 15:35:47 -04:00
parent 6b062399ee
commit 44189726a4

View File

@ -50,7 +50,7 @@ public class WndHeroInfo extends WndTabbed {
private ArmorAbilityInfoTab abilityInfo; private ArmorAbilityInfoTab abilityInfo;
private static int WIDTH = 120; private static int WIDTH = 120;
private static int HEIGHT = 125; private static int MIN_HEIGHT = 125;
private static int MARGIN = 2; private static int MARGIN = 2;
public WndHeroInfo( HeroClass cl ){ public WndHeroInfo( HeroClass cl ){
@ -71,9 +71,12 @@ public class WndHeroInfo extends WndTabbed {
break; break;
} }
int finalHeight = MIN_HEIGHT;
heroInfo = new HeroInfoTab(cl); heroInfo = new HeroInfoTab(cl);
add(heroInfo); add(heroInfo);
heroInfo.setSize(WIDTH, HEIGHT); heroInfo.setSize(WIDTH, MIN_HEIGHT);
finalHeight = (int)Math.max(finalHeight, heroInfo.height());
add( new IconTab( tabIcon ){ add( new IconTab( tabIcon ){
@Override @Override
@ -85,7 +88,8 @@ public class WndHeroInfo extends WndTabbed {
talentInfo = new TalentInfoTab(cl); talentInfo = new TalentInfoTab(cl);
add(talentInfo); add(talentInfo);
talentInfo.setSize(WIDTH, HEIGHT); talentInfo.setSize(WIDTH, MIN_HEIGHT);
finalHeight = (int)Math.max(finalHeight, talentInfo.height());
add( new IconTab( Icons.get(Icons.TALENT) ){ add( new IconTab( Icons.get(Icons.TALENT) ){
@Override @Override
@ -98,7 +102,8 @@ public class WndHeroInfo extends WndTabbed {
if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_2)) { if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_2)) {
subclassInfo = new SubclassInfoTab(cl); subclassInfo = new SubclassInfoTab(cl);
add(subclassInfo); add(subclassInfo);
subclassInfo.setSize(WIDTH, HEIGHT); subclassInfo.setSize(WIDTH, MIN_HEIGHT);
finalHeight = (int)Math.max(finalHeight, subclassInfo.height());
add(new IconTab(new ItemSprite(ItemSpriteSheet.MASK, null)) { add(new IconTab(new ItemSprite(ItemSpriteSheet.MASK, null)) {
@Override @Override
@ -112,7 +117,8 @@ public class WndHeroInfo extends WndTabbed {
if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_4)) { if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_4)) {
abilityInfo = new ArmorAbilityInfoTab(cl); abilityInfo = new ArmorAbilityInfoTab(cl);
add(abilityInfo); add(abilityInfo);
abilityInfo.setSize(WIDTH, HEIGHT); abilityInfo.setSize(WIDTH, MIN_HEIGHT);
finalHeight = (int)Math.max(finalHeight, abilityInfo.height());
add(new IconTab(new ItemSprite(ItemSpriteSheet.CROWN, null)) { add(new IconTab(new ItemSprite(ItemSpriteSheet.CROWN, null)) {
@Override @Override
@ -123,7 +129,7 @@ public class WndHeroInfo extends WndTabbed {
}); });
} }
resize(WIDTH, HEIGHT); resize(WIDTH, finalHeight);
layoutTabs(); layoutTabs();
talentInfo.layout(); talentInfo.layout();
@ -201,6 +207,8 @@ public class WndHeroInfo extends WndTabbed {
pos = info[i].bottom() + 4*MARGIN; pos = info[i].bottom() + 4*MARGIN;
} }
height = Math.max(height, pos - 4*MARGIN);
} }
} }
@ -235,7 +243,9 @@ public class WndHeroInfo extends WndTabbed {
message.maxWidth((int)width); message.maxWidth((int)width);
message.setPos(0, title.bottom()+4*MARGIN); message.setPos(0, title.bottom()+4*MARGIN);
talentPane.setRect(0, message.bottom() + 3*MARGIN, width, height-message.bottom()-3*MARGIN); talentPane.setRect(0, message.bottom() + 3*MARGIN, width, 85);
height = Math.max(height, talentPane.bottom());
} }
} }
@ -294,6 +304,8 @@ public class WndHeroInfo extends WndTabbed {
pos = subClsDescs[i].bottom() + 4*MARGIN; pos = subClsDescs[i].bottom() + 4*MARGIN;
} }
height = Math.max(height, pos - 4*MARGIN);
} }
} }
@ -352,6 +364,8 @@ public class WndHeroInfo extends WndTabbed {
pos = abilityDescs[i].bottom() + 4*MARGIN; pos = abilityDescs[i].bottom() + 4*MARGIN;
} }
height = Math.max(height, pos - 4*MARGIN);
} }
} }