Version 1.2.3 (18-12-2017)

Jarth [12-18-17 - 17:45]
Version 1.2.3 (18-12-2017)
Filename
Changelog
SummonAssistant.lua
diff --git a/Changelog b/Changelog
index 1208d5f..1380e0e 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,10 @@
 -------------------------------------------------------------------------------
 Summon Assistant
 -------------------------------------------------------------------------------
+Version 1.2.3 (18-12-2017)
+- Added functionality to hide the bar, when in menues
+-- Feature: If the bar is hidden it will become visible when changing the orientation
+
 Version 1.2.2 (17-12-2017)
 - Added functionality to change the orientation the icon bar (Horizontal/Vertical)
 - Fixed issue where the default color would not be set properly
diff --git a/SummonAssistant.lua b/SummonAssistant.lua
index 966beeb..5c8d66c 100644
--- a/SummonAssistant.lua
+++ b/SummonAssistant.lua
@@ -21,6 +21,7 @@ SummonAssistant.wm = GetWindowManager() -- we want to use whatever window manage
 SummonAssistant.name = ADDON_NAME
 SummonAssistant.saCountUnlocked = GetTotalCollectiblesByCategoryType(COLLECTIBLE_CATEGORY_TYPE_ASSISTANT)
 SummonAssistant.SA_Button = {}
+SummonAssistant.Fragment = nil
 SummonAssistant.Default = {
   left = CENTER,
   top = CENTER,
@@ -30,7 +31,8 @@ SummonAssistant.Default = {
   showFence = IsCollectibleUnlocked(300),
   showVendor = IsCollectibleUnlocked(301),
   useAccountSettings = true,
-  horizontalOrientation = true
+  horizontalOrientation = true,
+  hideBarInMenu = true
 }

 -------------------------------------------------------------------------------------------------
@@ -79,6 +81,35 @@ function SummonAssistant.initializeButtons()
   end
 end

+function SummonAssistant.setFragmentBehaviour(menuOpen)
+  if SummonAssistant.Fragment == nil then
+    SummonAssistant.Fragment = ZO_FadeSceneFragment:New( SA_Frame )
+  end
+
+  if SummonAssistant.savedVariables.hideBarInMenu then
+    SummonAssistant.addControlToFrame(menuOpen)
+  else
+    SummonAssistant.removeControlToFrame(menuOpen)
+  end
+end
+
+function SummonAssistant.addControlToFrame(menuOpen)
+  if menuOpen then
+    SA_Frame:SetHidden(true)
+  end
+  SCENE_MANAGER:GetScene('hud'):AddFragment(SummonAssistant.Fragment)
+  SCENE_MANAGER:GetScene('hudui'):AddFragment(SummonAssistant.Fragment)
+end
+
+function SummonAssistant.removeControlToFrame(menuOpen)
+  if menuOpen then
+    SA_Frame:SetHidden(false)
+  end
+
+  SCENE_MANAGER:GetScene('hud'):RemoveFragment(SummonAssistant.Fragment)
+  SCENE_MANAGER:GetScene('hudui'):RemoveFragment(SummonAssistant.Fragment)
+end
+
 function SummonAssistant.setButtonFrameWidth()
   local saSize = 0
   if IsCollectibleUnlocked(267) and SummonAssistant.savedVariables.showBanker then saSize = saSize + 60 end
@@ -152,12 +183,13 @@ function SummonAssistant_OnMoveStop()
   SummonAssistant.savedVariables.left = SA_Frame:GetLeft()
 end

-function SummonAssistant.RestorePanel()
-  -- Set width of SA_Frame
-  SummonAssistant.setButtonFrameWidth()
-  -- Creates and setup of buttons
+function SummonAssistant.RestorePanel()
+  SummonAssistant.setFragmentBehaviour()
+
+  SummonAssistant.setButtonFrameWidth()
+
   SummonAssistant.initializeButtons()
-  -- Restore position of bar
+
   SummonAssistant.saRestorePosition()
 end

@@ -227,6 +259,17 @@ function SummonAssistant.CreateSettingsWindow()
 			end
 		},
 		[5] = {
+			type = "checkbox",
+			name = "Hide bar in menu",
+			tooltip = "When ON the bar will hide when a menu is opened.",
+			default = SummonAssistant.Default.hideBarInMenu,
+			getFunc = function() return SummonAssistant.savedVariables.hideBarInMenu end,
+      setFunc = function(newValue)
+        SummonAssistant.savedVariables.hideBarInMenu = newValue
+        SummonAssistant.setFragmentBehaviour(true)
+			end,
+		},
+		[6] = {
 			type = "submenu",
 			name = "Colors",
 			tooltip = "Allows you to change colors.",
@@ -261,7 +304,7 @@ function SummonAssistant.CreateSettingsWindow()
 				}
 			},
     },
-    [6] = {
+    [7] = {
       type = "submenu",
       name = "Visibility",
       tooltip = "Allows you to choose what assistant buttons you wants to see.",