Skip to content
8 changes: 6 additions & 2 deletions src/Classes/Control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ function ControlClass:GetPos()
local otherW, otherH = 0, 0
local width, height = 0, 0
local otherPos = anchorPos[self.anchor.otherPoint]
assert(otherPos, "invalid anchor position '"..tostring(self.anchor.otherPoint).."'")
if not otherPos then
error("invalid anchor position '"..tostring(self.anchor.otherPoint).."'", 2)
end
if self.anchor.otherPoint ~= "TOPLEFT" then
otherW, otherH = self.anchor.other:GetSize()
end
local pos = anchorPos[self.anchor.point]
assert(pos, "invalid anchor position '"..tostring(self.anchor.point).."'")
if not pos then
error("invalid anchor position '"..tostring(self.anchor.point).."'", 2)
end
if self.anchor.point ~= "TOPLEFT" then
width, height = self:GetSize()
end
Expand Down
3 changes: 2 additions & 1 deletion src/Classes/ControlHost.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ function ControlHostClass:ProcessControlsInput(inputEvents, viewPort)
end

function ControlHostClass:DrawControls(viewPort, selControl)
local sel = (self.selControl and self.selControl.hasFocus and self.selControl) or (selControl and selControl.hasFocus and selControl)
for _, control in pairs(self.controls) do
if control:IsShown() and control.Draw then
control:Draw(viewPort, (self.selControl and self.selControl.hasFocus and self.selControl ~= control) or (selControl and selControl.hasFocus and selControl ~= control))
control:Draw(viewPort, sel and sel ~= control)
end
end
end
15 changes: 8 additions & 7 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local m_floor = math.floor
local dmgTypeList = {"Physical", "Lightning", "Cold", "Fire", "Chaos"}
local catalystList = {"Abrasive", "Accelerating", "Dextral", "Fertile", "Imbued", "Intrinsic", "Noxious", "Prismatic", "Sinistral", "Tempering", "Turbulent", "Unstable"}
local catalystDescriptorList = {"Attack", "Speed", "Suffix", "Life and Mana", "Caster", "Attribute", "Physical and Chaos", "Resistance", "Prefix", "Defence", "Elemental", "Critical"}
local lineFlagsList = { "unveiled", "prefix", "suffix" }
local catalystTags = {
{ "attack" },
{ "speed" },
Expand Down Expand Up @@ -291,15 +292,15 @@ function ItemClass:FindModifierSubstring(substring, itemSlotName)
--getTagBasedModifiers(substring, itemSlotName)

-- merge various modifier lines into one table
for _,v in pairs(self.explicitModLines) do t_insert(modLines, v) end
for _,v in ipairs(self.explicitModLines) do t_insert(modLines, v) end
if explicit < 1 then
for _,v in pairs(self.enchantModLines) do t_insert(modLines, v) end
for _,v in pairs(self.scourgeModLines) do t_insert(modLines, v) end
for _,v in pairs(self.implicitModLines) do t_insert(modLines, v) end
for _,v in pairs(self.crucibleModLines) do t_insert(modLines, v) end
for _,v in ipairs(self.enchantModLines) do t_insert(modLines, v) end
for _,v in ipairs(self.scourgeModLines) do t_insert(modLines, v) end
for _,v in ipairs(self.implicitModLines) do t_insert(modLines, v) end
for _,v in ipairs(self.crucibleModLines) do t_insert(modLines, v) end
end

for _,v in pairs(modLines) do
for _,v in ipairs(modLines) do
if not v.disabled and self:CheckModLineVariant(v) then
if v.line:lower():find(substring) and not v.line:lower():find(substring .. " modifier") then
local excluded = false
Expand Down Expand Up @@ -1396,7 +1397,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
tagLookup[curTag] = true;
end
-- these aren't actual mod tags but do appear in mod magnitude mods
for _, lineFlag in ipairs({ "unveiled", "prefix", "suffix" }) do
for _, lineFlag in ipairs(lineFlagsList) do
if mod[lineFlag] then
tagLookup[lineFlag] = true
end
Expand Down
7 changes: 6 additions & 1 deletion src/Classes/LabelControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ local LabelClass = newClass("LabelControl", "Control", function(self, anchor, re
self.Control(anchor, rect)
self.label = label
self.width = function()
return DrawStringWidth(self:GetProperty("height"), "VAR", self:GetProperty("label"))
local curLabel = self:GetProperty("label")
if self.cachedLabel ~= curLabel then
self.cachedLabel = curLabel
self.cachedWidth = DrawStringWidth(self:GetProperty("height"), "VAR", curLabel or "")
end
return self.cachedWidth
end
end)

Expand Down
Loading
Loading