Added visibility offset

torsten.philipp [04-01-18 - 18:35]
Added visibility offset
Filename
TaosGroupTools/Defaults.lua
TaosGroupTools/i18n/de.lua
TaosGroupTools/i18n/en.lua
TaosGroupTools/i18n/fr.lua
TaosGroupTools/logic/SettingsHandler.lua
TaosGroupTools/ui/SettingsWindow.lua
TaosGroupTools/ui/groupultimate/CompactSwimlaneList.lua
TaosGroupTools/ui/groupultimate/GroupUltimateSelector.lua
TaosGroupTools/ui/groupultimate/SimpleList.lua
TaosGroupTools/ui/groupultimate/SwimlaneList.lua
TaosGroupTools/util/ZOSMockingHelper.lua
diff --git a/TaosGroupTools/Defaults.lua b/TaosGroupTools/Defaults.lua
index 3869451..6ac4d14 100644
--- a/TaosGroupTools/Defaults.lua
+++ b/TaosGroupTools/Defaults.lua
@@ -16,6 +16,7 @@ TGT_DEFAULTS =

     -- Group Ultimate settings
     ["OnlyAva"]                  = false,
+    ["VisibleOffset"]            = 2,
     ["Style"]                    = 3,
     -- Positioning
     ["PosX"]                     = 0,
