annotate Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua @ 25:ac501d71c890 tip

Added tag v8.2.0.024 for changeset 389dcaeebc47
author Tercioo
date Fri, 28 Jun 2019 20:07:27 -0300
parents 3596dadf9a90
children
rev   line source
tercio@0 1
tercio@0 2 -----------------------------------------------------------------------
Tercio@20 3 -- LibDBIcon-1.0
tercio@0 4 --
Tercio@20 5 -- Allows addons to easily create a lightweight minimap icon as an alternative to heavier LDB displays.
tercio@0 6 --
tercio@0 7
tercio@0 8 local DBICON10 = "LibDBIcon-1.0"
Tercioo@22 9 local DBICON10_MINOR = 43 -- Bump on changes
tercio@0 10 if not LibStub then error(DBICON10 .. " requires LibStub.") end
tercio@0 11 local ldb = LibStub("LibDataBroker-1.1", true)
tercio@0 12 if not ldb then error(DBICON10 .. " requires LibDataBroker-1.1.") end
tercio@0 13 local lib = LibStub:NewLibrary(DBICON10, DBICON10_MINOR)
tercio@0 14 if not lib then return end
tercio@0 15
tercio@0 16 lib.objects = lib.objects or {}
tercio@0 17 lib.callbackRegistered = lib.callbackRegistered or nil
tercio@0 18 lib.callbacks = lib.callbacks or LibStub("CallbackHandler-1.0"):New(lib)
tercio@0 19 lib.notCreated = lib.notCreated or {}
Tercioo@22 20 lib.radius = lib.radius or 5
Tercio@20 21 lib.tooltip = lib.tooltip or CreateFrame("GameTooltip", "LibDBIconTooltip", UIParent, "GameTooltipTemplate")
Tercioo@22 22 local next, Minimap = next, Minimap
Tercioo@22 23 local isDraggingButton = false
tercio@0 24
Tercio@20 25 function lib:IconCallback(event, name, key, value)
tercio@0 26 if lib.objects[name] then
tercio@0 27 if key == "icon" then
tercio@0 28 lib.objects[name].icon:SetTexture(value)
tercio@0 29 elseif key == "iconCoords" then
tercio@0 30 lib.objects[name].icon:UpdateCoord()
tercio@0 31 elseif key == "iconR" then
tercio@0 32 local _, g, b = lib.objects[name].icon:GetVertexColor()
tercio@0 33 lib.objects[name].icon:SetVertexColor(value, g, b)
tercio@0 34 elseif key == "iconG" then
tercio@0 35 local r, _, b = lib.objects[name].icon:GetVertexColor()
tercio@0 36 lib.objects[name].icon:SetVertexColor(r, value, b)
tercio@0 37 elseif key == "iconB" then
tercio@0 38 local r, g = lib.objects[name].icon:GetVertexColor()
tercio@0 39 lib.objects[name].icon:SetVertexColor(r, g, value)
tercio@0 40 end
tercio@0 41 end
tercio@0 42 end
tercio@0 43 if not lib.callbackRegistered then
tercio@0 44 ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__icon", "IconCallback")
tercio@0 45 ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__iconCoords", "IconCallback")
tercio@0 46 ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__iconR", "IconCallback")
tercio@0 47 ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__iconG", "IconCallback")
tercio@0 48 ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__iconB", "IconCallback")
tercio@0 49 lib.callbackRegistered = true
tercio@0 50 end
tercio@0 51
tercio@0 52 local function getAnchors(frame)
tercio@0 53 local x, y = frame:GetCenter()
tercio@0 54 if not x or not y then return "CENTER" end
tercio@0 55 local hhalf = (x > UIParent:GetWidth()*2/3) and "RIGHT" or (x < UIParent:GetWidth()/3) and "LEFT" or ""
tercio@0 56 local vhalf = (y > UIParent:GetHeight()/2) and "TOP" or "BOTTOM"
tercio@0 57 return vhalf..hhalf, frame, (vhalf == "TOP" and "BOTTOM" or "TOP")..hhalf
tercio@0 58 end
tercio@0 59
tercio@0 60 local function onEnter(self)
Tercioo@22 61 if isDraggingButton then return end
Tercioo@22 62
Tercioo@22 63 for _, button in next, lib.objects do
Tercioo@22 64 if button.showOnMouseover then
Tercioo@22 65 button.fadeOut:Stop()
Tercioo@22 66 button:SetAlpha(1)
Tercioo@22 67 end
Tercioo@22 68 end
Tercioo@22 69
tercio@0 70 local obj = self.dataObject
tercio@0 71 if obj.OnTooltipShow then
Tercio@20 72 lib.tooltip:SetOwner(self, "ANCHOR_NONE")
Tercio@20 73 lib.tooltip:SetPoint(getAnchors(self))
Tercio@20 74 obj.OnTooltipShow(lib.tooltip)
Tercio@20 75 lib.tooltip:Show()
tercio@0 76 elseif obj.OnEnter then
tercio@0 77 obj.OnEnter(self)
tercio@0 78 end
tercio@0 79 end
tercio@0 80
tercio@0 81 local function onLeave(self)
Tercioo@22 82 lib.tooltip:Hide()
Tercioo@22 83
Tercioo@22 84 if not isDraggingButton then
Tercioo@22 85 for _, button in next, lib.objects do
Tercioo@22 86 if button.showOnMouseover then
Tercioo@22 87 button.fadeOut:Play()
Tercioo@22 88 end
Tercioo@22 89 end
Tercioo@22 90 end
Tercioo@22 91
tercio@0 92 local obj = self.dataObject
Tercioo@22 93 if obj.OnLeave then
Tercioo@22 94 obj.OnLeave(self)
Tercioo@22 95 end
tercio@0 96 end
tercio@0 97
tercio@0 98 --------------------------------------------------------------------------------
tercio@0 99
Tercioo@22 100 local onDragStart, updatePosition
tercio@0 101
tercio@0 102 do
tercio@0 103 local minimapShapes = {
tercio@0 104 ["ROUND"] = {true, true, true, true},
tercio@0 105 ["SQUARE"] = {false, false, false, false},
tercio@0 106 ["CORNER-TOPLEFT"] = {false, false, false, true},
tercio@0 107 ["CORNER-TOPRIGHT"] = {false, false, true, false},
tercio@0 108 ["CORNER-BOTTOMLEFT"] = {false, true, false, false},
tercio@0 109 ["CORNER-BOTTOMRIGHT"] = {true, false, false, false},
tercio@0 110 ["SIDE-LEFT"] = {false, true, false, true},
tercio@0 111 ["SIDE-RIGHT"] = {true, false, true, false},
tercio@0 112 ["SIDE-TOP"] = {false, false, true, true},
tercio@0 113 ["SIDE-BOTTOM"] = {true, true, false, false},
tercio@0 114 ["TRICORNER-TOPLEFT"] = {false, true, true, true},
tercio@0 115 ["TRICORNER-TOPRIGHT"] = {true, false, true, true},
tercio@0 116 ["TRICORNER-BOTTOMLEFT"] = {true, true, false, true},
tercio@0 117 ["TRICORNER-BOTTOMRIGHT"] = {true, true, true, false},
tercio@0 118 }
tercio@0 119
Tercioo@22 120 local rad, cos, sin, sqrt, max, min = math.rad, math.cos, math.sin, math.sqrt, math.max, math.min
Tercioo@22 121 function updatePosition(button, position)
Tercioo@22 122 local angle = rad(position or 225)
Tercioo@22 123 local x, y, q = cos(angle), sin(angle), 1
tercio@0 124 if x < 0 then q = q + 1 end
tercio@0 125 if y > 0 then q = q + 2 end
tercio@0 126 local minimapShape = GetMinimapShape and GetMinimapShape() or "ROUND"
tercio@0 127 local quadTable = minimapShapes[minimapShape]
Tercioo@22 128 local w = (Minimap:GetWidth() / 2) + lib.radius
Tercioo@22 129 local h = (Minimap:GetHeight() / 2) + lib.radius
tercio@0 130 if quadTable[q] then
Tercioo@22 131 x, y = x*w, y*h
tercio@0 132 else
Tercioo@22 133 local diagRadiusW = sqrt(2*(w)^2)-10
Tercioo@22 134 local diagRadiusH = sqrt(2*(h)^2)-10
Tercioo@22 135 x = max(-w, min(x*diagRadiusW, w))
Tercioo@22 136 y = max(-h, min(y*diagRadiusH, h))
tercio@0 137 end
tercio@0 138 button:SetPoint("CENTER", Minimap, "CENTER", x, y)
tercio@0 139 end
tercio@0 140 end
tercio@0 141
Tercioo@22 142 local function onClick(self, b)
Tercioo@22 143 if self.dataObject.OnClick then
Tercioo@22 144 self.dataObject.OnClick(self, b)
Tercioo@22 145 end
Tercioo@22 146 end
Tercioo@22 147
Tercioo@22 148 local function onMouseDown(self)
Tercioo@22 149 self.isMouseDown = true
Tercioo@22 150 self.icon:UpdateCoord()
Tercioo@22 151 end
Tercioo@22 152
Tercioo@22 153 local function onMouseUp(self)
Tercioo@22 154 self.isMouseDown = false
Tercioo@22 155 self.icon:UpdateCoord()
Tercioo@22 156 end
tercio@0 157
tercio@0 158 do
Tercioo@22 159 local deg, atan2 = math.deg, math.atan2
tercio@0 160 local function onUpdate(self)
tercio@0 161 local mx, my = Minimap:GetCenter()
tercio@0 162 local px, py = GetCursorPosition()
tercio@0 163 local scale = Minimap:GetEffectiveScale()
tercio@0 164 px, py = px / scale, py / scale
Tercioo@22 165 local pos = 225
tercio@0 166 if self.db then
Tercioo@22 167 pos = deg(atan2(py - my, px - mx)) % 360
Tercioo@22 168 self.db.minimapPos = pos
tercio@0 169 else
Tercioo@22 170 pos = deg(atan2(py - my, px - mx)) % 360
Tercioo@22 171 self.minimapPos = pos
tercio@0 172 end
Tercioo@22 173 updatePosition(self, pos)
tercio@0 174 end
tercio@0 175
tercio@0 176 function onDragStart(self)
tercio@0 177 self:LockHighlight()
tercio@0 178 self.isMouseDown = true
tercio@0 179 self.icon:UpdateCoord()
tercio@0 180 self:SetScript("OnUpdate", onUpdate)
Tercioo@22 181 isDraggingButton = true
Tercio@20 182 lib.tooltip:Hide()
Tercioo@22 183 for _, button in next, lib.objects do
Tercioo@22 184 if button.showOnMouseover then
Tercioo@22 185 button.fadeOut:Stop()
Tercioo@22 186 button:SetAlpha(1)
Tercioo@22 187 end
Tercioo@22 188 end
tercio@0 189 end
tercio@0 190 end
tercio@0 191
Tercioo@22 192 local function onDragStop(self)
tercio@0 193 self:SetScript("OnUpdate", nil)
tercio@0 194 self.isMouseDown = false
tercio@0 195 self.icon:UpdateCoord()
tercio@0 196 self:UnlockHighlight()
Tercioo@22 197 isDraggingButton = false
Tercioo@22 198 for _, button in next, lib.objects do
Tercioo@22 199 if button.showOnMouseover then
Tercioo@22 200 button.fadeOut:Play()
Tercioo@22 201 end
Tercioo@22 202 end
tercio@0 203 end
tercio@0 204
tercio@0 205 local defaultCoords = {0, 1, 0, 1}
tercio@0 206 local function updateCoord(self)
tercio@0 207 local coords = self:GetParent().dataObject.iconCoords or defaultCoords
tercio@0 208 local deltaX, deltaY = 0, 0
tercio@0 209 if not self:GetParent().isMouseDown then
tercio@0 210 deltaX = (coords[2] - coords[1]) * 0.05
tercio@0 211 deltaY = (coords[4] - coords[3]) * 0.05
tercio@0 212 end
tercio@0 213 self:SetTexCoord(coords[1] + deltaX, coords[2] - deltaX, coords[3] + deltaY, coords[4] - deltaY)
tercio@0 214 end
tercio@0 215
tercio@0 216 local function createButton(name, object, db)
tercio@0 217 local button = CreateFrame("Button", "LibDBIcon10_"..name, Minimap)
tercio@0 218 button.dataObject = object
tercio@0 219 button.db = db
tercio@0 220 button:SetFrameStrata("MEDIUM")
tercio@0 221 button:SetSize(31, 31)
tercio@0 222 button:SetFrameLevel(8)
tercio@0 223 button:RegisterForClicks("anyUp")
tercio@0 224 button:RegisterForDrag("LeftButton")
Tercio@20 225 button:SetHighlightTexture(136477) --"Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight"
tercio@0 226 local overlay = button:CreateTexture(nil, "OVERLAY")
tercio@0 227 overlay:SetSize(53, 53)
Tercio@20 228 overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
tercio@0 229 overlay:SetPoint("TOPLEFT")
tercio@0 230 local background = button:CreateTexture(nil, "BACKGROUND")
tercio@0 231 background:SetSize(20, 20)
Tercio@20 232 background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
tercio@0 233 background:SetPoint("TOPLEFT", 7, -5)
tercio@0 234 local icon = button:CreateTexture(nil, "ARTWORK")
tercio@0 235 icon:SetSize(17, 17)
tercio@0 236 icon:SetTexture(object.icon)
tercio@0 237 icon:SetPoint("TOPLEFT", 7, -6)
tercio@0 238 button.icon = icon
tercio@0 239 button.isMouseDown = false
tercio@0 240
tercio@0 241 local r, g, b = icon:GetVertexColor()
tercio@0 242 icon:SetVertexColor(object.iconR or r, object.iconG or g, object.iconB or b)
tercio@0 243
tercio@0 244 icon.UpdateCoord = updateCoord
tercio@0 245 icon:UpdateCoord()
tercio@0 246
tercio@0 247 button:SetScript("OnEnter", onEnter)
tercio@0 248 button:SetScript("OnLeave", onLeave)
tercio@0 249 button:SetScript("OnClick", onClick)
tercio@0 250 if not db or not db.lock then
tercio@0 251 button:SetScript("OnDragStart", onDragStart)
tercio@0 252 button:SetScript("OnDragStop", onDragStop)
tercio@0 253 end
tercio@0 254 button:SetScript("OnMouseDown", onMouseDown)
tercio@0 255 button:SetScript("OnMouseUp", onMouseUp)
tercio@0 256
Tercioo@22 257 button.fadeOut = button:CreateAnimationGroup()
Tercioo@22 258 local animOut = button.fadeOut:CreateAnimation("Alpha")
Tercioo@22 259 animOut:SetOrder(1)
Tercioo@22 260 animOut:SetDuration(0.2)
Tercioo@22 261 animOut:SetFromAlpha(1)
Tercioo@22 262 animOut:SetToAlpha(0)
Tercioo@22 263 animOut:SetStartDelay(1)
Tercioo@22 264 button.fadeOut:SetToFinalAlpha(true)
Tercioo@22 265
tercio@0 266 lib.objects[name] = button
tercio@0 267
tercio@0 268 if lib.loggedIn then
Tercioo@22 269 updatePosition(button, db and db.minimapPos)
Tercioo@22 270 if not db or not db.hide then
Tercioo@22 271 button:Show()
Tercioo@22 272 else
Tercioo@22 273 button:Hide()
Tercioo@22 274 end
tercio@0 275 end
tercio@0 276 lib.callbacks:Fire("LibDBIcon_IconCreated", button, name) -- Fire 'Icon Created' callback
tercio@0 277 end
tercio@0 278
tercio@0 279 -- We could use a metatable.__index on lib.objects, but then we'd create
tercio@0 280 -- the icons when checking things like :IsRegistered, which is not necessary.
tercio@0 281 local function check(name)
tercio@0 282 if lib.notCreated[name] then
tercio@0 283 createButton(name, lib.notCreated[name][1], lib.notCreated[name][2])
tercio@0 284 lib.notCreated[name] = nil
tercio@0 285 end
tercio@0 286 end
tercio@0 287
tercio@0 288 -- Wait a bit with the initial positioning to let any GetMinimapShape addons
tercio@0 289 -- load up.
tercio@0 290 if not lib.loggedIn then
tercio@0 291 local f = CreateFrame("Frame")
Tercioo@22 292 f:SetScript("OnEvent", function(f)
Tercioo@22 293 for _, button in next, lib.objects do
Tercioo@22 294 updatePosition(button, button.db and button.db.minimapPos)
Tercioo@22 295 if not button.db or not button.db.hide then
Tercioo@22 296 button:Show()
Tercioo@22 297 else
Tercioo@22 298 button:Hide()
Tercioo@22 299 end
tercio@0 300 end
tercio@0 301 lib.loggedIn = true
tercio@0 302 f:SetScript("OnEvent", nil)
tercio@0 303 end)
tercio@0 304 f:RegisterEvent("PLAYER_LOGIN")
tercio@0 305 end
tercio@0 306
tercio@0 307 local function getDatabase(name)
tercio@0 308 return lib.notCreated[name] and lib.notCreated[name][2] or lib.objects[name].db
tercio@0 309 end
tercio@0 310
tercio@0 311 function lib:Register(name, object, db)
tercio@0 312 if not object.icon then error("Can't register LDB objects without icons set!") end
Tercioo@22 313 if lib.objects[name] or lib.notCreated[name] then error(DBICON10.. ": Object '".. name .."' is already registered.") end
Tercioo@22 314 if not db or not db.hide then
tercio@0 315 createButton(name, object, db)
tercio@0 316 else
tercio@0 317 lib.notCreated[name] = {object, db}
tercio@0 318 end
tercio@0 319 end
tercio@0 320
tercio@0 321 function lib:Lock(name)
tercio@0 322 if not lib:IsRegistered(name) then return end
tercio@0 323 if lib.objects[name] then
tercio@0 324 lib.objects[name]:SetScript("OnDragStart", nil)
tercio@0 325 lib.objects[name]:SetScript("OnDragStop", nil)
tercio@0 326 end
tercio@0 327 local db = getDatabase(name)
Tercioo@22 328 if db then
Tercioo@22 329 db.lock = true
Tercioo@22 330 end
tercio@0 331 end
tercio@0 332
tercio@0 333 function lib:Unlock(name)
tercio@0 334 if not lib:IsRegistered(name) then return end
tercio@0 335 if lib.objects[name] then
tercio@0 336 lib.objects[name]:SetScript("OnDragStart", onDragStart)
tercio@0 337 lib.objects[name]:SetScript("OnDragStop", onDragStop)
tercio@0 338 end
tercio@0 339 local db = getDatabase(name)
Tercioo@22 340 if db then
Tercioo@22 341 db.lock = nil
Tercioo@22 342 end
tercio@0 343 end
tercio@0 344
tercio@0 345 function lib:Hide(name)
tercio@0 346 if not lib.objects[name] then return end
tercio@0 347 lib.objects[name]:Hide()
tercio@0 348 end
Tercioo@22 349
tercio@0 350 function lib:Show(name)
tercio@0 351 check(name)
Tercioo@22 352 local button = lib.objects[name]
Tercioo@22 353 if button then
Tercioo@22 354 button:Show()
Tercioo@22 355 updatePosition(button, button.db and button.db.minimapPos or button.minimapPos)
Tercioo@22 356 end
tercio@0 357 end
Tercioo@22 358
tercio@0 359 function lib:IsRegistered(name)
tercio@0 360 return (lib.objects[name] or lib.notCreated[name]) and true or false
tercio@0 361 end
Tercioo@22 362
tercio@0 363 function lib:Refresh(name, db)
tercio@0 364 check(name)
tercio@0 365 local button = lib.objects[name]
Tercioo@22 366 if db then
Tercioo@22 367 button.db = db
Tercioo@22 368 end
Tercioo@22 369 updatePosition(button, button.db and button.db.minimapPos or button.minimapPos)
tercio@0 370 if not button.db or not button.db.hide then
tercio@0 371 button:Show()
tercio@0 372 else
tercio@0 373 button:Hide()
tercio@0 374 end
tercio@0 375 if not button.db or not button.db.lock then
tercio@0 376 button:SetScript("OnDragStart", onDragStart)
tercio@0 377 button:SetScript("OnDragStop", onDragStop)
tercio@0 378 else
tercio@0 379 button:SetScript("OnDragStart", nil)
tercio@0 380 button:SetScript("OnDragStop", nil)
tercio@0 381 end
tercio@0 382 end
Tercioo@22 383
tercio@0 384 function lib:GetMinimapButton(name)
tercio@0 385 return lib.objects[name]
tercio@0 386 end
tercio@0 387
Tercioo@22 388 do
Tercioo@22 389 local function OnMinimapEnter()
Tercioo@22 390 if isDraggingButton then return end
Tercioo@22 391 for _, button in next, lib.objects do
Tercioo@22 392 if button.showOnMouseover then
Tercioo@22 393 button.fadeOut:Stop()
Tercioo@22 394 button:SetAlpha(1)
Tercioo@22 395 end
tercio@0 396 end
tercio@0 397 end
Tercioo@22 398 local function OnMinimapLeave()
Tercioo@22 399 if isDraggingButton then return end
Tercioo@22 400 for _, button in next, lib.objects do
Tercioo@22 401 if button.showOnMouseover then
Tercioo@22 402 button.fadeOut:Play()
Tercioo@22 403 end
Tercioo@22 404 end
Tercioo@22 405 end
Tercioo@22 406 Minimap:HookScript("OnEnter", OnMinimapEnter)
Tercioo@22 407 Minimap:HookScript("OnLeave", OnMinimapLeave)
Tercioo@22 408
Tercioo@22 409 function lib:ShowOnEnter(name, value)
Tercioo@22 410 local button = lib.objects[name]
Tercioo@22 411 if button then
Tercioo@22 412 if value then
Tercioo@22 413 button.showOnMouseover = true
Tercioo@22 414 button.fadeOut:Stop()
Tercioo@22 415 button:SetAlpha(0)
Tercioo@22 416 else
Tercioo@22 417 button.showOnMouseover = false
Tercioo@22 418 button.fadeOut:Stop()
Tercioo@22 419 button:SetAlpha(1)
Tercioo@22 420 end
tercio@0 421 end
tercio@0 422 end
tercio@0 423 end
tercio@0 424
Tercioo@22 425 function lib:GetButtonList()
Tercioo@22 426 local t = {}
Tercioo@22 427 for name in next, lib.objects do
Tercioo@22 428 t[#t+1] = name
Tercioo@22 429 end
Tercioo@22 430 return t
Tercioo@22 431 end
Tercioo@22 432
Tercioo@22 433 function lib:SetButtonRadius(radius)
Tercioo@22 434 if type(radius) == "number" then
Tercioo@22 435 lib.radius = radius
Tercioo@22 436 for _, button in next, lib.objects do
Tercioo@22 437 updatePosition(button, button.db and button.db.minimapPos or button.minimapPos)
Tercioo@22 438 end
tercio@0 439 end
tercio@0 440 end
tercio@0 441
Tercioo@22 442 function lib:SetButtonToPosition(button, position)
Tercioo@22 443 updatePosition(lib.objects[button] or button, position)
Tercioo@22 444 end
Tercioo@22 445
Tercioo@22 446 -- Upgrade!
Tercioo@22 447 for name, button in next, lib.objects do
Tercioo@22 448 local db = getDatabase(name)
Tercioo@22 449 if not db or not db.lock then
Tercioo@22 450 button:SetScript("OnDragStart", onDragStart)
Tercioo@22 451 button:SetScript("OnDragStop", onDragStop)
Tercioo@22 452 end
Tercioo@22 453 button:SetScript("OnEnter", onEnter)
Tercioo@22 454 button:SetScript("OnLeave", onLeave)
Tercioo@22 455 button:SetScript("OnClick", onClick)
Tercioo@22 456 button:SetScript("OnMouseDown", onMouseDown)
Tercioo@22 457 button:SetScript("OnMouseUp", onMouseUp)
Tercioo@22 458
Tercioo@22 459 if not button.fadeOut then -- Upgrade to 39
Tercioo@22 460 button.fadeOut = button:CreateAnimationGroup()
Tercioo@22 461 local animOut = button.fadeOut:CreateAnimation("Alpha")
Tercioo@22 462 animOut:SetOrder(1)
Tercioo@22 463 animOut:SetDuration(0.2)
Tercioo@22 464 animOut:SetFromAlpha(1)
Tercioo@22 465 animOut:SetToAlpha(0)
Tercioo@22 466 animOut:SetStartDelay(1)
Tercioo@22 467 button.fadeOut:SetToFinalAlpha(true)
Tercioo@22 468 end
Tercioo@22 469 end
Tercioo@22 470 lib:SetButtonRadius(lib.radius) -- Upgrade to 40