Quantcast

Updated raid group layout for vertical settings

failcoder [12-29-15 - 18:01]
Updated raid group layout for vertical settings
Filename
SVUI_UnitFrames/groups.lua
diff --git a/SVUI_UnitFrames/groups.lua b/SVUI_UnitFrames/groups.lua
index 5ef5137..1a3ec46 100644
--- a/SVUI_UnitFrames/groups.lua
+++ b/SVUI_UnitFrames/groups.lua
@@ -1060,11 +1060,11 @@ local GroupConfigure = function(self)
                     local x,y = 0,0;
                     local size = settings.height * 0.75;
                     if(isHorizontal) then
-                        x,y = (10 * mod),0;
-                        xLabelCalc = size + 10
+                        x,y = (4 * mod),0;
+                        xLabelCalc = size + 4
                     else
-                        x,y = 0,(10 * mod);
-                        yLabelCalc = size + 10
+                        x,y = 0,(4 * mod);
+                        yLabelCalc = size + 4
                     end
                     frame.GroupTag:Show()
                     frame.GroupTag:SetSize(size, size)
@@ -1083,35 +1083,51 @@ local GroupConfigure = function(self)
         end

         if(frameEnabled) then
-            local yIncrement,yIncrementOffset,xIncrement,xIncrementOffset = 0,0,0,0;
+            local yIncrementOffset,xIncrementOffset = 0,0;
             if(groupIncrement == 0) then
                 rows = rows + 1;
                 cols = 1;
                 xIncrementOffset = xLabelCalc;
                 yIncrementOffset = yLabelCalc;
-            elseif(groupIncrement % settings.gRowCol == 0) then
-                rows = rows + 1;
-                cols = 1;
-                xIncrement = (isHorizontal) and xLabelCalc or ((groupWidth + xLabelCalc) * cols);
-                yIncrement = (isHorizontal) and ((groupHeight + yLabelCalc) * (rows - 1)) or yLabelCalc;
-                xIncrementOffset = xIncrement;
-                yIncrementOffset = yIncrement;
+            elseif(isHorizontal) then
+                if(groupIncrement % settings.gRowCol == 0) then
+                    rows = rows + 1;
+                    cols = 1;
+                    xIncrementOffset = xLabelCalc;
+                    yIncrementOffset = ((groupHeight + yLabelCalc) * (rows - 1));
+                else
+                    xIncrementOffset = (groupWidth * cols) + (xLabelCalc * (cols + 1));
+                    yIncrementOffset = (groupHeight * (rows - 1)) + (yLabelCalc * rows);
+                    cols = cols + 1;
+                end
             else
-                xIncrementOffset = (groupWidth * cols) + (xLabelCalc * (cols + 1));
-                yIncrementOffset = (groupHeight * (rows - 1)) + (yLabelCalc * rows);
-                cols = cols + 1;
+                if(groupIncrement % settings.gRowCol == 0) then
+                    rows = rows + 1;
+                    cols = 1;
+                    xIncrementOffset = ((groupWidth + xLabelCalc) * (rows - 1));
+                    yIncrementOffset = yLabelCalc;
+                else
+                    xIncrementOffset = (groupWidth * (rows - 1)) + (xLabelCalc * rows);
+                    yIncrementOffset = ((groupHeight * cols) + (yLabelCalc * cols)) + yLabelCalc;
+                    cols = cols + 1;
+                end
             end

             groupIncrement = groupIncrement + 1;
             frame:ClearAllPoints()
-            frame:SetPoint(anchorPoint, self, anchorPoint, xIncrementOffset, yIncrementOffset);
+            frame:SetPoint(anchorPoint, self, anchorPoint, (xIncrementOffset * horizontal), (yIncrementOffset * vertical));
         end
     end

-    local widthCalc = ((groupWidth + xLabelCalc) * settings.gRowCol) - settings.wrapXOffset;
-    local heightCalc = ((groupHeight + yLabelCalc) * rows) - settings.wrapYOffset;
-
-    self:SetSize(widthCalc, heightCalc)
+    if(isHorizontal) then
+        local w = ((groupWidth + xLabelCalc) * settings.gRowCol) - settings.wrapXOffset;
+        local h = ((groupHeight + yLabelCalc) * rows) - settings.wrapYOffset;
+        self:SetSize(w, h)
+    else
+        local w = ((groupWidth + xLabelCalc) * rows) - settings.wrapXOffset;
+        local h = ((groupHeight + yLabelCalc) * settings.gRowCol) - settings.wrapYOffset;
+        self:SetSize(w, h)
+    end
 end

 function MOD:GetGroupFrame(token, layout)