Back to Home

ESO Lua File v101044

common/globals/globals.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
-------------------------------------
-- Globals
--
-- Global functions specific to ESO
-------------------------------------
    local function DoLayout()
        -- Since the control could have been resized by it's anchors clear the anchors before getting it's hieght
        control:ClearAnchors()
        local screenHeight = GuiRoot:GetHeight()
        local controlHeight = control:GetHeight()
        local offsetY = (screenHeight - controlHeight) / 2
        control:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, 245, offsetY)
    end
    control:RegisterForEvent(EVENT_SCREEN_RESIZED, DoLayout)
    DoLayout()
end
    local function DoLayout()
        local screenHeight = GuiRoot:GetHeight()
        local controlHeight = control:GetHeight()
        control:ClearAnchors()
        control:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, -20, 20)
        control:SetAnchor(BOTTOMLEFT, GuiRoot, BOTTOMLEFT, -20, 20)
    end
    control:RegisterForEvent(EVENT_SCREEN_RESIZED, DoLayout)
    DoLayout()
end