Bartender 4 : Zone Ability Bar #6


Open
  • o0piumm created this issue Dec 29, 2016

    Bartender 4 is  throwing a nil arithmetic error when attempting to apply scaling to the zone ability bar. You can see the issue in the bartender issues list.

     

    I cant seem to figure out my curseforge svn permissions so I cant make a pull request for the changes I have made locally that have worked for me so far.

     

    function lib.SavePosition(frame)
    
    	local parent = frame:GetParent() or nilParent
    	-- No, this won't work very well with frames that aren't parented to nil or UIParent
    	local s = frame:GetScale()
    <br />--New Code
    	local left,top = lib.GetPositionByScale(frame:GetLeft(),s), lib.GetPositionByScale(frame:GetTop(),s)
    	local right,bottom = lib.GetPositionByScale(frame:GetRight(),s), lib.GetPositionByScale(frame:GetBottom(),s)
    --End New Code<br />
    	local pwidth, pheight = parent:GetWidth(), parent:GetHeight()
    
    	local x,y,point;
    
    	if left &lt; (pwidth-right) and left &lt; abs((left+right)/2 - pwidth/2) then
    		x = left;
    		point="LEFT";
    	elseif (pwidth-right) &lt; abs((left+right)/2 - pwidth/2) then
    		x = right-pwidth;
    		point="RIGHT";
    	else
    		x = (left+right)/2 - pwidth/2;
    		point="";
    	end
    	
    	if bottom &lt; (pheight-top) and bottom &lt; abs((bottom+top)/2 - pheight/2) then
    		y = bottom;
    		point="BOTTOM"..point;
    	elseif (pheight-top) &lt; abs((bottom+top)/2 - pheight/2) then
    		y = top-pheight;
    		point="TOP"..point;
    	else
    		y = (bottom+top)/2 - pheight/2;
    		-- point=""..point;
    	end
    	
    	if point=="" then
    		point = "CENTER"
    	end
    	
    	setStorage(frame, "x", x)
    	setStorage(frame, "y", y)
    	setStorage(frame, "point", point)
    	setStorage(frame, "scale", s)
    	
    	frame:ClearAllPoints()
    	frame:SetPoint(point, frame:GetParent(), point, x/s, y/s);
    end
    <br />--New function
    function lib.GetPositionByScale(position,scale)
    	if not position then return 0 else return position * scale end
    end

     


To post a comment, please login or register a new account.