diff --git a/TaosGroupTools/i18n/de.lua b/TaosGroupTools/i18n/de.lua
index 9b569d7..cae28ed 100644
--- a/TaosGroupTools/i18n/de.lua
+++ b/TaosGroupTools/i18n/de.lua
@@ -19,6 +19,8 @@ local strings = {
     TGT_OPTIONS_STYLE_SHORT_SWIM =       "Kompakte Schwimmbahn-Liste",
     TGT_OPTIONS_SWIMLANES_LABEL =        "Sichtbare Schwimmbahnen auswählen",
     TGT_OPTIONS_SWIMLANES_TOOLTIP =      "Wähle den gewünschten Wert für sichtbare Schwimmbahnen aus. 1-6 Schwimmbahnen möglich.",
+    TGT_OPTIONS_VISIBLE_OFF_LABEL =      "Gruppengröße auswählen.",
+    TGT_OPTIONS_VISIBLE_OFF_TOOLTIP =    "Wähle den gewünschten Wert ab welcher Gruppengröße das UI angezeigt werden soll.",
     TGT_DESCRIPTIONS_NEGATE =            "Magienegation Ultimates der Zauberer Klasse",
     TGT_DESCRIPTIONS_ATRO =              "Atronach Ultimates der Zauberer Klasse",
     TGT_DESCRIPTIONS_OVER =              "Überladung Ultimates der Zauberer Klasse",
diff --git a/TaosGroupTools/i18n/en.lua b/TaosGroupTools/i18n/en.lua
index 1095d6a..1467b6c 100644
--- a/TaosGroupTools/i18n/en.lua
+++ b/TaosGroupTools/i18n/en.lua
@@ -19,6 +19,8 @@ local strings = {
     TGT_OPTIONS_STYLE_SHORT_SWIM =       "Compact Swimlane-List",
     TGT_OPTIONS_SWIMLANES_LABEL =        "Choose visible swimlanes",
     TGT_OPTIONS_SWIMLANES_TOOLTIP =      "Choose your value for visible swimlanes. 1-6 swimlanes are possible.",
+    TGT_OPTIONS_VISIBLE_OFF_LABEL =      "Select Group size.",
+    TGT_OPTIONS_VISIBLE_OFF_TOOLTIP =    "Choose your value of group size for visibility of UI.",
     TGT_DESCRIPTIONS_NEGATE =            "Negate ultimates from Sorcerer class",
     TGT_DESCRIPTIONS_ATRO =              "Atronach ultimates from Sorcerer class",
     TGT_DESCRIPTIONS_OVER =              "Overload ultimates from Sorcerer class",
diff --git a/TaosGroupTools/i18n/fr.lua b/TaosGroupTools/i18n/fr.lua
index 573bbdf..ed1cfa2 100644
--- a/TaosGroupTools/i18n/fr.lua
+++ b/TaosGroupTools/i18n/fr.lua
@@ -19,6 +19,8 @@ local strings = {
     TGT_OPTIONS_STYLE_SHORT_SWIM =       "Compact Swimlane-List",
     TGT_OPTIONS_SWIMLANES_LABEL =        "Choose visible swimlanes",
     TGT_OPTIONS_SWIMLANES_TOOLTIP =      "Choose your value for visible swimlanes. 1-6 swimlanes are possible.",
+    TGT_OPTIONS_VISIBLE_OFF_LABEL =      "Select Group size.",
+    TGT_OPTIONS_VISIBLE_OFF_TOOLTIP =    "Choose your value of group size for visibility of UI.",
     TGT_DESCRIPTIONS_NEGATE =            "Negate ultimates from Sorcerer class",
     TGT_DESCRIPTIONS_ATRO =              "Atronach ultimates from Sorcerer class",
     TGT_DESCRIPTIONS_OVER =              "Overload ultimates from Sorcerer class",
diff --git a/TaosGroupTools/logic/SettingsHandler.lua b/TaosGroupTools/logic/SettingsHandler.lua
index 3a66dee..c16d9d8 100644
--- a/TaosGroupTools/logic/SettingsHandler.lua
+++ b/TaosGroupTools/logic/SettingsHandler.lua
@@ -10,6 +10,7 @@
 TGT_STYLE_CHANGED = "TGT-StyleChanged"
 TGT_MOVABLE_CHANGED = "TGT-MovableChanged"
 TGT_IS_ZONE_CHANGED = "TGT-IsZoneChanged"
+TGT_VISIBLE_OFFSET_CHANGED = "TGT-VisibleOffsetChanged"
 TGT_STATIC_ULTIMATE_ID_CHANGED = "TGT-StaticUltimateIDChanged"
 TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED = "TGT-SwimlaneUltimateGroupIdChanged"
 TGT_SWIMLANES_CHANGED = "TGT-SwimlanesChanged"
@@ -145,6 +146,20 @@ function TGT_SettingsHandler.SetOnlyAvaSettings(onlyAva)
 end

 --[[
+	Sets VisibleOffsetSettings and fires TGT_VISIBLE_OFFSET_CHANGED callbacks
+]]--
+function TGT_SettingsHandler.SetVisibleOffsetSettings(visibleOffset)
+    if (LOG_ACTIVE) then
+        _logger:logTrace("TGT_SettingsHandler.SetVisibleOffsetSettings")
+        _logger:logDebug("visibleOffset", visibleOffset)
+    end
+
+    TGT_SettingsHandler.SavedVariables.VisibleOffset = visibleOffset
+
+    CALLBACK_MANAGER:FireCallbacks(TGT_VISIBLE_OFFSET_CHANGED)
+end
+
+--[[
 	Sets IsSortingActiveSettings settings
 ]]--
 function TGT_SettingsHandler.SetIsSortingActiveSettings(isSortingActive)
diff --git a/TaosGroupTools/ui/SettingsWindow.lua b/TaosGroupTools/ui/SettingsWindow.lua
index 9477145..d68578f 100644
--- a/TaosGroupTools/ui/SettingsWindow.lua
+++ b/TaosGroupTools/ui/SettingsWindow.lua
@@ -86,6 +86,23 @@ function TGT_SettingsWindow.AddGroupUltimateOptions()
 			           end,
 			        default     = styleChoices[TGT_DEFAULTS.Style]
 		        },
+                -- Visible Offset
+                {   type        = "slider",
+                    name        = GetString(TGT_OPTIONS_VISIBLE_OFF_LABEL),
+                    tooltip     = GetString(TGT_OPTIONS_VISIBLE_OFF_TOOLTIP),
+                    min         = 2,
+                    max         = 24,
+                    step        = 1,
+                    getFunc =
+                        function()
+                            return TGT_SettingsHandler.SavedVariables.VisibleOffset
+                        end,
+                    setFunc =
+                        function(value)
+                            TGT_SettingsHandler.SetVisibleOffsetSettings(value)
+                        end,
+                    default     = TGT_DEFAULTS.VisibleOffset,
+                },
                 -- Visible Swimlanes
                 {   type        = "slider",
                     name        = GetString(TGT_OPTIONS_SWIMLANES_LABEL),
diff --git a/TaosGroupTools/ui/groupultimate/CompactSwimlaneList.lua b/TaosGroupTools/ui/groupultimate/CompactSwimlaneList.lua
index 542e1af..b0cc7de 100644
--- a/TaosGroupTools/ui/groupultimate/CompactSwimlaneList.lua
+++ b/TaosGroupTools/ui/groupultimate/CompactSwimlaneList.lua
@@ -16,6 +16,7 @@ local TIMEOUT = 4 -- s; GetTimeStamp() is in seconds

 local _logger = nil
 local _control = nil
+local _isActive = false

 --[[
 	Table CompactSwimlaneList
@@ -33,7 +34,7 @@ TGT_CompactSwimlaneList.Swimlanes = {}
 	Sets visibility of labels
 ]]--
 function TGT_CompactSwimlaneList.RefreshList()
-	if (LOG_ACTIVE) then _logger:logTrace("TGT_CompactSwimlaneList.RefreshList") end
+	--if (LOG_ACTIVE) then _logger:logTrace("TGT_CompactSwimlaneList.RefreshList") end

     -- Check all swimlanes
     for i,swimlane in ipairs(TGT_CompactSwimlaneList.Swimlanes) do
@@ -71,7 +72,7 @@ end
 ]]--
 function TGT_CompactSwimlaneList.UpdateListRow(row, player)
 	if (LOG_ACTIVE) then
-        _logger:logTrace("TGT_CompactSwimlaneList.UpdateListRow")
+        --_logger:logTrace("TGT_CompactSwimlaneList.UpdateListRow")
     end

     local playerName = player.PlayerName
@@ -106,7 +107,7 @@ end
 ]]--
 function TGT_CompactSwimlaneList.UpdatePlayer(player)
 	if (LOG_ACTIVE) then
-        _logger:logTrace("TGT_CompactSwimlaneList.UpdatePlayer")
+        --_logger:logTrace("TGT_CompactSwimlaneList.UpdatePlayer")
     end

 	if (player) then
@@ -135,7 +136,7 @@ function TGT_CompactSwimlaneList.UpdatePlayer(player)

                 if (nextFreeRow <= ROWS) then
                     if (LOG_ACTIVE) then
-                        _logger:logDebug("TGT_CompactSwimlaneList.UpdatePlayer, add player " .. tostring(player.PlayerName) .. " to row " .. tostring(nextFreeRow))
+                        --_logger:logDebug("TGT_CompactSwimlaneList.UpdatePlayer, add player " .. tostring(player.PlayerName) .. " to row " .. tostring(nextFreeRow))
                     end

                     player.LastMapPingTimestamp = GetTimeStamp()
