LibBackdrop-1.0

2 - Errors when setting a backdrop without all properties

The default SetBackdrop API accepts a backdrop without every possible property. For example:

frame:SetBackdrop({
    bgFile = "Interface\\FrameGeneral\\UI-Background-Rock",
    tile = true, tileSize = 256,
})

The default UI will apply this backdrop without complaint, treating it as the equivalent of:

frame:SetBackdrop({
    bgFile = "Interface\\FrameGeneral\\UI-Background-Rock",
    tile = true, tileSize = 256,
    edgeFile = nil, edgeSize = 0,
    insets = { left = 0, right = 0, top = 0, bottom = 0 },
})

However, when I pass the same backdrop table (from the first example) to the replacement SetBackdrop method provided by LibBackdrop-1.0 I get errors about attempting to index nil values (specifically, insets and edgeSize). It does handle a nil edgeFile but even in that case requires that edgeSize and insets be set.

The lib should probably fall back on nil/0 like the default API, both for maximal compatibility, and to avoid the need for redundant code in addons.

Additionally, when edgeFile is not specified, the lib forcibly sets all the insets to 0, which does not mirror the behavior of the default API -- you can have insets without a border, if you don't want the backdrop extending all the way to the edges of the frame.

Edit:
If you're short on time, I can make these changes (default to nil textures, 0 sizes/insets, allow insets without edgeFile) for you, just let me know.

User When Change
Phanx Jan 14, 2014 at 12:56 UTC Changed description:
  The lib should probably fall back on nil/0 like the default API, both for maximal compatibility, and to avoid the need for redundant code in addons.

  Additionally, when `edgeFile` is not specified, the lib forcibly sets all the insets to 0, which does not mirror the behavior of the default API -- you can have insets without a border, if you don't want the backdrop extending all the way to the edges of the frame.
+
+ *Edit:*
+ If you're short on time, I can make these changes (default to nil textures, 0 sizes/insets, allow insets without edgeFile) for you, just let me know.
Phanx Jan 14, 2014 at 11:33 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 2 comments
  • Avatar of Phanx Phanx Jan 30, 2014 at 20:19 UTC - 0 likes

    Committed.

  • Avatar of kagaro kagaro Jan 20, 2014 at 21:11 UTC - 0 likes

    Go ahead and make the changes ill tag it when complete. this weeks work fun is replacing ssd array in my db servers.

  • 2 comments

Facts

Last updated
Jan 14, 2014
Reported
Jan 14, 2014
Status
New - Issue has not had initial review yet.
Type
Defect - A shortcoming, fault, or imperfection
Priority
Medium - Normal priority.
Votes
0
Component
Library

Reported by

Possible assignees