View Single Post
06-25-09, 09:23 AM   #34
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,950
Rofl .. pretty much the same as what I did

So it works at my resolution (1280x1024) now to try it with the lower setting. Erm not so pretty at 1024 x 768 but thats the 2nd image.

Code:
plugin.sizeChanged = function( scale, height, width )
	local options  = plugin.options;
	plugin.scale = scale;

	-- Grab addon information and unlock frame for movement
	local MagePortsFrame   = plugin.MagePorts;
	nUI_Movers:lockFrame( MagePortsFrame, false, nil );
	
	-- Resize and Reposition according to scale and size of new container
	MagePortsFrame:SetWidth( width ); 
	MagePortsFrame:SetHeight( height ); 
	
	-- Center Buttons across the container
	local cellCount = #MagePorts.PortalButtons;
    local cellWidth = ( width / cellCount );
    local btnSize = cellWidth * 0.95;
    local btnGap = cellWidth * 0.05;
    local verticalOffsetPortal = height / 5; -- how far up or down from center to put the button
    local verticalOffsetTeleport = height / 4;

    for i=1,cellCount do
        MagePorts.PortalButtons[i]:SetWidth( btnSize );
        MagePorts.PortalButtons[i]:SetHeight( btnSize );
        MagePorts.TeleportButtons[i]:SetWidth( btnSize );
        MagePorts.TeleportButtons[i]:SetHeight( btnSize );
    end
    
    local odd = ( cellCount % 2 ) == 1;
    local midwayLeft = nil;
    local midwayRight = nil;
    if ( odd ) then 
		midwayLeft = math.ceil( cellCount / 2 );
	else
		midwayLeft = math.floor( cellCount / 2 );
		midwayRight = midwayLeft + 1;
	end

	-- Reposition Portal Buttons and Fontstrings
	if ( not midwayRight ) then
		MagePorts.PortalButtons[midwayLeft]:SetPoint( "CENTER", plugin.container, "CENTER", btnGap/2, verticalOffsetPortal);
		MagePorts.TeleportButtons[midwayLeft]:SetPoint( "CENTER", plugin.container, "CENTER", btnGap/2, -verticalOffsetTeleport);
	else
	    MagePorts.PortalButtons[midwayLeft]:SetPoint( "RIGHT", plugin.container, "CENTER", -btnGap/2, verticalOffsetPortal );
		MagePorts.PortalButtons[midwayRight]:SetPoint( "LEFT", plugin.container, "CENTER", btnGap/2, verticalOffsetPortal );
	    MagePorts.TeleportButtons[midwayLeft]:SetPoint( "RIGHT", plugin.container, "CENTER", -btnGap/2, -verticalOffsetTeleport );
		MagePorts.TeleportButtons[midwayRight]:SetPoint( "LEFT", plugin.container, "CENTER", btnGap/2, -verticalOffsetTeleport );
	end
	for i = 1, midwayLeft - 1 do	
		MagePorts.PortalButtons[i]:SetPoint( "RIGHT", MagePorts.PortalButtons[i+1], "LEFT", -btnGap, 0 );
		MagePorts.TeleportButtons[i]:SetPoint( "RIGHT", MagePorts.TeleportButtons[i+1], "LEFT", -btnGap, 0 );
	end
	for i = midwayLeft + 1, cellCount do	
		MagePorts.PortalButtons[i]:SetPoint( "LEFT", MagePorts.PortalButtons[i-1], "RIGHT", btnGap, 0 );
		MagePorts.TeleportButtons[i]:SetPoint( "LEFT", MagePorts.TeleportButtons[i-1], "RIGHT", btnGap, 0 );
	end
	MagePortsFrame.PortalTitle:SetPoint( "BOTTOMLEFT", MagePorts.PortalButtons[1], "TOPLEFT", -btnGap, 0);
	MagePortsFrame.PortalCount:SetPoint( "BOTTOMRIGHT", MagePorts.PortalButtons[cellCount], "TOPRIGHT", -btnGap, 0);	
	MagePortsFrame.TeleportTitle:SetPoint( "BOTTOMLEFT", MagePorts.TeleportButtons[1], "TOPLEFT", -btnGap, 0);
	MagePortsFrame.TeleportCount:SetPoint( "BOTTOMRIGHT", MagePorts.TeleportButtons[cellCount], "TOPRIGHT", -btnGap, 0);	
	
	-- Lock addon frame for movement
	nUI_Movers:lockFrame( MagePortsFrame, true, nil );
end
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_062509_161901.jpg
Views:	528
Size:	350.3 KB
ID:	2966  Click image for larger version

Name:	WoWScrnShot_062509_162406.jpg
Views:	520
Size:	234.6 KB
ID:	2967  
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 06-25-09 at 09:25 AM.