[pob2-port] Load Gem tooltips on hover instead of when sorting my DPS (#9049)

* Apply changes from https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/pull/1504

* Fix merge issue

---------

Co-authored-by: LocalIdentity <LocalIdentity@users.noreply.github.com>
Co-authored-by: LocalIdentity <localidentity2@gmail.com>
This commit is contained in:
github-actions[bot]
2025-10-31 00:20:38 +11:00
committed by GitHub
parent b632387dc7
commit 6a59e91a50
2 changed files with 47 additions and 3 deletions

View File

@@ -87,8 +87,6 @@ function GemSelectClass:CalcOutputWithThisGem(calcFunc, gemData, qualityId, useF
if gemInstance.qualityId == nil or gemInstance.qualityId == "" then
gemInstance.qualityId = "Default"
end
-- Add hovered gem to tooltip
self:AddGemTooltip(gemInstance)
-- Calculate the impact of using this gem
local output = calcFunc(nil, useFullDPS)
-- Put the original gem back into the list
@@ -336,7 +334,7 @@ function GemSelectClass:UpdateSortCache()
for gemId, gemData in pairs(self.gems) do
sortCache.dps[gemId] = baseDPS
-- Ignore gems that don't support the active skill
if sortCache.canSupport[gemId] or gemData.grantedEffect.hasGlobalEffect then
if sortCache.canSupport[gemId] or (gemData.grantedEffect.hasGlobalEffect and not gemData.grantedEffect.support) then
local output = self:CalcOutputWithThisGem(calcFunc, gemData, self:GetQualityType(gemId), useFullDPS)
-- Check for nil because some fields may not be populated, default to 0
sortCache.dps[gemId] = (dpsField == "FullDPS" and output[dpsField] ~= nil and output[dpsField]) or (output.Minion and output.Minion.CombinedDPS) or (output[dpsField] ~= nil and output[dpsField]) or 0
@@ -483,6 +481,7 @@ function GemSelectClass:Draw(viewPort, noTooltip)
if calcFunc then
self.tooltip:Clear()
local output, gemInstance = self:CalcOutputWithThisGem(calcFunc, self.gems[self.list[self.hoverSel]], self:GetQualityType(self.list[self.hoverSel]), self.skillsTab.sortGemsByDPSField == "FullDPS")
self:AddGemTooltip(gemInstance)
self.tooltip:AddSeparator(10)
self.skillsTab.build:AddStatComparesToTooltip(self.tooltip, calcBase, output, "^7Selecting this gem will give you:")
self.tooltip:Draw(x, y + height + 2 + (self.hoverSel - 1) * (height - 4) - scrollBar.offset, width, height - 4, viewPort)

View File

@@ -0,0 +1,45 @@
diff a/src/Classes/GemSelectControl.lua b/src/Classes/GemSelectControl.lua (rejected hunks)
@@ -71,8 +71,6 @@ function GemSelectClass:CalcOutputWithThisGem(calcFunc, gemData, useFullDPS)
gemInstance.level = self.skillsTab:ProcessGemLevel(gemData)
gemInstance.gemData = gemData
gemInstance.displayEffect = nil
- -- Add hovered gem to tooltip
- self:AddGemTooltip(gemInstance)
-- Calculate the impact of using this gem
local output = calcFunc(nil, useFullDPS)
-- Put the original gem back into the list
@@ -308,8 +306,8 @@ function GemSelectClass:UpdateSortCache()
for gemId, gemData in pairs(self.gems) do
sortCache.dps[gemId] = baseDPS
-- Ignore gems that don't support the active skill
- if sortCache.canSupport[gemId] or gemData.grantedEffect.hasGlobalEffect then
- local output = self:CalcOutputWithThisGem(calcFunc, gemData, useFullDPS)
+ if sortCache.canSupport[gemId] or (gemData.grantedEffect.hasGlobalEffect and not gemData.grantedEffect.support) then
+ local output = self:CalcOutputWithThisGem(calcFunc, gemData, useFullDPS, fastCalcOptions, calcBase)
-- Check for nil because some fields may not be populated, default to 0
sortCache.dps[gemId] = (dpsField == "FullDPS" and output[dpsField] ~= nil and output[dpsField]) or (output.Minion and output.Minion.CombinedDPS) or (output[dpsField] ~= nil and output[dpsField]) or 0
end
@@ -451,7 +449,22 @@ function GemSelectClass:Draw(viewPort, noTooltip)
local calcFunc, calcBase = self.skillsTab.build.calcsTab:GetMiscCalculator(self.build)
if calcFunc then
self.tooltip:Clear()
- local output = self:CalcOutputWithThisGem(calcFunc, self.gems[self.list[self.hoverSel]], self.skillsTab.sortGemsByDPSField == "FullDPS")
+ local gemData = self.gems[self.list[self.hoverSel]]
+ local output = self:CalcOutputWithThisGem(calcFunc, gemData, self.skillsTab.sortGemsByDPSField == "FullDPS", nil, calcBase)
+ local gemInstance = {
+ level = self.skillsTab:ProcessGemLevel(gemData),
+ quality = self.skillsTab.defaultGemQuality or 0,
+ count = 1,
+ enabled = true,
+ enableGlobal1 = true,
+ enableGlobal2 = true,
+ gemId = gemData.id,
+ nameSpec = gemData.name,
+ skillId = gemData.grantedEffectId,
+ displayEffect = nil,
+ gemData = gemData
+ }
+ self:AddGemTooltip(gemInstance)
self.tooltip:AddSeparator(10)
self.skillsTab.build:AddStatComparesToTooltip(self.tooltip, calcBase, output, "^7Selecting this gem will give you:")
self.tooltip:Draw(x, y + height + 2 + (self.hoverSel - 1) * (height - 4) - scrollBar.offset, width, height - 4, viewPort)