Version 0.9.2 (26-12-2017)

Jarth [12-26-17 - 18:43]
Version 0.9.2 (26-12-2017)
Filename
Changelog
MementoBar.lua
MementoBar.txt
diff --git a/Changelog b/Changelog
index e28409e..e082e1c 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,9 @@
 -------------------------------------------------------------------------------
 Memento bar
 -------------------------------------------------------------------------------
+Version 0.9.2 (26-12-2017)
+- Fixed issue where the border would be visible, when no icons were shown
+
 Version 0.9.1 (18-12-2017)
 - Fixed issue when dragging skills to the hotbar

diff --git a/MementoBar.lua b/MementoBar.lua
index 098a25f..347ea24 100644
--- a/MementoBar.lua
+++ b/MementoBar.lua
@@ -107,25 +107,28 @@ function MementoBar.removeControlToFrame(menuOpen)
 end

 function MementoBar.setButtonFrameWidth()
-  local mbSize = 0
+  local mbBtnHeight = 60
+  local mbBtnWidth = 60
+  local mbCount = 0
+  local mbHeight = 0
+  local mbWidth = 0
+
   for collection in pairs(MementoBar.savedVariables.mementos) do
     if MementoBar.savedVariables.mementos[collection].show then
-      mbSize = mbSize + 1
+      mbCount = mbCount + 1
     end
   end
-  mbSize = math.ceil(mbSize/MementoBar.savedVariables.barDepth)
-  MB_Frame:SetHidden(mbSize == 0)
-  if MementoBar.savedVariables.horizontalOrientation then
-    MB_Frame:SetWidth(60 * mbSize)
-    MB_FrameBackdrop:SetWidth(60 * mbSize)
-    MB_Frame:SetHeight(60 * MementoBar.savedVariables.barDepth)
-    MB_FrameBackdrop:SetHeight(60 * MementoBar.savedVariables.barDepth)
-  else
-    MB_Frame:SetWidth(60 * MementoBar.savedVariables.barDepth)
-    MB_FrameBackdrop:SetWidth(60 * MementoBar.savedVariables.barDepth)
-    MB_Frame:SetHeight(60 * mbSize)
-    MB_FrameBackdrop:SetHeight(60 * mbSize)
-  end
+
+  mbDepth = math.ceil(mbCount / MementoBar.savedVariables.barDepth)
+  mbHeight = MementoBar.savedVariables.horizontalOrientation and mbBtnHeight * MementoBar.savedVariables.barDepth or mbBtnHeight * mbDepth
+  mbWidth = MementoBar.savedVariables.horizontalOrientation and mbBtnWidth * mbDepth or mbBtnWidth * MementoBar.savedVariables.barDepth
+
+  MB_Frame:SetHidden(mbCount == 0)
+  MB_FrameBackdrop:SetHidden(mbCount == 0)
+  MB_Frame:SetHeight(mbHeight)
+  MB_FrameBackdrop:SetHeight(mbHeight)
+  MB_Frame:SetWidth(mbWidth)
+  MB_FrameBackdrop:SetWidth(mbWidth)
 end

 function MementoBar.setupButton(collectionId, MB_Button)
@@ -215,7 +218,7 @@ function MementoBar.CreateSettingsWindow()
 		displayName = "Memento Bar",
 		author = ADDON_AUTHOR,
     version = MementoBar.GetVersion(true),
-		slashCommand = "/sa",
+		slashCommand = "/mb",
 		registerForRefresh = true,
 		registerForDefaults = true,
 	}
@@ -382,8 +385,7 @@ function MementoBar:Initialize()
   end

   MementoBar.RestorePanel()
-  -- Create menu variables.
-  -- ToDo - Merge the following with with setButtonFrameWidth && initializeButtons && saRestorePosition
+  -- Create menu variables.
   MementoBar.CreateSettingsWindow()
   MB_FrameBackdrop:SetCenterColor(unpack(MementoBar.savedVariables.centerColor))
   MB_FrameBackdrop:SetEdgeColor(unpack(MementoBar.savedVariables.edgeColor))
diff --git a/MementoBar.txt b/MementoBar.txt
index 05cfd57..0cd27ab 100644
--- a/MementoBar.txt
+++ b/MementoBar.txt
@@ -6,7 +6,7 @@

 ## APIVersion: 100021
 ## Title: Memento Bar
-## Version: 0.9.1
+## Version: 0.9.2
 ## Author: Jarth
 ## Description: Show a hotbar with selected memento's. Activate by button press!
 ##