View Single Post
11-13-15, 02:57 PM   #4
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 123
MyAddon:iconLocation() is just an icon reposizioning function

Lua Code:
  1. function MyAddon:iconLocation(idx) -- how the icons will be arranged according to the number of rows and columns
  2.     local row = db.profile["Bars"][idx]["rows"]
  3.     local col = db.profile["Bars"][idx]["columns"]
  4.     local frm = "MyAddon_Frame"..idx
  5.     for r = 1, row do
  6.         local line = col * r
  7.         local first = line - (col - 1)
  8.         for i = first, line do
  9.             local icona = MyAddon:iconName(idx, i)
  10.             if (i == 1) then
  11.                 icona:SetPoint("TOPLEFT",0,0)
  12.             elseif (i == first) and (i ~= 1) then
  13.                 local up =  first - col
  14.                 icona:SetPoint("TOPLEFT", frm.."MyAddon_Icon"..up , "BOTTOMLEFT", 0, db.profile.Vspacing)
  15.             else
  16.                 icona:SetPoint("TOPLEFT", frm.."MyAddon_Icon"..i-1 ,"TOPRIGHT", db.profile.Hspacing, 0)
  17.             end
  18.         end
  19.     end
  20. end
  Reply With Quote