Originally Posted by myrroddin
I'm not going to fine-tooth comb the code, but this chunk at line 180 doesn't look like it should work correctly.
Code:
local function updateHeight(self)
local self = getChicchai(self)
if(self.State ~= DOWN) then return end
self.Frame:ScrollToBottom()
self.Frame:SetHeight(getMinHeight(self.Frame))
end
Let me get this straight: - Pass self (presumably the AddOn reference?) to the function updateHeight
- Immediately overwrite self with an entirely new value (why??)
- If the new value is anything other than DOWN, exit out
No wonder self is throwing nil errors. Based on a cursory look at the code, how in the world are you, as a follow-up author, supposed to keep track of what self is referring?
|
I have no idea how it works, the code is really confusing to me. That block of code is the one that's throwing most errors and the only one that straight up breaks the addon to force it into a permanently minimized state.
This chunk at line 151 throws an error sometimes too, and stops the chat frame from being maximized on mouseover. It works after a reload though, so I'm not sure what's wrong.
Lua Code:
local CheckEnterLeave
if(MaximizeOnEnter) then
CheckEnterLeave = function(self)
self = getChicchai(self)
if(MouseIsOver(self.Frame) and not self.wasOver) then
self.wasOver = true
Animate(self, UP, WaitAfterEnter)
elseif(self.wasOver and not MouseIsOver(self.Frame)) then
self.wasOver = nil
Animate(self, DOWN, WaitAfterLeave)
end
end
end