WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Uneven Warlock Specs Bars (https://www.wowinterface.com/forums/showthread.php?t=48890)

riph 01-31-14 11:58 AM

Uneven Warlock Specs Bars
 
I'm using the oUF Warlock Spec Bars module for Burning Embers/Soul Shards/Demonic Fury. However I don't know if I'm doing something wrong, or I'm using a dodgy version of the module, but I cannot for the life of me get the individual embers/shards to be equal width, the last one always seems to a bit bigger than the others.

Lua Code:
  1. lib.gen_warlock_bars = function(f)
  2.   local wb = CreateFrame("Frame", "WarlockSpecBars", f)
  3.   wb:SetPoint("BOTTOM", f.Health, "TOP", 0, 3)
  4.   wb:SetWidth(150)
  5.   wb:SetHeight(8)
  6.  
  7.   for i = 1, 4 do
  8.     wb[i] = CreateFrame("StatusBar", "WarlockSpecBars"..i, wb)
  9.  
  10.     lib.gen_backdrop(wb[i])
  11.  
  12.     wb[i]:SetHeight(6)
  13.     wb[i]:SetStatusBarTexture(cfg.statusbar_texture)
  14.  
  15.     wb[i].border = lib.gen_border(wb[i])
  16.  
  17.     local point = wb[i]
  18.  
  19.     if i == 1 then
  20.       point:SetWidth((150 / 4) - 4)
  21.       point:SetPoint("LEFT", wb, "LEFT", 0, 1)
  22.     else
  23.       point:SetWidth((150 / 4) - 4)
  24.       point:SetPoint("LEFT", wb[i-1], "RIGHT", 3, 0)
  25.     end
  26.   end
  27.  
  28.   f.WarlockSpecBars = wb
  29. end

Rainrider 02-01-14 09:27 AM

Ah, I need to read. Answer comes right away

Rainrider 02-01-14 09:35 AM

150 = segment + space + segment + space + segment + space + segment
150 = 4 * segment + 3 * space
4 * segment = 150 - 3 * space
segment = (150 - 3 * space) / 4

You set space to 3 in your SetPoint call. So your solution should be 141/4

Sorry for multiple editing

riph 02-01-14 03:37 PM

Thanks for taking the time to help, I tried the re-adjustment, but the last ember still appears longer.

I've pushed my code up to GitHub (https://github.com/tombell/oUF_Rippie)

No matter what I try the segments always appear uneven :(


Rainrider 02-01-14 07:42 PM

That's why. This makes the last segment longer by the amount of spacing (3px in your case). If you subtract the spacing, then it will be off by 3px on the right side. Replace the segment width calculation with what I posted earlier.

riph 02-02-14 06:34 PM

That did the trick, thanks for the help!


All times are GMT -6. The time now is 09:53 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI