Version 1.0.4 (14-08-2019)

Jarth [08-14-19 - 14:46]
Version 1.0.4 (14-08-2019)
- Updated APIVersion to 100028
- Changed the drawlevel of buttons, so they now are displayed in front of:
-- Inventory & equipment window
-- Bank, fence and store window
-- Collection bars settings
- Updated how MoveFrames are created and named.
Filename
CBs_Button.xml
CBs_Buttons.lua
CBs_Constants.lua
CBs_Labels.lua
CBs_MoveFrame.lua
Changelog
CollectionBars.txt
CollectionBars.xml
diff --git a/CBs_Button.xml b/CBs_Button.xml
index a23a1ad..1d24a0b 100644
--- a/CBs_Button.xml
+++ b/CBs_Button.xml
@@ -1,6 +1,6 @@
 <GuiXml>
   <Controls>
-    <Control name="CBs_Button" clampedToScreen="true" movable="false" virtual="true">
+    <Control name="CBs_Button" clampedToScreen="true" movable="false" virtual="true" level="4">
       <Controls>
         <Button name="$(parent)Button" mouseOverBlendMode="ADD">
           <AnchorFill />
diff --git a/CBs_Buttons.lua b/CBs_Buttons.lua
index 901ceae..a45009f 100644
--- a/CBs_Buttons.lua
+++ b/CBs_Buttons.lua
@@ -26,7 +26,6 @@ function base.GetFrame(name, virtual)
         frame = base.WM:CreateControlFromVirtual(name, GuiRoot, virtual)
     end

-    frame:SetDrawLayer(5)
     return frame
 end