@@ -167,8 +168,8 @@ end
 ]]--
 function TGT_CompactSwimlaneList.GetSwimLane(ultimateGroupId)
     if (LOG_ACTIVE) then
-        _logger:logTrace("TGT_CompactSwimlaneList.GetSwimLane")
-        _logger:logDebug("ultimateGroupId", ultimateGroupId)
+        --_logger:logTrace("TGT_CompactSwimlaneList.GetSwimLane")
+        --_logger:logDebug("ultimateGroupId", ultimateGroupId)
     end

     if (ultimateGroupId ~= 0) then
@@ -178,7 +179,7 @@ function TGT_CompactSwimlaneList.GetSwimLane(ultimateGroupId)
             end
 	    end

-        if (LOG_ACTIVE) then _logger:logDebug("TGT_CompactSwimlaneList.GetSwimLane, swimLane not found " .. tostring(ultimateGroupId)) end
+        --if (LOG_ACTIVE) then _logger:logDebug("TGT_CompactSwimlaneList.GetSwimLane, swimLane not found " .. tostring(ultimateGroupId)) end
         return nil
     else
         _logger:logError("TGT_CompactSwimlaneList.GetSwimLane, ultimateGroupId is 0")
@@ -191,19 +192,19 @@ end
 ]]--
 function TGT_CompactSwimlaneList.GetSwimLaneRow(swimLane, playerName)
     if (LOG_ACTIVE) then
-        _logger:logTrace("TGT_CompactSwimlaneList.GetSwimLaneRow")
-        _logger:logDebug("swimLane ID", swimLane.Id)
+        --_logger:logTrace("TGT_CompactSwimlaneList.GetSwimLaneRow")
+        --_logger:logDebug("swimLane ID", swimLane.Id)
     end

     if (swimLane) then
         for i,player in ipairs(swimLane.Players) do
-            if (LOG_ACTIVE) then _logger:logDebug(player.PlayerName .. " == " .. playerName) end
+            --if (LOG_ACTIVE) then _logger:logDebug(player.PlayerName .. " == " .. playerName) end
 		    if (player.PlayerName == playerName) then
                 return swimLane.SwimlaneControl:GetNamedChild("Row" .. i)
             end
 	    end

-        if (LOG_ACTIVE) then _logger:logDebug("TGT_CompactSwimlaneList.GetSwimLane, player not found " .. tostring(playerName)) end
+        --if (LOG_ACTIVE) then _logger:logDebug("TGT_CompactSwimlaneList.GetSwimLane, player not found " .. tostring(playerName)) end
         return nil
     else
         _logger:logError("TGT_CompactSwimlaneList.GetSwimLane, swimLane is nil")
@@ -216,8 +217,8 @@ end
 ]]--
 function TGT_CompactSwimlaneList.ClearPlayersFromSwimlane(swimlane)
     if (LOG_ACTIVE) then
-        _logger:logTrace("TGT_CompactSwimlaneList.ClearPlayersFromSwimlane")
-        _logger:logDebug("swimlane ID", swimlane.Id)
+        --_logger:logTrace("TGT_CompactSwimlaneList.ClearPlayersFromSwimlane")
+        --_logger:logDebug("swimlane ID", swimlane.Id)
     end

     if (swimlane) then
@@ -231,13 +232,13 @@ function TGT_CompactSwimlaneList.ClearPlayersFromSwimlane(swimlane)
                 local isPlayerUltimateNotCorrect = swimlane.UltimateGroupId ~= swimlanePlayer.UltimateGroup.GroupAbilityId

                 if (isPlayerNotGrouped or isPlayerTimedOut or isPlayerUltimateNotCorrect) then
-                    if (LOG_ACTIVE) then _logger:logDebug("Player invalid, hide row: " .. tostring(i)) end
+                    --if (LOG_ACTIVE) then _logger:logDebug("Player invalid, hide row: " .. tostring(i)) end

                     row:SetHidden(true)
                     table.remove(swimlane.Players, i)
                 end
             else
-                if (LOG_ACTIVE) then _logger:logDebug("Row empty, hide: " .. tostring(i)) end
+                --if (LOG_ACTIVE) then _logger:logDebug("Row empty, hide: " .. tostring(i)) end

                 row:SetHidden(true)
             end
@@ -293,14 +294,21 @@ end
 --[[
 	SetControlHidden sets hidden on control
 ]]--
-function TGT_CompactSwimlaneList.SetControlHidden(isHidden)
+function TGT_CompactSwimlaneList.SetControlHidden()
     if (LOG_ACTIVE) then
         _logger:logTrace("TGT_CompactSwimlaneList.SetControlHidden")
-        _logger:logDebug("isHidden", isHidden)
     end

-    if (GetIsUnitGrouped()) then
-        _control:SetHidden(isHidden)
+    -- Get isActive from settings
+    local isActive = TGT_SettingsHandler.IsCompactSwimlaneListVisible()
+    if (LOG_ACTIVE) then _logger:logDebug("isActive", isActive) end
+
+    if (isActive) then
+        if (GetIsUnitGrouped() and GetGroupSize() >= TGT_SettingsHandler.SavedVariables.VisibleOffset) then
+            _control:SetHidden(CurrentHudHiddenState())
+        else
+            _control:SetHidden(true)
+        end
     else
         _control:SetHidden(true)
     end
