@@ -132,6 +132,11 @@ local CompareTabClass = newClass("CompareTab", "ControlHost", "Control", functio
132132 -- Scroll offset for scrollable views
133133 self .scrollY = 0
134134
135+ -- Total content height for scroll clamping (populated at end of each Draw* pass)
136+ self .summaryTotalContentHeight = 0
137+ self .itemsTotalContentHeight = 0
138+ self .skillsTotalContentHeight = 0
139+
135140 -- Tree layout cache (set in Draw, used by DrawTree)
136141 self .treeLayout = nil
137142
@@ -2222,11 +2227,17 @@ function CompareTabClass:HandleScrollInput(contentVP, inputEvents)
22222227 inputEvents [id ] = nil
22232228 elseif event .key == " WHEELDOWN" and self .compareViewMode ~= " TREE" then
22242229 local maxScroll = 0
2230+ local viewportH = contentVP .height
22252231 if self .compareViewMode == " CONFIG" and self .configTotalContentHeight then
2226- local scrollViewH = contentVP . height - LAYOUT .configFixedHeaderHeight
2232+ local scrollViewH = viewportH - LAYOUT .configFixedHeaderHeight
22272233 maxScroll = m_max (self .configTotalContentHeight - scrollViewH , 0 )
2228- else
2229- maxScroll = 99999
2234+ elseif self .compareViewMode == " SUMMARY" and self .summaryTotalContentHeight > 0 then
2235+ maxScroll = m_max (self .summaryTotalContentHeight - viewportH , 0 )
2236+ elseif self .compareViewMode == " ITEMS" and self .itemsTotalContentHeight > 0 then
2237+ local scrollViewH = viewportH - LAYOUT .itemsCheckboxOffset
2238+ maxScroll = m_max (self .itemsTotalContentHeight - scrollViewH , 0 )
2239+ elseif self .compareViewMode == " SKILLS" and self .skillsTotalContentHeight > 0 then
2240+ maxScroll = m_max (self .skillsTotalContentHeight - viewportH , 0 )
22302241 end
22312242 self .scrollY = m_min (self .scrollY + 40 , maxScroll )
22322243 inputEvents [id ] = nil
@@ -3027,6 +3038,8 @@ function CompareTabClass:DrawSummary(vp, compareEntry)
30273038
30283039 drawY = drawY + listHeight + 20 -- bottom padding
30293040
3041+ self .summaryTotalContentHeight = drawY + self .scrollY + 36
3042+
30303043 SetViewport ()
30313044end
30323045
@@ -3659,6 +3672,8 @@ function CompareTabClass:DrawItems(vp, compareEntry, inputEvents)
36593672 SetDrawLayer (nil , 0 )
36603673 end
36613674
3675+ self .itemsTotalContentHeight = drawY + self .scrollY + 36
3676+
36623677 SetViewport ()
36633678end
36643679
@@ -4033,6 +4048,8 @@ function CompareTabClass:DrawSkills(vp, compareEntry)
40334048 drawY = drawY + m_max (pFinalGemY - drawY , cFinalGemY - drawY ) + 6
40344049 end
40354050
4051+ self .skillsTotalContentHeight = drawY + self .scrollY + 36
4052+
40364053 SetViewport ()
40374054end
40384055
0 commit comments