From 32b8c87cc5ea3fd1ec684c48f7dedb3273a23135 Mon Sep 17 00:00:00 2001 From: ackis Date: Mon, 11 May 2009 16:30:59 +0000 Subject: [PATCH] Fix Ticket (533) - No error should pop up when you click on the expanded text of the last recipe in this list. --- ARLFrame.lua | 73 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/ARLFrame.lua b/ARLFrame.lua index 1448de2..5ac1cbd 100644 --- a/ARLFrame.lua +++ b/ARLFrame.lua @@ -2408,51 +2408,50 @@ function addon.RecipeItem_OnClick(button) addon:ToggleExcludeRecipe(clickedSpellIndex) ReDisplay() end - -- No modifyer - else - -- three possibilities here - -- 1) We clicked on the recipe button on a closed recipe - -- 2) We clicked on the recipe button of an open recipe - -- 3) we clicked on the expanded text of an open recipe - if (isRecipe) then - if (isExpanded) then - -- get rid of our expanded lines - traverseIndex = clickedIndex + 1 - while (DisplayStrings[traverseIndex].IsRecipe == false) do - tremove(DisplayStrings, traverseIndex) - -- if this is the last entry in the whole list, we should break out - if not DisplayStrings[traverseIndex] then - break - end + -- three possibilities here (all with no modifiers) + -- 1) We clicked on the recipe button on a closed recipe + -- 2) We clicked on the recipe button of an open recipe + -- 3) we clicked on the expanded text of an open recipe + elseif (isRecipe) then + if (isExpanded) then + -- get rid of our expanded lines + traverseIndex = clickedIndex + 1 + while (DisplayStrings[traverseIndex].IsRecipe == false) do + tremove(DisplayStrings, traverseIndex) + -- if this is the last entry in the whole list, we should break out + if not DisplayStrings[traverseIndex] then + break end - DisplayStrings[clickedIndex].IsExpanded = false - else - -- add in our expanded lines - expandEntry(clickedIndex) - -- set our current recipe to expanded - DisplayStrings[clickedIndex].IsExpanded = true end + DisplayStrings[clickedIndex].IsExpanded = false else - -- this inherently implies that we're on an expanded recipe - -- first, back up in the list of buttons until we find our recipe line - traverseIndex = clickedIndex - 1 - while (DisplayStrings[traverseIndex].IsRecipe == false) do - traverseIndex = traverseIndex - 1 - end - -- unexpand it - DisplayStrings[traverseIndex].IsExpanded = false - -- now remove the expanded lines until we get to a recipe again - traverseIndex = traverseIndex + 1 - while (DisplayStrings[traverseIndex].IsRecipe == false) do - tremove(DisplayStrings, traverseIndex) + -- add in our expanded lines + expandEntry(clickedIndex) + -- set our current recipe to expanded + DisplayStrings[clickedIndex].IsExpanded = true + end + else + -- this inherently implies that we're on an expanded recipe + -- first, back up in the list of buttons until we find our recipe line + traverseIndex = clickedIndex - 1 + while (DisplayStrings[traverseIndex].IsRecipe == false) do + traverseIndex = traverseIndex - 1 + end + -- unexpand it + DisplayStrings[traverseIndex].IsExpanded = false + -- now remove the expanded lines until we get to a recipe again + traverseIndex = traverseIndex + 1 + while (DisplayStrings[traverseIndex].IsRecipe == false) do + tremove(DisplayStrings, traverseIndex) + -- if this is the last entry in the whole list, we should break out + if not DisplayStrings[traverseIndex] then + break end end + end -- finally, call our scrollframe updater RecipeList_Update() - - end - end end -- 1.7.9.5