@@ -332,35 +340,48 @@ function TGT_CompactSwimlaneList.SetControlActive()
         _logger:logTrace("TGT_CompactSwimlaneList.SetControlActive")
     end

-    local isHidden = TGT_SettingsHandler.IsCompactSwimlaneListVisible() == false
-    if (LOG_ACTIVE) then _logger:logDebug("isHidden", isHidden) end
-
-    TGT_CompactSwimlaneList.SetControlHidden(isHidden or CurrentHudHiddenState())
-
-    if (isHidden) then
-        -- Start timeout timer
-	    EVENT_MANAGER:UnregisterForUpdate(TGT_CompactSwimlaneList.Name)
-
-        CALLBACK_MANAGER:UnregisterCallback(TAO_GROUP_CHANGED, TGT_CompactSwimlaneList.RefreshList)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_CompactSwimlaneList.UpdatePlayer)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_MOVABLE_CHANGED, TGT_CompactSwimlaneList.SetControlMovable)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED, TGT_CompactSwimlaneList.SetSwimlaneUltimate)
-        CALLBACK_MANAGER:UnregisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_CompactSwimlaneList.SetControlHidden)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_SWIMLANES_CHANGED, TGT_CompactSwimlaneList.SetSwimlanesVisible)
+    TGT_CompactSwimlaneList.SetControlHidden()
+
+    -- Get isActive from settings
+    local isActive = TGT_SettingsHandler.IsCompactSwimlaneListVisible()
+    if (LOG_ACTIVE) then _logger:logDebug("isActive", isActive) end
+
+    if (_isActive ~= isActive) then
+        _isActive = isActive
+
+        if (isActive) then
+            if (LOG_ACTIVE) then _logger:logDebug("TGT_CompactSwimlaneList.SetControlActive RegisterCallbacks") end
+
+            TGT_CompactSwimlaneList.SetControlMovable(TGT_SettingsHandler.SavedVariables.Movable)
+            TGT_CompactSwimlaneList.RestorePosition(TGT_SettingsHandler.SavedVariables.PosX, TGT_SettingsHandler.SavedVariables.PosY)
+            TGT_CompactSwimlaneList.SetSwimlanesVisible(TGT_SettingsHandler.SavedVariables.Swimlanes)
+
+            -- Start timeout timer
+	        EVENT_MANAGER:RegisterForUpdate(TGT_CompactSwimlaneList.Name, REFRESHRATE, TGT_CompactSwimlaneList.RefreshList)
+
+            CALLBACK_MANAGER:RegisterCallback(TAO_GROUP_CHANGED, TGT_CompactSwimlaneList.RefreshList)
+            CALLBACK_MANAGER:RegisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_CompactSwimlaneList.UpdatePlayer)
+            CALLBACK_MANAGER:RegisterCallback(TGT_MOVABLE_CHANGED, TGT_CompactSwimlaneList.SetControlMovable)
+            CALLBACK_MANAGER:RegisterCallback(TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED, TGT_CompactSwimlaneList.SetSwimlaneUltimate)
+            CALLBACK_MANAGER:RegisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_CompactSwimlaneList.SetControlHidden)
+            CALLBACK_MANAGER:RegisterCallback(TGT_VISIBLE_OFFSET_CHANGED, TGT_CompactSwimlaneList.SetControlHidden)
+            CALLBACK_MANAGER:RegisterCallback(TGT_SWIMLANES_CHANGED, TGT_CompactSwimlaneList.SetSwimlanesVisible)
+        else
+            if (LOG_ACTIVE) then _logger:logDebug("TGT_CompactSwimlaneList.SetControlActive UnregisterCallbacks") end
+
+            -- Start timeout timer
+	        EVENT_MANAGER:UnregisterForUpdate(TGT_CompactSwimlaneList.Name)
+
+            CALLBACK_MANAGER:UnregisterCallback(TAO_GROUP_CHANGED, TGT_CompactSwimlaneList.RefreshList)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_CompactSwimlaneList.UpdatePlayer)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_MOVABLE_CHANGED, TGT_CompactSwimlaneList.SetControlMovable)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED, TGT_CompactSwimlaneList.SetSwimlaneUltimate)
+            CALLBACK_MANAGER:UnregisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_CompactSwimlaneList.SetControlHidden)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_VISIBLE_OFFSET_CHANGED, TGT_CompactSwimlaneList.SetControlHidden)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_SWIMLANES_CHANGED, TGT_CompactSwimlaneList.SetSwimlanesVisible)
+        end
     else
-        TGT_CompactSwimlaneList.SetControlMovable(TGT_SettingsHandler.SavedVariables.Movable)
-        TGT_CompactSwimlaneList.RestorePosition(TGT_SettingsHandler.SavedVariables.PosX, TGT_SettingsHandler.SavedVariables.PosY)
-        TGT_CompactSwimlaneList.SetSwimlanesVisible(TGT_SettingsHandler.SavedVariables.Swimlanes)
-
-        -- Start timeout timer
-	    EVENT_MANAGER:RegisterForUpdate(TGT_CompactSwimlaneList.Name, REFRESHRATE, TGT_CompactSwimlaneList.RefreshList)
-
-        CALLBACK_MANAGER:RegisterCallback(TAO_GROUP_CHANGED, TGT_CompactSwimlaneList.RefreshList)
-        CALLBACK_MANAGER:RegisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_CompactSwimlaneList.UpdatePlayer)
-        CALLBACK_MANAGER:RegisterCallback(TGT_MOVABLE_CHANGED, TGT_CompactSwimlaneList.SetControlMovable)
-        CALLBACK_MANAGER:RegisterCallback(TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED, TGT_CompactSwimlaneList.SetSwimlaneUltimate)
-        CALLBACK_MANAGER:RegisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_CompactSwimlaneList.SetControlHidden)
-        CALLBACK_MANAGER:RegisterCallback(TGT_SWIMLANES_CHANGED, TGT_CompactSwimlaneList.SetSwimlanesVisible)
+        if (LOG_ACTIVE) then _logger:logDebug("_isActive == isActive; State not changed, do not update") end
     end
 end

