Permalink
Browse files

Add automatic unit frame positioning.

  • Loading branch information...
1 parent ee8a8a8 commit dd4a2c84afa88fdbd4f82742b72568582516ea9e @Haleth committed Jan 22, 2014
Showing with 34 additions and 11 deletions.
  1. +3 −0 FreeUI/options.lua
  2. +22 −7 FreeUI/scripts/unitframes.lua
  3. +7 −4 FreeUI_Options/frames.lua
  4. +2 −0 FreeUI_Options/localization/english.lua
View
@@ -66,6 +66,9 @@ C["notifications"] = {
C["unitframes"] = {
["enable"] = true, -- enable the unit frames and their included modules
+
+ ["autoPosition"] = true, -- automatically postion unit frames based on resolution
+
["enableGroup"] = true, -- enable party/raid frames
["healerClasscolours"] = false, -- colour unitframes by class in healer layout
["limitRaidSize"] = false, -- show a maximum of 25 players in a raid
@@ -1719,19 +1719,34 @@ local spawnHelper = function(self, unit, ...)
end
oUF:Factory(function(self)
- local playerPos, targetPos, partyPos, raidPos
- local target
+ local partyPos, raidPos
+ local player, target
- local player = spawnHelper(self, 'player', unpack(C.unitframes.player))
+ if C.unitframes.autoPosition then
+ player = spawnHelper(self, 'player', "BOTTOM", UIParent, "CENTER", GetScreenWidth()/-6.98, GetScreenHeight()/-11.43)
+ else
+ player = spawnHelper(self, 'player', unpack(C.unitframes.player))
+ end
if FreeUIConfig.layout == 1 then
- target = spawnHelper(self, 'target', unpack(C.unitframes.target))
+ if C.unitframes.autoPosition then
+ target = spawnHelper(self, 'target', "TOP", UIParent, "CENTER", 0, GetScreenHeight()/-5.33)
+ else
+ target = spawnHelper(self, 'target', unpack(C.unitframes.target))
+ end
+
partyPos = {"BOTTOM", player, "TOP", 0, 50}
raidPos = {"BOTTOMRIGHT", Minimap, "BOTTOMLEFT", -5, 0}
else
- target = spawnHelper(self, 'target', unpack(C.unitframes.target_heal))
- partyPos = C.unitframes.party
- raidPos = C.unitframes.raid
+ if C.unitframes.autoPosition then
+ target = spawnHelper(self, 'target', "BOTTOM", UIParent, "CENTER", GetScreenWidth()/6.98, GetScreenHeight()/-11.43)
+ partyPos = {"TOP", UIParent, "CENTER", 0, GetScreenHeight()/-5.33}
+ raidPos = {"TOP", UIParent, "CENTER", 0, GetScreenHeight()/-5.33}
+ else
+ target = spawnHelper(self, 'target', unpack(C.unitframes.target_heal))
+ partyPos = C.unitframes.party
+ raidPos = C.unitframes.raid
+ end
end
spawnHelper(self, 'focus', "BOTTOMRIGHT", player, "TOPRIGHT", 0, 12)
View
@@ -431,8 +431,11 @@ unitframes.tab.Icon:SetTexture("Interface\\Icons\\Spell_Holy_PrayerofSpirit")
local enable = ns.CreateCheckBox(unitframes, "enable", true, true)
enable:SetPoint("TOPLEFT", unitframes.subText, "BOTTOMLEFT", 0, -8)
+local autoPosition = ns.CreateCheckBox(unitframes, "autoPosition", true, true)
+autoPosition:SetPoint("TOPLEFT", enable, "BOTTOMLEFT", 0, -16)
+
local enableGroup = ns.CreateCheckBox(unitframes, "enableGroup", true, true)
-enableGroup:SetPoint("TOPLEFT", enable, "BOTTOMLEFT", 0, -16)
+enableGroup:SetPoint("TOPLEFT", autoPosition, "BOTTOMLEFT", 0, -8)
local limitRaidSize = ns.CreateCheckBox(unitframes, "limitRaidSize", true)
limitRaidSize:SetPoint("TOPLEFT", enableGroup, "BOTTOMLEFT", 16, -8)
@@ -447,7 +450,7 @@ partyNameAlways:SetPoint("TOPLEFT", healerClasscolours, "BOTTOMLEFT", 0, -8)
enableGroup.children = {limitRaidSize, healerClasscolours, partyNameAlways}
local absorb = ns.CreateCheckBox(unitframes, "absorb", true, true)
-absorb:SetPoint("LEFT", enableGroup, "RIGHT", 240, 0)
+absorb:SetPoint("LEFT", autoPosition, "RIGHT", 240, 0)
local targettarget = ns.CreateCheckBox(unitframes, "targettarget", true, true)
targettarget:SetPoint("TOPLEFT", absorb, "BOTTOMLEFT", 0, -8)
@@ -467,11 +470,11 @@ local enableArena = ns.CreateCheckBox(unitframes, "enableArena", true, true)
enableArena:SetPoint("TOPLEFT", enableGroup, "BOTTOMLEFT", 0, -110)
local layoutText = unitframes:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
-layoutText:SetPoint("TOP", 0, -340)
+layoutText:SetPoint("TOP", 0, -374)
layoutText:SetText(ns.localization.layoutText)
unitframes.Layout = CreateFrame("Button", nil, unitframes, "UIPanelButtonTemplate")
-unitframes.Layout:SetPoint("TOP", 0, -374)
+unitframes.Layout:SetPoint("TOP", 0, -408)
unitframes.Layout:SetSize(128, 25)
tinsert(ns.buttons, unitframes.Layout)
@@ -109,6 +109,8 @@ ns.localization.unitframes = "Unit frames"
ns.localization.unitframesSubText = "These options control most of the options for the unit frames. If you want to move the unit frames easily, install oUF_MovableFrames."
ns.localization.unitframesenable = "Enable"
ns.localization.unitframesenableTooltip = "Disable this option if you want to use another unit frames addon."
+ns.localization.unitframesautoPosition = "Automatically position"
+ns.localization.unitframesautoPositionTooltip = "Position the unit frames automatically based on screen resolution. Disable if you want to manually position them in the options file."
ns.localization.unitframesenableGroup = "Party/Raid frames"
ns.localization.unitframesenableGroupTooltip = "Uncheck if you want to use another addon for party and raid frames."
ns.localization.unitframeslimitRaidSize = "Limit raid size"

0 comments on commit dd4a2c8

Please sign in to comment.