Commit a6bb4c97 authored by Simpy's avatar Simpy 🐹

11.38

parents 24038737 b8f522b2
......@@ -221,7 +221,7 @@ function E:NudgeMover(nudgeX, nudgeY)
local x, y, point = E:CalculateMoverPoints(mover, nudgeX, nudgeY)
mover:ClearAllPoints()
mover:Point(mover.positionOverride or point, E.UIParent, mover.positionOverride and 'BOTTOMLEFT' or point, x, y)
mover:Point(point, E.UIParent, point, x, y)
E:SaveMoverPosition(mover.name)
--Update coordinates in Nudge Window
......@@ -876,7 +876,8 @@ function E:Config_WindowClosed()
self.closeButton:Hide()
self.originalClose:Show()
E:StopElasticize(self.leftHolder.logo)
E:StopElasticize(self.leftHolder.LogoTop)
E:StopElasticize(self.leftHolder.LogoBottom)
E:Config_RestoreOldPosition(self.topHolder.version)
E:Config_RestoreOldPosition(self.obj.content)
......@@ -893,7 +894,9 @@ function E:Config_WindowOpened(frame)
frame.closeButton:Show()
frame.originalClose:Hide()
E:Elasticize(frame.leftHolder.logo, 128, 64)
E:Elasticize(frame.leftHolder.LogoTop, 128, 64)
E:Elasticize(frame.leftHolder.LogoBottom, 128, 64)
frame.leftHolder.LogoTop:SetVertexColor(unpack(E.media.rgbvaluecolor))
local unskinned = not E.private.skins.ace3.enable
local offset = unskinned and 14 or 8
......@@ -918,6 +921,8 @@ function E:Config_WindowOpened(frame)
end
function E:Config_CreateBottomButtons(frame, unskinned)
local L = E.Libs.ACL:GetLocale('ElvUI', E.global.general.locale or 'enUS')
local last
for _, info in ipairs({
{
......@@ -1135,11 +1140,17 @@ function E:ToggleOptionsUI(msg)
top:Height(24)
frame.topHolder = top
local logo = left:CreateTexture()
logo:SetTexture(E.Media.Textures.LogoSmall)
logo:Point("CENTER", left, "TOP", unskinned and 10 or 0, unskinned and -40 or -36)
logo:Size(128, 64)
left.logo = logo
local LogoBottom = left:CreateTexture()
LogoBottom:SetTexture(E.Media.Textures.LogoBottomSmall)
LogoBottom:Point("CENTER", left, "TOP", unskinned and 10 or 0, unskinned and -40 or -36)
LogoBottom:Size(128, 64)
left.LogoBottom = LogoBottom
local LogoTop = left:CreateTexture()
LogoTop:SetTexture(E.Media.Textures.LogoTopSmall)
LogoTop:Point("CENTER", left, "TOP", unskinned and 10 or 0, unskinned and -40 or -36)
LogoTop:Size(128, 64)
left.LogoTop = LogoTop
local buttonsHolder = CreateFrame('Frame', nil, left)
buttonsHolder:Point("BOTTOMLEFT", bottom, "TOPLEFT", 0, 1)
......
......@@ -51,7 +51,7 @@ local LSM = E.Libs.LSM
--Constants
E.noop = function() end
E.title = format('|cfffe7b2c%s |r', 'ElvUI')
E.title = format('|cff1784d1%s |r', 'ElvUI')
E.version = tonumber(GetAddOnMetadata('ElvUI', 'Version'))
E.myfaction, E.myLocalizedFaction = UnitFactionGroup('player')
E.mylevel = UnitLevel('player')
......@@ -68,7 +68,7 @@ E.screenwidth, E.screenheight = GetPhysicalScreenSize()
E.resolution = format('%dx%d', E.screenwidth, E.screenheight)
E.NewSign = '|TInterface\\OptionsFrame\\UI-OptionsFrame-NewFeatureIcon:14:14|t' -- not used by ElvUI yet, but plugins like BenikUI and MerathilisUI use it.
E.TexturePath = 'Interface\\AddOns\\ElvUI\\Media\\Textures\\' -- for plugins?
E.InfoColor = '|cfffe7b2c'
E.InfoColor = '|cff1784d1'
E.UserList = {}
-- oUF Defines
......@@ -553,7 +553,7 @@ end
--param cleanTable : table you want cleaned
--param checkTable : table you want to check against.
--return : a copy of cleanTable with duplicate key/value pairs removed
function E:RemoveTableDuplicates(cleanTable, checkTable)
function E:RemoveTableDuplicates(cleanTable, checkTable, customVars)
if type(cleanTable) ~= 'table' then
E:Print('Bad argument #1 to \'RemoveTableDuplicates\' (table expected)')
return
......@@ -565,11 +565,12 @@ function E:RemoveTableDuplicates(cleanTable, checkTable)
local rtdCleaned = {}
for option, value in pairs(cleanTable) do
if type(value) == 'table' and checkTable[option] and type(checkTable[option]) == 'table' then
rtdCleaned[option] = self:RemoveTableDuplicates(value, checkTable[option])
else
-- Add unique data to our clean table
if (cleanTable[option] ~= checkTable[option]) then
if not customVars or (customVars[option] or checkTable[option] ~= nil) then
-- we only want to add settings which are existing in the default table, unless it's allowed by customVars
if type(value) == 'table' and type(checkTable[option]) == 'table' then
rtdCleaned[option] = self:RemoveTableDuplicates(value, checkTable[option], customVars)
elseif cleanTable[option] ~= checkTable[option] then
-- add unique data to our clean table
rtdCleaned[option] = value
end
end
......@@ -1411,12 +1412,6 @@ function E:DBConversions()
E.db.nameplates.units.TARGET.scale = nil
end
if not E.db.chat.panelColorConverted then
local color = E.db.general.backdropfadecolor
E.db.chat.panelColor = {r = color.r, g = color.g, b = color.b, a = color.a}
E.db.chat.panelColorConverted = true
end
--Convert cropIcon to tristate
local cropIcon = E.db.general.cropIcon
if type(cropIcon) == 'boolean' then
......
......@@ -281,6 +281,29 @@ local blacklistedKeys = {
},
}
--Keys that auto or user generated tables.
D.GeneratedKeys = {
profile = {
customTexts = true,
movers = true
},
private = {},
global = {}
}
local function SetCustomVars(data, keys)
if not data then return end
local vars = E:CopyTable({}, keys)
for key in pairs(data) do
if type(key) ~= 'table' then
vars[key] = true
end
end
return vars
end
local function GetProfileData(profileType)
if not profileType or type(profileType) ~= 'string' then
E:Print('Bad argument #1 to "GetProfileData" (string expected)')
......@@ -291,31 +314,38 @@ local function GetProfileData(profileType)
local profileData = {}
if profileType == 'profile' then
if ElvDB.profileKeys then
profileKey = ElvDB.profileKeys[E.myname..' - '..E.myrealm]
end
profileKey = ElvDB.profileKeys and ElvDB.profileKeys[E.myname..' - '..E.myrealm]
local data = ElvDB.profiles[profileKey]
local vars = SetCustomVars(data, D.GeneratedKeys.profile)
--Copy current profile data
profileData = E:CopyTable(profileData , ElvDB.profiles[profileKey])
profileData = E:CopyTable(profileData, data)
--This table will also hold all default values, not just the changed settings.
--This makes the table huge, and will cause the WoW client to lock up for several seconds.
--We compare against the default table and remove all duplicates from our table. The table is now much smaller.
profileData = E:RemoveTableDuplicates(profileData, P)
profileData = E:RemoveTableDuplicates(profileData, P, vars)
profileData = E:FilterTableFromBlacklist(profileData, blacklistedKeys.profile)
elseif profileType == 'private' then
local privateProfileKey = E.myname..' - '..E.myrealm
profileKey = 'private'
profileData = E:CopyTable(profileData, ElvPrivateDB.profiles[privateProfileKey])
profileData = E:RemoveTableDuplicates(profileData, V)
local privateKey = ElvPrivateDB.profileKeys and ElvPrivateDB.profileKeys[E.myname..' - '..E.myrealm]
local data = ElvPrivateDB.profiles[privateKey]
local vars = SetCustomVars(data, D.GeneratedKeys.private)
profileData = E:CopyTable(profileData, data)
profileData = E:RemoveTableDuplicates(profileData, V, vars)
profileData = E:FilterTableFromBlacklist(profileData, blacklistedKeys.private)
elseif profileType == 'global' then
profileKey = 'global'
profileData = E:CopyTable(profileData, ElvDB.global)
profileData = E:RemoveTableDuplicates(profileData, G)
local data = ElvDB.global
local vars = SetCustomVars(data, D.GeneratedKeys.global)
profileData = E:CopyTable(profileData, data)
profileData = E:RemoveTableDuplicates(profileData, G, vars)
profileData = E:FilterTableFromBlacklist(profileData, blacklistedKeys.global)
elseif profileType == 'filters' then
......@@ -441,7 +471,7 @@ function D:Decode(dataString)
local profileToTable = loadstring(format('%s %s', 'return', profileDataAsString))
if profileToTable then profileMessage, profileData = pcall(profileToTable) end
if not profileData or type(profileData) ~= 'table' then
if profileMessage and (not profileData or type(profileData) ~= 'table') then
E:Print('Error converting lua string to table:', profileMessage)
return
end
......@@ -464,7 +494,9 @@ local function SetImportedProfile(profileType, profileKey, profileData, force)
local tempKey = profileKey..'_Temp'
E.data.keys.profile = tempKey
end
ElvDB.profiles[profileKey] = profileData
--Calling SetProfile will now update all settings correctly
E.data:SetProfile(profileKey)
else
......@@ -476,16 +508,17 @@ local function SetImportedProfile(profileType, profileKey, profileData, force)
return
end
elseif profileType == 'private' then
profileData = E:FilterTableFromBlacklist(profileData, blacklistedKeys.private) --Remove unwanted options from import
local pfKey = ElvPrivateDB.profileKeys[E.myname..' - '..E.myrealm]
ElvPrivateDB.profiles[pfKey] = profileData
E:StaticPopup_Show('IMPORT_RL')
local privateKey = ElvPrivateDB.profileKeys and ElvPrivateDB.profileKeys[E.myname..' - '..E.myrealm]
if privateKey then
profileData = E:FilterTableFromBlacklist(profileData, blacklistedKeys.private) --Remove unwanted options from import
ElvPrivateDB.profiles[privateKey] = profileData
end
E:StaticPopup_Show('IMPORT_RL')
elseif profileType == 'global' then
profileData = E:FilterTableFromBlacklist(profileData, blacklistedKeys.global) --Remove unwanted options from import
E:CopyTable(ElvDB.global, profileData)
E:StaticPopup_Show('IMPORT_RL')
elseif profileType == 'filters' then
E:CopyTable(ElvDB.global.unitframe, profileData.unitframe)
elseif profileType == 'styleFilters' then
......
......@@ -82,6 +82,7 @@ function E:UpdateBlizzardFonts()
SetFont(_G.GameFontHighlightSmall2, NORMAL, self.db.general.fontSize) -- Skill or Recipe description on TradeSkill frame
SetFont(_G.GameFontNormalHuge2, NORMAL, 24) -- Mythic weekly best dungeon name
SetFont(_G.GameFontNormalLarge2, NORMAL, 15) -- Garrison Follower Names
SetFont(_G.GameFontNormalMed1, NORMAL, 14) -- WoW Token Info
SetFont(_G.GameFontNormalMed2, NORMAL, self.db.general.fontSize*1.1) -- Quest tracker
SetFont(_G.GameFontNormalMed3, NORMAL, 15)
SetFont(_G.GameFontNormalSmall2, NORMAL, 12) -- MissionUI Followers names
......@@ -124,6 +125,7 @@ function E:UpdateBlizzardFonts()
SetFont(_G.SystemFont_Shadow_Huge1, NORMAL, 20, MONOCHROME..'OUTLINE') -- Raid Warning, Boss emote frame too
SetFont(_G.SystemFont_Shadow_Huge3, NORMAL, 22, nil, SHADOWCOLOR, BIGOFFSET) -- FlightMap
SetFont(_G.SystemFont_Shadow_Large, NORMAL, 15)
SetFont(_G.SystemFont_Shadow_Large2, NORMAL, 18) -- Auction House ItemDisplay
SetFont(_G.SystemFont_Shadow_Large_Outline, NUMBER, 20, 'OUTLINE')
SetFont(_G.SystemFont_Shadow_Med1, NORMAL, self.db.general.fontSize)
SetFont(_G.SystemFont_Shadow_Med2, NORMAL, 13 * 1.1) -- Shows Order resourses on OrderHallTalentFrame
......@@ -142,9 +144,10 @@ function E:UpdateBlizzardFonts()
SetFont(_G.Number11Font, NUMBER, 11)
SetFont(_G.Number12Font_o1, NUMBER, 12, 'OUTLINE')
SetFont(_G.Number13Font, NUMBER, 13)
SetFont(_G.Number13FontGray, NUMBER, 13)
SetFont(_G.Number13FontGray, NUMBER, 13)
SetFont(_G.Number13FontWhite, NUMBER, 13)
SetFont(_G.Number13FontYellow, NUMBER, 13)
SetFont(_G.Number14FontGray, NUMBER, 14)
SetFont(_G.Number14FontWhite, NUMBER, 14)
SetFont(_G.Number18Font, NUMBER, 18)
SetFont(_G.Number18FontWhite, NUMBER, 18)
......
......@@ -206,7 +206,7 @@ function E:SetupTheme(theme, noDisplayMsg)
if theme == 'class' then
E.db.general.valuecolor = E:GetColor(classColor.r, classColor.g, classColor.b)
else
E.db.general.valuecolor = E:GetColor(254/255, 123/255, 44/255)
E.db.general.valuecolor = E:GetColor(23/255, 132/255, 209/255)
end
E:UpdateStart(true, true)
......@@ -233,7 +233,6 @@ function E:SetupLayout(layout, noDataReset, noDisplayMsg)
end
--ActionBars
E.db.actionbar.backdropSpacingConverted = true
E.db.actionbar.bar1.buttons = 8
E.db.actionbar.bar1.buttonsize = 50
E.db.actionbar.bar1.buttonspacing = 1
......@@ -266,11 +265,10 @@ function E:SetupLayout(layout, noDataReset, noDisplayMsg)
E.db.bags.scrapIcon = true
--Chat
E.db.chat.fontSize = 10
E.db.chat.panelColorConverted = true
E.db.chat.separateSizes = false
E.db.chat.panelHeight = 236
E.db.chat.panelWidth = 472
E.db.chat.tapFontSize = 10
E.db.chat.tabFontSize = 10
--DataBars
E.db.databars.azerite.height = 10
E.db.databars.azerite.orientation = 'HORIZONTAL'
......@@ -303,7 +301,6 @@ function E:SetupLayout(layout, noDataReset, noDisplayMsg)
E:SaveMoverDefaultPosition(mover)
end
--Tooltip
E.db.tooltip.fontSize = 10
E.db.tooltip.healthBar.fontOutline = 'MONOCHROMEOUTLINE'
E.db.tooltip.healthBar.height = 12
--UnitFrames
......@@ -342,7 +339,6 @@ function E:SetupLayout(layout, noDataReset, noDisplayMsg)
E.db.unitframe.units.target.height = 82
E.db.unitframe.units.target.infoPanel.enable = true
E.db.unitframe.units.target.name.attachTextTo = 'InfoPanel'
E.db.unitframe.units.target.name.text_format = '[namecolor][name]'
E.db.unitframe.units.target.orientation = 'LEFT'
E.db.unitframe.units.target.power.attachTextTo = 'InfoPanel'
E.db.unitframe.units.target.power.height = 22
......@@ -863,12 +859,20 @@ function E:Install()
close:SetScript('OnClick', function() f:Hide() end)
S:HandleCloseButton(close)
f.tutorialImage = f:CreateTexture('InstallTutorialImage', 'OVERLAY')
f.tutorialImage:Size(256, 128)
f.tutorialImage:SetTexture(E.Media.Textures.Logo)
f.tutorialImage:Point('BOTTOM', 0, 70)
local logo = f:CreateTexture('InstallTutorialImage', 'OVERLAY')
logo:Size(256, 128)
logo:SetTexture(E.Media.Textures.LogoTop)
logo:Point('BOTTOM', 0, 70)
f.tutorialImage = logo
local logo2 = f:CreateTexture('InstallTutorialImage2', 'OVERLAY')
logo2:Size(256, 128)
logo2:SetTexture(E.Media.Textures.LogoBottom)
logo2:Point('BOTTOM', 0, 70)
f.tutorialImage2 = logo2
end
ElvUIInstallFrame.tutorialImage:SetVertexColor(unpack(E.media.rgbvaluecolor))
ElvUIInstallFrame:Show()
NextPage()
end
......@@ -4,8 +4,8 @@ local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, Private
local tinsert, tremove, next, wipe, ipairs = tinsert, tremove, next, wipe, ipairs
local select, tonumber, type, unpack, strmatch = select, tonumber, type, unpack, strmatch
local modf, atan2, ceil, floor, abs, sqrt, mod = math.modf, atan2, ceil, floor, abs, sqrt, mod
local format, strsub, strupper, gsub, gmatch, utf8sub = format, strsub, strupper, gsub, gmatch, string.utf8sub
local tostring, strlen, pairs = tostring, strlen, pairs
local format, strsub, strupper, gsub, gmatch = format, strsub, strupper, gsub, gmatch
local tostring, pairs, utf8sub, utf8len = tostring, pairs, string.utf8sub, string.utf8len
--WoW API / Variables
local CreateFrame = CreateFrame
local UnitPosition = UnitPosition
......@@ -16,6 +16,7 @@ local C_Timer_After = C_Timer.After
E.ShortPrefixValues = {}
E.ShortPrefixStyles = {
['TCHINESE'] = {{1e8,'億'}, {1e4,'萬'}},
['CHINESE'] = {{1e8,'亿'}, {1e4,'万'}},
['ENGLISH'] = {{1e12,'T'}, {1e9,'B'}, {1e6,'M'}, {1e3,'K'}},
['GERMAN'] = {{1e12,'Bio'}, {1e9,'Mrd'}, {1e6,'Mio'}, {1e3,'Tsd'}},
......@@ -87,8 +88,10 @@ end
-- Text Gradient by Simpy
function E:TextGradient(text, ...)
local msg, len, idx = '', strlen(text), 0
for x in gmatch(text, '.') do
local msg, len, idx = '', utf8len(text), 0
for i=1, len do
local x = utf8sub(text, i, i)
if strmatch(x, '%s') then
msg = msg .. x
idx = idx + 1
......@@ -122,10 +125,15 @@ end
--Return rounded number
function E:Round(num, idp)
if(idp and idp > 0) then
if type(num) ~= 'number' then
return num, idp
end
if idp and idp > 0 then
local mult = 10 ^ idp
return floor(num * mult + 0.5) / mult
end
return floor(num + 0.5)
end
......
......@@ -42,7 +42,7 @@ function MC:CreateModuleConfigGroup(Name, section, pluginSection)
type = 'execute',
name = L["Import Now"],
func = function()
E.PopupDialogs.MODULE_COPY_CONFIRM.text = format(L["You are going to copy settings for |cffD3CF00\"%s\"|r from |cff4beb2c\"%s\"|r profile to your current |cff4beb2c\"%s]\"|r profile. Are you sure?"], Name, E.global.profileCopy.selected, ElvDB.profileKeys[E.myname..' - '..E.myrealm])
E.PopupDialogs.MODULE_COPY_CONFIRM.text = format(L["You are going to copy settings for |cffD3CF00\"%s\"|r from |cff4beb2c\"%s\"|r profile to your current |cff4beb2c\"%s\"|r profile. Are you sure?"], Name, E.global.profileCopy.selected, ElvDB.profileKeys[E.myname..' - '..E.myrealm])
E.PopupDialogs.MODULE_COPY_CONFIRM.OnAccept = function()
MC:ImportFromProfile(section, pluginSection)
end
......
......@@ -4,7 +4,7 @@ local Sticky = E.Libs.SimpleSticky
--Lua functions
local _G = _G
local type, unpack, pairs, error = type, unpack, pairs, error
local format, split, find = format, strsplit, strfind
local format, split, find, ipairs = format, strsplit, strfind, ipairs
--WoW API / Variables
local CreateFrame = CreateFrame
local IsShiftKeyDown = IsShiftKeyDown
......@@ -18,18 +18,16 @@ E.DisabledMovers = {}
local function SizeChanged(frame)
if InCombatLockdown() then return end
if frame.dirtyWidth and frame.dirtyHeight then
frame.mover:Size(frame.dirtyWidth, frame.dirtyHeight)
else
frame.mover:Size(frame:GetSize())
end
-- this solves the group one issue on unitframes, patch: 8.3.0 ~Simpy
E:Delay(0, frame.mover.Size, frame.mover, frame.dirtyWidth or frame:GetWidth(), frame.dirtyHeight or frame:GetHeight())
--frame.mover:Size(frame.dirtyWidth or frame:GetWidth(), frame.dirtyHeight or frame:GetHeight())
end
local function GetPoint(obj)
local point, anchor, secondaryPoint, x, y = obj:GetPoint()
if not anchor then anchor = E.UIParent end
return format('%s,%s,%s,%d,%d', point, anchor:GetName(), secondaryPoint, E:Round(x), E:Round(y))
return format('%s,%s,%s,%d,%d', point, anchor:GetName(), secondaryPoint, x and E:Round(x) or 0, y and E:Round(y) or 0)
end
local function GetSettingPoints(name)
......@@ -74,7 +72,7 @@ local coordFrame = CreateFrame('Frame')
coordFrame:SetScript('OnUpdate', UpdateCoords)
coordFrame:Hide()
local function UpdateMover(parent, name, text, overlay, snapOffset, postdrag, shouldDisable, configString)
local function UpdateMover(parent, name, text, overlay, snapOffset, postdrag, shouldDisable, configString, perferCorners)
if not parent then return end --If for some reason the parent isnt loaded yet
local holder = E.CreatedMovers[name]
......@@ -115,6 +113,7 @@ local function UpdateMover(parent, name, text, overlay, snapOffset, postdrag, sh
f.snapOffset = snapOffset or -2
f.shouldDisable = shouldDisable
f.configString = configString
f.perferCorners = perferCorners
holder.mover = f
parent.mover = f
......@@ -157,14 +156,8 @@ local function UpdateMover(parent, name, text, overlay, snapOffset, postdrag, sh
end
local x2, y2, p2 = E:CalculateMoverPoints(self)
local p1 = self.positionOverride and ((self.positionOverride == 'BOTTOM' or self.positionOverride == 'TOP') and 'BOTTOM' or 'BOTTOMLEFT')
self:ClearAllPoints()
self:Point(self.positionOverride or p2, E.UIParent, p1 or p2, x2, y2)
if self.positionOverride then
self.parent:ClearAllPoints()
self.parent:Point(self.positionOverride, self, self.positionOverride)
end
self:Point(p2, E.UIParent, p2, x2, y2)
E:SaveMoverPosition(name)
......@@ -258,15 +251,12 @@ local function UpdateMover(parent, name, text, overlay, snapOffset, postdrag, sh
end
function E:CalculateMoverPoints(mover, nudgeX, nudgeY)
local screenWidth, screenHeight, screenCenter = E.UIParent:GetRight(), E.UIParent:GetTop(), E.UIParent:GetCenter()
local screenWidth, screenHeight = E.UIParent:GetRight(), E.UIParent:GetTop()
local screenCenterX, screenCenterY = E.UIParent:GetCenter()
local x, y = mover:GetCenter()
local LEFT = screenWidth / 3
local RIGHT = screenWidth * 2 / 3
local TOP = screenHeight / 2
local point, nudgePoint, nudgeInversePoint
if y >= TOP then
if y >= screenCenterY then -- TOP: 1080p = 540
point = 'TOP'
nudgePoint = 'TOP'
nudgeInversePoint = 'BOTTOM'
......@@ -278,40 +268,18 @@ function E:CalculateMoverPoints(mover, nudgeX, nudgeY)
y = mover:GetBottom()
end
if x >= RIGHT then
if x >= (screenWidth * 2 / 3) then -- RIGHT: 1080p = 1280
point = point..'RIGHT'
nudgePoint = 'RIGHT'
nudgeInversePoint = 'LEFT'
x = mover:GetRight() - screenWidth
elseif x <= LEFT then
elseif x <= (screenWidth / 3) or mover.perferCorners then -- LEFT: 1080p = 640
point = point..'LEFT'
nudgePoint = 'LEFT'
nudgeInversePoint = 'RIGHT'
x = mover:GetLeft()
else
x = x - screenCenter
end
if mover.positionOverride and (E.diffGetLeft and E.diffGetRight and E.diffGetTop and E.diffGetBottom) then
if mover.positionOverride == 'TOPLEFT' then
x = mover:GetLeft() - E.diffGetLeft
y = mover:GetTop() - E.diffGetTop
elseif mover.positionOverride == 'TOPRIGHT' then
x = mover:GetRight() - E.diffGetRight
y = mover:GetTop() - E.diffGetTop
elseif mover.positionOverride == 'BOTTOMLEFT' then
x = mover:GetLeft() - E.diffGetLeft
y = mover:GetBottom() - E.diffGetBottom
elseif mover.positionOverride == 'BOTTOMRIGHT' then
x = mover:GetRight() - E.diffGetRight
y = mover:GetBottom() - E.diffGetBottom
elseif mover.positionOverride == 'BOTTOM' then
x = mover:GetCenter() - screenCenter
y = mover:GetBottom() - E.diffGetBottom
elseif mover.positionOverride == 'TOP' then
x = mover:GetCenter() - screenCenter
y = mover:GetTop() - E.diffGetTop
end
x = x - screenCenterX
end
--Update coordinates if nudged
......@@ -340,7 +308,9 @@ end
function E:SetMoverLayoutPositionPoint(holder, name, parent)
local layout = E.LayoutMoverPositions[E.db.layoutSetting]
holder.point = (layout and layout[name]) or E.LayoutMoverPositions.ALL[name] or GetPoint(parent or _G[name])
local layoutPoint = (layout and layout[name]) or E.LayoutMoverPositions.ALL[name]
holder.layoutPoint = layoutPoint
holder.point = layoutPoint or GetPoint(parent or _G[name])
if parent then -- CreateMover call
holder.parentPoint = {parent:GetPoint()}
......@@ -359,7 +329,7 @@ function E:SaveMoverDefaultPosition(name)
end
end
function E:CreateMover(parent, name, text, overlay, snapoffset, postdrag, moverTypes, shouldDisable, configString)
function E:CreateMover(parent, name, text, overlay, snapoffset, postdrag, moverTypes, shouldDisable, configString, perferCorners)
if not moverTypes then moverTypes = 'ALL,GENERAL' end
local holder = E.CreatedMovers[name]
......@@ -375,7 +345,7 @@ function E:CreateMover(parent, name, text, overlay, snapoffset, postdrag, moverT
E.CreatedMovers[name] = holder
end
UpdateMover(parent, name, text, overlay, snapoffset, postdrag, shouldDisable, configString)
UpdateMover(parent, name, text, overlay, snapoffset, postdrag, shouldDisable, configString, perferCorners)
end
function E:ToggleMovers(show, moverType)
......@@ -444,15 +414,17 @@ function E:ResetMovers(arg)
holder.postdrag(frame, E:GetScreenQuadrant(frame))
end
if not all then
if self.db.movers then
if all then
E:SaveMoverPosition(name)
else
if holder.layoutPoint then
E:SaveMoverPosition(name)
elseif self.db.movers then
self.db.movers[name] = nil
end
break
end
end
E:SaveMoverPosition(name)
end
end
......@@ -480,6 +452,6 @@ end
function E:LoadMovers()
for n, t in pairs(E.CreatedMovers) do
UpdateMover(t.parent, n, t.overlay, t.snapoffset, t.postdrag, t.shouldDisable, t.configString)
UpdateMover(t.parent, n, t.overlay, t.snapoffset, t.postdrag, t.shouldDisable, t.configString,