diff --git a/TaosGroupTools/ui/groupultimate/GroupUltimateSelector.lua b/TaosGroupTools/ui/groupultimate/GroupUltimateSelector.lua
index 577b1b5..a5a2e6d 100644
--- a/TaosGroupTools/ui/groupultimate/GroupUltimateSelector.lua
+++ b/TaosGroupTools/ui/groupultimate/GroupUltimateSelector.lua
@@ -11,6 +11,7 @@ local LOG_ACTIVE = false

 local _logger = nil
 local _control = nil
+local _isActive = false

 --[[
 	Table GroupUltimateSelector
@@ -128,14 +129,21 @@ end
 --[[
 	SetControlHidden sets hidden on control
 ]]--
-function TGT_GroupUltimateSelector.SetControlHidden(isHidden)
+function TGT_GroupUltimateSelector.SetControlHidden()
     if (LOG_ACTIVE) then
         _logger:logTrace("TGT_GroupUltimateSelector.SetControlHidden")
-        _logger:logDebug("isHidden", isHidden)
     end

-    if (GetIsUnitGrouped()) then
-        _control:SetHidden(isHidden)
+    -- Get isActive from settings
+    local isActive = TGT_SettingsHandler.IsControlsVisible()
+    if (LOG_ACTIVE) then _logger:logDebug("isActive", isActive) end
+
+    if (isActive) then
+        if (GetIsUnitGrouped() and GetGroupSize() >= TGT_SettingsHandler.SavedVariables.VisibleOffset) then
+            _control:SetHidden(CurrentHudHiddenState())
+        else
+            _control:SetHidden(true)
+        end
     else
         _control:SetHidden(true)
     end
@@ -148,24 +156,37 @@ function TGT_GroupUltimateSelector.SetControlActive()
     if (LOG_ACTIVE) then
         _logger:logTrace("TGT_GroupUltimateSelector.SetControlActive")
     end
-
-    local isHidden = TGT_SettingsHandler.IsControlsVisible() == false
-    if (LOG_ACTIVE) then _logger:logDebug("isHidden", isHidden) end
-
-    TGT_GroupUltimateSelector.SetControlHidden(isHidden or CurrentHudHiddenState())
-
-    if (isHidden) then
-        CALLBACK_MANAGER:UnregisterCallback(TGT_MOVABLE_CHANGED, TGT_GroupUltimateSelector.SetControlMovable)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_STATIC_ULTIMATE_ID_CHANGED, TGT_GroupUltimateSelector.SetUltimateIcon)
-        CALLBACK_MANAGER:UnregisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_GroupUltimateSelector.SetControlHidden)
+
+    TGT_GroupUltimateSelector.SetControlHidden()
+
+    -- Get isActive from settings
+    local isActive = TGT_SettingsHandler.IsControlsVisible()
+    if (LOG_ACTIVE) then _logger:logDebug("isActive", isActive) end
+
+    if (_isActive ~= isActive) then
+        _isActive = isActive
+
+        if (isActive) then
+            if (LOG_ACTIVE) then _logger:logDebug("TGT_GroupUltimateSelector.SetControlActive RegisterCallbacks") end
+
+            TGT_GroupUltimateSelector.SetControlMovable(TGT_SettingsHandler.SavedVariables.Movable)
+            TGT_GroupUltimateSelector.RestorePosition(TGT_SettingsHandler.SavedVariables.SelectorPosX, TGT_SettingsHandler.SavedVariables.SelectorPosY)
+            TGT_GroupUltimateSelector.SetUltimateIcon(TGT_SettingsHandler.GetStaticUltimateIDSettings())
+
+            CALLBACK_MANAGER:RegisterCallback(TGT_MOVABLE_CHANGED, TGT_GroupUltimateSelector.SetControlMovable)
+            CALLBACK_MANAGER:RegisterCallback(TGT_STATIC_ULTIMATE_ID_CHANGED, TGT_GroupUltimateSelector.SetUltimateIcon)
+            CALLBACK_MANAGER:RegisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_GroupUltimateSelector.SetControlHidden)
+            CALLBACK_MANAGER:RegisterCallback(TGT_VISIBLE_OFFSET_CHANGED, TGT_GroupUltimateSelector.SetControlHidden)
+        else
+            if (LOG_ACTIVE) then _logger:logDebug("TGT_GroupUltimateSelector.SetControlActive UnregisterCallbacks") end
+
+            CALLBACK_MANAGER:UnregisterCallback(TGT_MOVABLE_CHANGED, TGT_GroupUltimateSelector.SetControlMovable)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_STATIC_ULTIMATE_ID_CHANGED, TGT_GroupUltimateSelector.SetUltimateIcon)
+            CALLBACK_MANAGER:UnregisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_GroupUltimateSelector.SetControlHidden)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_VISIBLE_OFFSET_CHANGED, TGT_GroupUltimateSelector.SetControlHidden)
+        end
     else
