GithubHelp home page GithubHelp logo

torhal / libdialog-1.0 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 37 KB

LibDialog-1.0 provides methods for creating dialogs similar to Blizzard's default StaticPopup dialogs.

Home Page: https://www.curseforge.com/wow/addons/libdialog-1-0

Lua 100.00%
world-of-warcraft-addon-library

libdialog-1.0's People

Contributors

torhal avatar

Watchers

 avatar

libdialog-1.0's Issues

ItemFrame Support

Acquires/anchors a frame which displays an item icon with mouse-over tooltip. Clears anchor/releases when dialog is released.

version number and _dialog_onhide issue

Originally reported by Arkayenro:

hi,

the MINOR version in the 9.0 file is still 8, should it have been bumped to 9 ?

also _Dialog_OnHide(dialog) doesnt have the same logic checks as _Dialog_OnShow(dialog)

when a null dialog value is passed into the function it barfs when it gets to the line (249) for local delegate = dialog.delegate

see arkayenro/arkinventory#1556

StaticPopup_DisplayedFrames Error [Fix Here]

LUA error:
1x BetterAddonList/libs/LibDialog-1.0-8.lua:833: attempt to get length of field 'StaticPopup_DisplayedFrames' (a nil value)
[string "@BetterAddonList/libs/LibDialog-1.0-8.lua"]:833: in function Spawn' [string "@BetterAddonList/BetterAddonList.lua"]:472: in function func'
[string "@Blizzard_SharedXML/Mainline/UIDropDownMenu.lua"]:1019: in function `UIDropDownMenuButton_OnClick'
[string "*UIDropDownMenuTemplates.xml:133_OnClick"]:1: in function <[string "*UIDropDownMenuTemplates.xml:133_OnClick"]:1>

TO FIX:
Change lines 829 to 842 from this

-- Anchor to the bottom of existing dialogs. If none exist, check to see if there are visible default StaticPopupDialogs and anchor to that instead; else, anchor to UIParent.
if #active_dialogs > 0 then
    dialog:SetPoint("TOP", active_dialogs[#active_dialogs], "BOTTOM", 0, 0)
else
    local default_dialog = _G.StaticPopup_DisplayedFrames[#_G.StaticPopup_DisplayedFrames]

    if default_dialog then
        dialog:SetPoint("TOP", default_dialog, "BOTTOM", 0, 0)
    else
        dialog:SetPoint("TOP", _G.UIParent, "TOP", 0, -135)
    end
end
active_dialogs[#active_dialogs + 1] = dialog
dialog:Show()

to this:

-- Anchor to the bottom of existing dialogs. If none exist, check to see if there are visible default StaticPopupDialogs and anchor to that instead; else, anchor to UIParent.
if #active_dialogs > 0 then
    dialog:SetPoint("TOP", active_dialogs[#active_dialogs], "BOTTOM", 0, 0)
else

    if _G.StaticPopup_DisplayedFrames and #_G.StaticPopup_DisplayedFrames > 0 then
        local default_dialog = _G.StaticPopup_DisplayedFrames[#_G.StaticPopup_DisplayedFrames]
        dialog:SetPoint("TOP", default_dialog, "BOTTOM", 0, 0)
    else
        dialog:SetPoint("TOP", _G.UIParent, "TOP", 0, -135)
    end
end
active_dialogs[#active_dialogs + 1] = dialog
dialog:Show()

Cataclysm Classic (beta) support

StaticPopup_DisplayedFrames is no longer a public array.

To workaround the issue and keep compatibility with other classic versions I added this helper function

local function _SetupAnchor(dialog)
    local default_dialog
    if _G.StaticPopup_DisplayedFrames then
        default_dialog = _G.StaticPopup_DisplayedFrames[#_G.StaticPopup_DisplayedFrames]
    elseif (_G.StaticPopup_HasDisplayedFrames and _G.StaticPopup_IsLastDisplayedFrame) then
        if StaticPopup_HasDisplayedFrames() then
            for idx = STATICPOPUP_NUMDIALOGS,1,-1 do
                local test_dialog = _G["StaticPopup"..idx]
                if StaticPopup_IsLastDisplayedFrame(test_dialog) then
                    default_dialog = test_dialog
                end
            end
        end
    end
    if default_dialog then
        dialog:SetPoint("TOP", default_dialog, "BOTTOM", 0, 0)
    else
        dialog:SetPoint("TOP", _G.UIParent, "TOP", 0, -135)
    end
end

and replaced the
LibDialog-1.0.lua#L151 to LibDialog-1.0.lua#L157
and
LibDialog-1.0.lua#L833 to LibDialog-1.0.lua#L839

with _SetupAnchor(current_dialog) and _SetupAnchor(dialog) respectively.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.