fix(ui): authentic tab indexing for skill tree and waypoint panels

This commit is contained in:
troytt 2026-09-23 01:22:51 +00:00
parent 752d7e8066
commit e033ae53e6
4 changed files with 16 additions and 16 deletions

View File

@ -95,9 +95,9 @@ export interface SkillTreeTabInfo {
export const CLASS_VERTICAL_TABS: Record<CharacterClassCode, readonly SkillTreeTabInfo[]> = {
ama: [
{ tab: 0, titleZh: '弓和', subZh: '十字弓', y: 95 },
{ tab: 2, titleZh: '标枪和', subZh: '长矛', y: 95 },
{ tab: 1, titleZh: '被动和', subZh: '魔法', y: 195 },
{ tab: 2, titleZh: '标枪和', subZh: '长矛', y: 295 },
{ tab: 0, titleZh: '弓和', subZh: '十字弓', y: 295 },
],
sor: [
{ tab: 2, titleZh: '冰冷', subZh: '法术', y: 95 },
@ -110,14 +110,14 @@ export const CLASS_VERTICAL_TABS: Record<CharacterClassCode, readonly SkillTreeT
{ tab: 0, titleZh: '诅咒', subZh: '法术', y: 295 },
],
pal: [
{ tab: 0, titleZh: '作战', subZh: '技能', y: 95 },
{ tab: 2, titleZh: '防御', subZh: '灵气', y: 95 },
{ tab: 1, titleZh: '攻击', subZh: '灵气', y: 195 },
{ tab: 2, titleZh: '防御', subZh: '灵气', y: 295 },
{ tab: 0, titleZh: '作战', subZh: '技能', y: 295 },
],
bar: [
{ tab: 0, titleZh: '战斗', subZh: '技能', y: 95 },
{ tab: 2, titleZh: '呐喊', subZh: '技能', y: 95 },
{ tab: 1, titleZh: '战斗', subZh: '专家', y: 195 },
{ tab: 2, titleZh: '呐喊', subZh: '技能', y: 295 },
{ tab: 0, titleZh: '战斗', subZh: '技能', y: 295 },
],
dru: [
{ tab: 2, titleZh: '元素', subZh: '技能', y: 95 },

View File

@ -816,7 +816,7 @@ export class WorldPanelsHud {
for (let i = 0; i < 5; i++) {
const act = i + 1
const active = this.selectedActTab === act
const frameIdx = active ? 5 + i : i
const frameIdx = active ? i * 2 : i * 2 + 1
const sx = frameIdx * 63
const tx = ox + 4 + i * 62
ctx.drawImage(tabsImg, sx, 0, 63, 31, tx, oy + 8, 63, 31)

View File

@ -204,7 +204,7 @@ describe('Issue #379: 7-Class Starter Profiles, Exclusive Sets, Stash Treasures
panel.setClass('pal')
expect(panel.characterClass).toBe('pal')
expect(panel.getSkillTree().length).toBe(30)
expect(panel.getVerticalTabs()[0].titleZh).toBe('作战')
expect(panel.getVerticalTabs()[0].titleZh).toBe('防御')
// Load specific profile state
const profile = createStarterProfileForClass('bar')

View File

@ -96,16 +96,16 @@ describe('Issue #378: Diablo II 1.13c Waypoint Panel Tabs & Icons', () => {
)
// Verify 5 tab draws from mockTabsImg:
// Act 1 (inactive, frame 0 -> sx 0)
// Act 2 (active, frame 6 -> sx 6 * 63 = 378)
// Act 3 (inactive, frame 2 -> sx 2 * 63 = 126)
// Act 4 (inactive, frame 3 -> sx 3 * 63 = 189)
// Act 5 (inactive, frame 4 -> sx 4 * 63 = 252)
// Act 1 (inactive, frame 1 -> sx 1 * 63 = 63)
// Act 2 (active, frame 2 -> sx 2 * 63 = 126)
// Act 3 (inactive, frame 5 -> sx 5 * 63 = 315)
// Act 4 (inactive, frame 7 -> sx 7 * 63 = 441)
// Act 5 (inactive, frame 9 -> sx 9 * 63 = 567)
const tabDraws = drawImageCalls.filter((c) => c[0] === mockTabsImg)
expect(tabDraws.length).toBe(5)
expect(tabDraws[0][1]).toBe(0) // Act 1 sx
expect(tabDraws[1][1]).toBe(6 * 63) // Act 2 (active) sx = 378
expect(tabDraws[2][1]).toBe(2 * 63) // Act 3 sx = 126
expect(tabDraws[0][1]).toBe(1 * 63) // Act 1 (inactive) sx = 63
expect(tabDraws[1][1]).toBe(2 * 63) // Act 2 (active) sx = 126
expect(tabDraws[2][1]).toBe(5 * 63) // Act 3 (inactive) sx = 315
// Verify waypoint icons drawn from mockIconsImg for Act 2 (frame index 1 -> sx 30)
const iconDraws = drawImageCalls.filter((c) => c[0] === mockIconsImg)