-        TGT_GroupUltimateSelector.SetControlMovable(TGT_SettingsHandler.SavedVariables.Movable)
-        TGT_GroupUltimateSelector.RestorePosition(TGT_SettingsHandler.SavedVariables.SelectorPosX, TGT_SettingsHandler.SavedVariables.SelectorPosY)
-        TGT_GroupUltimateSelector.SetUltimateIcon(TGT_SettingsHandler.GetStaticUltimateIDSettings())
-
-        CALLBACK_MANAGER:RegisterCallback(TGT_MOVABLE_CHANGED, TGT_GroupUltimateSelector.SetControlMovable)
-        CALLBACK_MANAGER:RegisterCallback(TGT_STATIC_ULTIMATE_ID_CHANGED, TGT_GroupUltimateSelector.SetUltimateIcon)
-        CALLBACK_MANAGER:RegisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_GroupUltimateSelector.SetControlHidden)
+        if (LOG_ACTIVE) then _logger:logDebug("_isActive == isActive; State not changed, do not update") end
     end
 end

diff --git a/TaosGroupTools/ui/groupultimate/SimpleList.lua b/TaosGroupTools/ui/groupultimate/SimpleList.lua
index 07be286..e308310 100644
--- a/TaosGroupTools/ui/groupultimate/SimpleList.lua
+++ b/TaosGroupTools/ui/groupultimate/SimpleList.lua
@@ -14,6 +14,7 @@ local TIMEOUT = 4 -- s; GetTimeStamp() is in seconds

 local _logger = nil
 local _control = nil
+local _isActive = false
 local _players = {}

 --[[
@@ -224,14 +225,21 @@ end
 --[[
 	SetControlHidden sets hidden on control
 ]]--
-function TGT_SimpleList.SetControlHidden(isHidden)
+function TGT_SimpleList.SetControlHidden()
     if (LOG_ACTIVE) then
         _logger:logTrace("TGT_SimpleList.SetControlHidden")
-        _logger:logDebug("isHidden", isHidden)
     end

-    if (GetIsUnitGrouped()) then
-        _control:SetHidden(isHidden)
+    -- Get isActive from settings
+    local isActive = TGT_SettingsHandler.IsSimpleListVisible()
+    if (LOG_ACTIVE) then _logger:logDebug("isActive", isActive) end
+
+    if (isActive) then
+        if (GetIsUnitGrouped() and GetGroupSize() >= TGT_SettingsHandler.SavedVariables.VisibleOffset) then
+            _control:SetHidden(CurrentHudHiddenState())
+        else
+            _control:SetHidden(true)
+        end
     else
         _control:SetHidden(true)
     end
@@ -244,31 +252,44 @@ function TGT_SimpleList.SetControlActive()
     if (LOG_ACTIVE) then
         _logger:logTrace("TGT_SimpleList.SetControlActive")
     end
-
-    local isHidden = TGT_SettingsHandler.IsSimpleListVisible() == false
-    if (LOG_ACTIVE) then _logger:logDebug("isHidden", isHidden) end

-    TGT_SimpleList.SetControlHidden(isHidden or CurrentHudHiddenState())
+    TGT_SimpleList.SetControlHidden()
+
+    -- Get isActive from settings
+    local isActive = TGT_SettingsHandler.IsSimpleListVisible()
+    if (LOG_ACTIVE) then _logger:logDebug("isActive", isActive) end
+
+    if (_isActive ~= isActive) then
+        _isActive = isActive

-    if (isHidden) then
-		-- Stop timeout timer
-	    EVENT_MANAGER:UnregisterForUpdate(TGT_SimpleList.Name)
+        if (isActive) then
+            if (LOG_ACTIVE) then _logger:logDebug("TGT_SimpleList.SetControlActive RegisterCallbacks") end
+
+            TGT_SimpleList.SetControlMovable(TGT_SettingsHandler.SavedVariables.Movable)
+            TGT_SimpleList.RestorePosition(TGT_SettingsHandler.SavedVariables.PosX, TGT_SettingsHandler.SavedVariables.PosY)
+
+		    -- Start timeout timer
+	        EVENT_MANAGER:RegisterForUpdate(TGT_SimpleList.Name, REFRESHRATE, TGT_SimpleList.RefreshList)

-        CALLBACK_MANAGER:UnregisterCallback(TAO_GROUP_CHANGED, TGT_SimpleList.RefreshList)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_SimpleList.UpdatePlayer)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_MOVABLE_CHANGED, TGT_SimpleList.SetControlMovable)
-        CALLBACK_MANAGER:UnregisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_SimpleList.SetControlHidden)
-    else
-        TGT_SimpleList.SetControlMovable(TGT_SettingsHandler.SavedVariables.Movable)
-        TGT_SimpleList.RestorePosition(TGT_SettingsHandler.SavedVariables.PosX, TGT_SettingsHandler.SavedVariables.PosY)
+            CALLBACK_MANAGER:RegisterCallback(TAO_GROUP_CHANGED, TGT_SimpleList.RefreshList)
+            CALLBACK_MANAGER:RegisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_SimpleList.UpdatePlayer)
+            CALLBACK_MANAGER:RegisterCallback(TGT_MOVABLE_CHANGED, TGT_SimpleList.SetControlMovable)
+            CALLBACK_MANAGER:RegisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_SimpleList.SetControlHidden)
+            CALLBACK_MANAGER:RegisterCallback(TGT_VISIBLE_OFFSET_CHANGED, TGT_SimpleList.SetControlHidden)
+        else
+            if (LOG_ACTIVE) then _logger:logDebug("TGT_SimpleList.SetControlActive UnregisterCallbacks") end