diff --git a/CBs_Constants.lua b/CBs_Constants.lua
index 72582ab..0a9f9a9 100644
--- a/CBs_Constants.lua
+++ b/CBs_Constants.lua
@@ -12,7 +12,7 @@ CollectionBars = {
         DisplayName = "Collection Bars",
         Abbreviation = "CBs",
         Version = 1.0,
-        MinorVersion = 0.3,
+        MinorVersion = 0.4,
         Command = "/cb_menu",
         SettingsSlash = "/cb",
         Author = "Jarth",
diff --git a/CBs_Labels.lua b/CBs_Labels.lua
index b206b41..2b1438e 100644
--- a/CBs_Labels.lua
+++ b/CBs_Labels.lua
@@ -15,26 +15,24 @@ function base.SetupLabel(_type)
         _type.FrameLabel = GetControl(base.Global.HideAllId .. _type.Name)
         if _type.FrameLabel == nil then
             _type.FrameLabel = base.WM:CreateControlFromVirtual(base.Global.HideAllId, _type.Frame, base.Global.HideAllId, _type.Name)
-            _type.FrameLabel:SetDrawLevel(2)
         end
     end
+
     _type.FrameLabel:SetHidden(not _type.Saved.LabelShow and not _type.Saved.IsCombined)

     _type.FrameToggleSettings = GetControl(base.Global.HideAllId .. _type.Name .. "ToggleSettings")
     _type.FrameLabelButton = GetControl(base.Global.HideAllId .. _type.Name .. "Button")
     if _type.FrameLabelButton ~= nil then
         _type.FrameLabelButton:SetHandler("OnClicked", function(_, button)
-            if button == MOUSE_BUTTON_INDEX_LEFT then
-                if _type.Saved.HideAllEnabled or _type.Saved.IsCombined then
-                    _type.Saved.HideAll = not _type.Saved.HideAll
-                    if _type.Saved.IsCombined then
-                        base.HideOthers(_type)
-                    end
-                    base.RestoreFrame(_type)
-                    base.RestoreCombine()
-                end
-            elseif button == MOUSE_BUTTON_INDEX_RIGHT then
+            if button == MOUSE_BUTTON_INDEX_RIGHT then
                 base.ToggleEnableSettings()
+            elseif button == MOUSE_BUTTON_INDEX_LEFT and _type.Saved.HideAllEnabled or _type.Saved.IsCombined then
+                _type.Saved.HideAll = not _type.Saved.HideAll
+                if _type.Saved.IsCombined then
+                    base.HideOthers(_type)
+                end
+                base.RestoreFrame(_type)
+                base.RestoreCombine()
             end
         end)
     end
@@ -44,8 +42,8 @@ end

 function base.RestoreLabel(_type)
     local label = _type.Saved.Label
-
     local frameLabel = _type.FrameLabel
+
     if frameLabel ~= nil then
         frameLabel:ClearAnchors()
         frameLabel:SetHeight(label.Height)
diff --git a/CBs_MoveFrame.lua b/CBs_MoveFrame.lua
index 682d7a6..4a5867a 100644
--- a/CBs_MoveFrame.lua
+++ b/CBs_MoveFrame.lua
@@ -70,7 +70,8 @@ end

 function base.GetOrCreateMoveFrame(targetFrame, _type)
     if _type.MoveFrame == nil then
-        local newMoveFrame = base.WM:CreateControlFromVirtual(nil, GuiRoot, base.Addon.Abbreviation .. "_MoveFrame")
+        local moveFrameName = _type.Name .. "_MoveFrame"
+        local newMoveFrame = base.WM:CreateControlFromVirtual(moveFrameName, GuiRoot, base.Addon.Abbreviation .. "_MoveFrame")

         -- Variable is used to define what savedVariable the Frame refers to.
         newMoveFrame.TargetFrame = targetFrame
@@ -101,33 +102,25 @@ function base.GetOrCreateMoveFrame(targetFrame, _type)
             frame.labelTopLeft:SetColor(0.9, 0.9, 0.9, 0.9)
         end

-        newMoveFrame:SetDimensions(targetFrame:GetWidth(), targetFrame:GetHeight())
-        newMoveFrame:SetDrawLayer(4)
+        newMoveFrame:SetAnchorFill(targetFrame)
         newMoveFrame:SetParent(GuiRoot)

-        -- overlay
+        -- -- overlay
         if newMoveFrame.overlay == nil then
-            newMoveFrame.overlay = base.WM:CreateControl(nil, newMoveFrame, CT_BACKDROP)
+            newMoveFrame.overlay = GetControl(moveFrameName .. "BG")
         end
-        newMoveFrame.overlay:SetDrawLevel(2)
-        newMoveFrame.overlay:SetAnchorFill(targetFrame)
-        newMoveFrame.overlay:SetEdgeTexture("", 8, 1, 0)
-
-        -- label
-        local function GetLabel(frameType, alignment)
-            local frame = newMoveFrame[frameType]
-            if frame == nil then
-                frame = base.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
-            end
-            frame:SetDrawLevel(3)
-            frame:SetAnchorFill(targetFrame)
-            frame:SetFont("ZoFontWinH5")
-            frame:SetHorizontalAlignment(alignment)
-            frame:SetVerticalAlignment(alignment)
-            return frame
+
+        -- labels
+        if newMoveFrame.labelTopLeft == nil or newMoveFrame.labelCenter == nil then
+            newMoveFrame.labelTopLeft = GetControl(moveFrameName .. "LabelTopLeft")
+            newMoveFrame.labelTopLeft:SetHorizontalAlignment(TEXT_ALIGN_LEFT)
+            newMoveFrame.labelTopLeft:SetVerticalAlignment(TEXT_ALIGN_TOP)
+
+            newMoveFrame.labelCenter = GetControl(moveFrameName .. "LabelCenter")
+            newMoveFrame.labelCenter:SetHorizontalAlignment(TEXT_ALIGN_CENTER)
+            newMoveFrame.labelCenter:SetVerticalAlignment(TEXT_ALIGN_CENTER)
         end
-        newMoveFrame.labelCenter = GetLabel("labelCenter", TEXT_ALIGN_CENTER)
-        newMoveFrame.labelTopLeft = GetLabel(TEXT_ALIGN_LEFT)
+
         _type.MoveFrame = newMoveFrame
     end

diff --git a/Changelog b/Changelog
index 5e352c5..99759d9 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,14 @@
 -------------------------------------------------------------------------------
  Collection bars
 -------------------------------------------------------------------------------
+Version 1.0.4 (14-08-2019)
+- Updated APIVersion to 100028
+- Changed the drawlevel of buttons, so they now are displayed in front of:
+-- Inventory & equipment window
+-- Bank, fence and store window
+-- Collection bars settings
+- Updated how MoveFrames are created and named.
+
 Version 1.0.3 (23-06-2019)
 - Updated bindings, so they update when a key is remapped in ESO settings
 - Made LibAddonMenu-2.0 Optional
diff --git a/CollectionBars.txt b/CollectionBars.txt
index 7e2942e..ffda3f7 100644
--- a/CollectionBars.txt
+++ b/CollectionBars.txt
@@ -4,9 +4,9 @@
 ; States and/or other countries. All rights reserved.
 ; You can read the full terms at https://account.elderscrollsonline.com/add-on-terms

-## APIVersion: 100027
+## APIVersion: 100028
 ## Title: Collection Bars
-## Version: 1.0.3
+## Version: 1.0.4
 ## Author: Jarth
 ## Description: Show collection bars and activate collections with key or button press. Shortcuts: Settings window: /cb LibAddonMenu: /cb_menu
 ##
diff --git a/CollectionBars.xml b/CollectionBars.xml
index 918186d..ce8d9e5 100644
--- a/CollectionBars.xml
+++ b/CollectionBars.xml
@@ -1,16 +1,28 @@
 <GuiXml>
   <Controls>
-    <TopLevelControl name="CBs_MoveFrame" clampedToScreen="true" movable="true" mouseEnabled="true" virtual="true" />
-    <TopLevelControl name="CBs_CombineFrame" clampedToScreen="true" movable="false" mouseEnabled="true" virtual="true">
+    <TopLevelControl name="CBs_MoveFrame" clampedToScreen="true" movable="true" mouseEnabled="true" virtual="true" level="4">
+      <Controls>
+        <Backdrop name="$(parent)BG" level="2" >
+          <AnchorFill />
+        </Backdrop>
+        <Label name="$(parent)LabelTopLeft" wrapMode="ELLIPSIS" tier="HIGH" font="ZoFontWinH5" level="3">
+          <AnchorFill />
+        </Label>
+        <Label name="$(parent)LabelCenter" wrapMode="ELLIPSIS" tier="HIGH" font="ZoFontWinH5" level="3">
+          <AnchorFill />
+        </Label>
+      </Controls>
+    </TopLevelControl>
+    <TopLevelControl name="CBs_CombineFrame" clampedToScreen="true" movable="false" mouseEnabled="true" virtual="true" level="3">
       <Anchor point="CENTER" relativePoint="CENTER" relativeTo="GuiRoot"/>
       <Controls>
         <Control name="$(parent)HideAll" clampedToScreen="true" />
       </Controls>
     </TopLevelControl>
-    <TopLevelControl name="CBs_Frame" clampedToScreen="true" movable="false" mouseEnabled="true" virtual="true">
+    <TopLevelControl name="CBs_Frame" clampedToScreen="true" movable="false" mouseEnabled="true" virtual="true" level="3">
       <Anchor point="CENTER" relativePoint="CENTER" relativeTo="GuiRoot"/>
     </TopLevelControl>
-    <Control name="CBs_HideAll" clampedToScreen="true" virtual="true">
+    <Control name="CBs_HideAll" clampedToScreen="true" virtual="true" level="3">
       <Controls>
         <Texture name="$(parent)BG" level="0" textureFile="/EsoUI/Art/ActionBar/abilityInset.dds">
           <Anchor point="TOPLEFT" relativeTo="$(parent)" />
@@ -31,4 +43,4 @@
       </Controls>
     </Control>
   </Controls>
-</GuiXml>
\ No newline at end of file
+</GuiXml>
\ No newline at end of file