Quantcast
Uneven Warlock Specs Bars - WoWInterface
Thread Tools Display Modes
01-31-14, 11:58 AM   #1
riph
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 7
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
  Reply With Quote
02-01-14, 09:27 AM   #2
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
Ah, I need to read. Answer comes right away
  Reply With Quote
02-01-14, 09:35 AM   #3
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
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

Last edited by Rainrider : 02-01-14 at 10:06 AM.
  Reply With Quote
02-01-14, 03:37 PM   #4
riph
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 7
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


Last edited by riph : 02-01-14 at 05:26 PM. Reason: Added image of burning embers
  Reply With Quote
02-01-14, 07:42 PM   #5
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
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.
  Reply With Quote
02-02-14, 06:34 PM   #6
riph
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 7
That did the trick, thanks for the help!
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Uneven Warlock Specs Bars

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off