-		-- Start timeout timer
-	    EVENT_MANAGER:RegisterForUpdate(TGT_SimpleList.Name, REFRESHRATE, TGT_SimpleList.RefreshList)
+            -- Stop timeout timer
+	        EVENT_MANAGER:UnregisterForUpdate(TGT_SimpleList.Name)

-        CALLBACK_MANAGER:RegisterCallback(TAO_GROUP_CHANGED, TGT_SimpleList.RefreshList)
-        CALLBACK_MANAGER:RegisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_SimpleList.UpdatePlayer)
-        CALLBACK_MANAGER:RegisterCallback(TGT_MOVABLE_CHANGED, TGT_SimpleList.SetControlMovable)
-        CALLBACK_MANAGER:RegisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_SimpleList.SetControlHidden)
+            CALLBACK_MANAGER:UnregisterCallback(TAO_GROUP_CHANGED, TGT_SimpleList.RefreshList)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_SimpleList.UpdatePlayer)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_MOVABLE_CHANGED, TGT_SimpleList.SetControlMovable)
+            CALLBACK_MANAGER:UnregisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_SimpleList.SetControlHidden)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_VISIBLE_OFFSET_CHANGED, TGT_SimpleList.SetControlHidden)
+        end
+    else
+        if (LOG_ACTIVE) then _logger:logDebug("_isActive == isActive; State not changed, do not update") end
     end
 end

diff --git a/TaosGroupTools/ui/groupultimate/SwimlaneList.lua b/TaosGroupTools/ui/groupultimate/SwimlaneList.lua
index c7db2cc..2d9696a 100644
--- a/TaosGroupTools/ui/groupultimate/SwimlaneList.lua
+++ b/TaosGroupTools/ui/groupultimate/SwimlaneList.lua
@@ -16,6 +16,7 @@ local TIMEOUT = 4 -- s; GetTimeStamp() is in seconds

 local _logger = nil
 local _control = nil
+local _isActive = false

 --[[
 	Table TGT_SwimlaneList
@@ -292,14 +293,21 @@ end
 --[[
 	SetControlHidden sets hidden on control
 ]]--
-function TGT_SwimlaneList.SetControlHidden(isHidden)
+function TGT_SwimlaneList.SetControlHidden()
     if (LOG_ACTIVE) then
         _logger:logTrace("TGT_SwimlaneList.SetControlHidden")
-        _logger:logDebug("isHidden", isHidden)
     end

-    if (GetIsUnitGrouped()) then
-        _control:SetHidden(isHidden)
+    -- Get isActive from settings
+    local isActive = TGT_SettingsHandler.IsSwimlaneListVisible()
+    if (LOG_ACTIVE) then _logger:logDebug("isActive", isActive) end
+
+    if (isActive) then
+        if (GetIsUnitGrouped() and GetGroupSize() >= TGT_SettingsHandler.SavedVariables.VisibleOffset) then
+            _control:SetHidden(CurrentHudHiddenState())
+        else
+            _control:SetHidden(true)
+        end
     else
         _control:SetHidden(true)
     end
@@ -331,35 +339,48 @@ function TGT_SwimlaneList.SetControlActive()
         _logger:logTrace("TGT_SwimlaneList.SetControlActive")
     end

-    local isHidden = TGT_SettingsHandler.IsSwimlaneListVisible() == false
-    if (LOG_ACTIVE) then _logger:logDebug("isHidden", isHidden) end
+    TGT_SwimlaneList.SetControlHidden()

-    TGT_SwimlaneList.SetControlHidden(isHidden or CurrentHudHiddenState())
-
-    if (isHidden) then
-        -- Start timeout timer
-	    EVENT_MANAGER:UnregisterForUpdate(TGT_SwimlaneList.Name)
-
-        CALLBACK_MANAGER:UnregisterCallback(TAO_GROUP_CHANGED, TGT_SwimlaneList.RefreshList)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_SwimlaneList.UpdatePlayer)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_MOVABLE_CHANGED, TGT_SwimlaneList.SetControlMovable)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED, TGT_SwimlaneList.SetSwimlaneUltimate)
-        CALLBACK_MANAGER:UnregisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_SwimlaneList.SetControlHidden)
-        CALLBACK_MANAGER:UnregisterCallback(TGT_SWIMLANES_CHANGED, TGT_SwimlaneList.SetSwimlanesVisible)
+    -- Get isActive from settings
+    local isActive = TGT_SettingsHandler.IsSwimlaneListVisible()
+    if (LOG_ACTIVE) then _logger:logDebug("isActive", isActive) end
+
+    if (_isActive ~= isActive) then
+        _isActive = isActive
+
+        if (isActive) then
+            if (LOG_ACTIVE) then _logger:logDebug("TGT_SwimlaneList.SetControlActive RegisterCallbacks") end
+
+            TGT_SwimlaneList.SetControlMovable(TGT_SettingsHandler.SavedVariables.Movable)
+            TGT_SwimlaneList.RestorePosition(TGT_SettingsHandler.SavedVariables.PosX, TGT_SettingsHandler.SavedVariables.PosY)
+            TGT_SwimlaneList.SetSwimlanesVisible(TGT_SettingsHandler.SavedVariables.Swimlanes)
+
+            -- Start timeout timer
+	        EVENT_MANAGER:RegisterForUpdate(TGT_SwimlaneList.Name, REFRESHRATE, TGT_SwimlaneList.RefreshList)
+
+            CALLBACK_MANAGER:RegisterCallback(TAO_GROUP_CHANGED, TGT_SwimlaneList.RefreshList)
+            CALLBACK_MANAGER:RegisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_SwimlaneList.UpdatePlayer)
+            CALLBACK_MANAGER:RegisterCallback(TGT_MOVABLE_CHANGED, TGT_SwimlaneList.SetControlMovable)
+            CALLBACK_MANAGER:RegisterCallback(TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED, TGT_SwimlaneList.SetSwimlaneUltimate)
+            CALLBACK_MANAGER:RegisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_SwimlaneList.SetControlHidden)
+            CALLBACK_MANAGER:RegisterCallback(TGT_VISIBLE_OFFSET_CHANGED, TGT_SwimlaneList.SetControlHidden)
+            CALLBACK_MANAGER:RegisterCallback(TGT_SWIMLANES_CHANGED, TGT_SwimlaneList.SetSwimlanesVisible)
+        else
+            if (LOG_ACTIVE) then _logger:logDebug("TGT_SwimlaneList.SetControlActive UnregisterCallbacks") end
+
+            -- Start timeout timer
+	        EVENT_MANAGER:UnregisterForUpdate(TGT_SwimlaneList.Name)
+
+            CALLBACK_MANAGER:UnregisterCallback(TAO_GROUP_CHANGED, TGT_SwimlaneList.RefreshList)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_SwimlaneList.UpdatePlayer)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_MOVABLE_CHANGED, TGT_SwimlaneList.SetControlMovable)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED, TGT_SwimlaneList.SetSwimlaneUltimate)
+            CALLBACK_MANAGER:UnregisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_SwimlaneList.SetControlHidden)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_VISIBLE_OFFSET_CHANGED, TGT_SwimlaneList.SetControlHidden)
+            CALLBACK_MANAGER:UnregisterCallback(TGT_SWIMLANES_CHANGED, TGT_SwimlaneList.SetSwimlanesVisible)
+        end
     else
-        TGT_SwimlaneList.SetControlMovable(TGT_SettingsHandler.SavedVariables.Movable)
-        TGT_SwimlaneList.RestorePosition(TGT_SettingsHandler.SavedVariables.PosX, TGT_SettingsHandler.SavedVariables.PosY)
-        TGT_SwimlaneList.SetSwimlanesVisible(TGT_SettingsHandler.SavedVariables.Swimlanes)
-
-        -- Start timeout timer
-	    EVENT_MANAGER:RegisterForUpdate(TGT_SwimlaneList.Name, REFRESHRATE, TGT_SwimlaneList.RefreshList)
-
-        CALLBACK_MANAGER:RegisterCallback(TAO_GROUP_CHANGED, TGT_SwimlaneList.RefreshList)
-        CALLBACK_MANAGER:RegisterCallback(TGT_PLAYER_DATA_CHANGED, TGT_SwimlaneList.UpdatePlayer)
-        CALLBACK_MANAGER:RegisterCallback(TGT_MOVABLE_CHANGED, TGT_SwimlaneList.SetControlMovable)
-        CALLBACK_MANAGER:RegisterCallback(TGT_SWIMLANE_ULTIMATE_GROUP_ID_CHANGED, TGT_SwimlaneList.SetSwimlaneUltimate)
-        CALLBACK_MANAGER:RegisterCallback(TAO_HUD_HIDDEN_STATE_CHANGED, TGT_SwimlaneList.SetControlHidden)
-        CALLBACK_MANAGER:RegisterCallback(TGT_SWIMLANES_CHANGED, TGT_SwimlaneList.SetSwimlanesVisible)
+        if (LOG_ACTIVE) then _logger:logDebug("_isActive == isActive; State not changed, do not update") end
     end
 end

diff --git a/TaosGroupTools/util/ZOSMockingHelper.lua b/TaosGroupTools/util/ZOSMockingHelper.lua
index dfc5195..469f7ae 100644
--- a/TaosGroupTools/util/ZOSMockingHelper.lua
+++ b/TaosGroupTools/util/ZOSMockingHelper.lua
@@ -21,6 +21,7 @@ if (TaosZOSMockingHelper == nil or TaosZOSMockingHelper.Version == nil or TaosZO
     local oldGetUnitName = nil
     local oldIsUnitDead = nil
     local oldIsUnitGrouped = nil
+    local oldGetGroupSize = nil

     --[[
 	    Mocks GetUnitName, returns always playerTag if not "player"
@@ -48,6 +49,13 @@ if (TaosZOSMockingHelper == nil or TaosZOSMockingHelper.Version == nil or TaosZO
     end

     --[[
+	    Mocks GetGroupSize, returns always player in group with 6 players
+    ]]--
+    local function GetGroupSizeMock()
+        return 6
+    end
+
+    --[[
 	    Mocks needed ZOS methods with mock methods
     ]]--
     function MockZOSMethods()
@@ -62,5 +70,9 @@ if (TaosZOSMockingHelper == nil or TaosZOSMockingHelper.Version == nil or TaosZO
         -- Mock IsUnitGrouped
         oldIsUnitGrouped = IsUnitGrouped
         IsUnitGrouped = IsUnitGroupedMock
+
+        -- Mock GetGroupSize
+        oldGetGroupSize = GetGroupSize
+        GetGroupSize = GetGroupSizeMock
     end
 end
\ No newline at end of file