annotate Veneer.lua @ 88:b107b4df7eb6

- core:DynamicReanchor - top-down evaluation of clustered frames - core:InternalReanchor(module) - bottom-up evaluation of target and frames anchored to it
author Nenue
date Thu, 20 Oct 2016 04:08:11 -0400
parents 27db212af783
children 74e714637d6a
rev   line source
Nenue@88 1 -- Veneer Custom Interface Framework
Nenue@88 2 -- 1. vn OnLoad
Nenue@88 3 -- 2. OnEvent where IsLoggedIn() == true
Nenue@88 4 -- 3. Setup() where (not self.initialized)
Nenue@88 5 -- 4. Update()
Nenue@88 6 -- 5. Reanchor()
Nenue@84 7
Nenue@84 8 SLASH_VENEER1 = "/veneer"
Nenue@84 9 SLASH_VENEER2 = "/vn"
Nenue@84 10
Nenue@84 11 SlashCmdList.VENEER = function(cmd)
Nenue@84 12 end
Nenue@88 13
Nenue@84 14 VeneerCore = {
Nenue@84 15 Frames = {},
Nenue@84 16 ConfigLayers = {},
Nenue@84 17 FrameClusters = {},
Nenue@84 18 parserDepth = 0,
Nenue@84 19 pendingCalls = {},
Nenue@84 20 }
Nenue@84 21 VeneerHandlerMixin = {
Nenue@88 22
Nenue@87 23 anchorPoint = 'CENTER', -- indicates the initial cluster group point
Nenue@87 24 --anchorPath = 'BOTTOM', -- indicates the point from which the frame is anchored in a cluster arrangement
Nenue@88 25 OnHide = function()
Nenue@88 26 Veneer:DynamicReanchor()
Nenue@88 27 end,
Nenue@88 28 OnShow = function(self)
Nenue@88 29 self:Reanchor()
Nenue@88 30 Veneer:StaticReanchor(self)
Nenue@88 31 end
Nenue@84 32 }
Nenue@88 33 VeneerAnimationMixin = {}
Nenue@84 34 local print = DEVIAN_WORKSPACE and function(...) print('Veneer', ...) end or nop
Nenue@80 35 local wipe = table.wipe
Nenue@0 36
Nenue@59 37 local defaults = {
Nenue@59 38 enableAll = true,
Nenue@59 39 enableModule = {
Nenue@59 40 BuffFrame = true,
Nenue@59 41 },
Nenue@59 42 BuffFrame = {
Nenue@59 43 width = 48,
Nenue@59 44 height = 48,
Nenue@59 45 }
Nenue@59 46 }
Nenue@84 47
Nenue@71 48 local configMode
Nenue@79 49 local anonID = 0
Nenue@79 50 local tostring = tostring
Nenue@79 51 local IsFrameHandle = IsFrameHandle
Nenue@79 52 local GetAnonymousName = function(key)
Nenue@79 53 if not key then
Nenue@71 54 anonID = anonID + 1
Nenue@79 55 key = anonID
Nenue@71 56 end
Nenue@79 57 return 'VN' .. key
Nenue@71 58 end
Nenue@79 59 local GetTableName = function(table)
Nenue@79 60 return (IsFrameHandle(table) and table:GetName()) or tostring(table)
Nenue@79 61 end
Nenue@79 62
Nenue@87 63 local OFFSET_PARALLELS = {
Nenue@87 64 TOP = {'LEFT', 'RIGHT', 'SetHeight'},
Nenue@87 65 BOTTOM = {'LEFT', 'RIGHT', 'SetHeight'},
Nenue@87 66 LEFT = {'TOP', 'BOTTOM', 'SetWidth'},
Nenue@87 67 RIGHT = {'TOP', 'BOTTOM', 'SetWidth'},
Nenue@87 68 }
Nenue@87 69 local ANCHOR_OFFSET_POINT = {
Nenue@87 70 TOP = 'BOTTOM',
Nenue@87 71 TOPLEFT = 'BOTTOMRIGHT',
Nenue@87 72 TOPRIGHT = 'BOTTOMLEFT',
Nenue@87 73 LEFT = 'RIGHT',
Nenue@87 74 RIGHT = 'LEFT',
Nenue@87 75 CENTER = 'CENTER',
Nenue@87 76 BOTTOM = 'TOP',
Nenue@87 77 BOTTOMRIGHT = 'TOPLEFT',
Nenue@87 78 BOTTOMLEFT = 'TOPRIGHT',
Nenue@87 79 }
Nenue@87 80 local ANCHOR_INSET_DELTA = {
Nenue@87 81 TOP = {0, -1},
Nenue@87 82 TOPLEFT = {1, -1},
Nenue@87 83 TOPRIGHT = {-1,-1},
Nenue@87 84 LEFT = {1, 0},
Nenue@87 85 BOTTOMLEFT = {1, 1},
Nenue@87 86 BOTTOM = {0, 1},
Nenue@87 87 BOTTOMRIGHT = {-1, 1},
Nenue@87 88 RIGHT = {-1, 0},
Nenue@87 89 CENTER = {0, 0},
Nenue@72 90 }
Nenue@72 91
Nenue@84 92 function VeneerCore:print(...)
Nenue@84 93 local txt = '|cFFFFFF00Veneer|r:'
Nenue@84 94 for i = 1, select('#', ...) do
Nenue@84 95 txt = txt .. ' '.. tostring(select(i, ...))
Nenue@84 96 end
Nenue@84 97
Nenue@84 98 DEFAULT_CHAT_FRAME:AddMessage(txt)
Nenue@84 99 end
Nenue@84 100
Nenue@84 101 function VeneerCore:OnLoad()
Nenue@84 102 print('|cFFFFFF00Veneer!|r')
Nenue@84 103 self:RegisterEvent('ADDON_LOADED')
Nenue@84 104 self:RegisterEvent('PLAYER_LOGIN')
Nenue@84 105
Nenue@84 106 self.DEVIAN_PNAME = 'Veneer'
Nenue@84 107 self:RegisterForDrag('LeftButton')
Nenue@88 108
Nenue@88 109
Nenue@84 110 end
Nenue@84 111
Nenue@84 112 function VeneerCore:OnEvent(event, ...)
Nenue@84 113 if event == 'ADDON_LOADED' or event == 'PLAYER_LOGIN' then
Nenue@84 114 if IsLoggedIn() and not self.intialized then
Nenue@84 115 self:Setup()
Nenue@87 116 self:UnregisterEvent('ADDON_LOADED')
Nenue@87 117 self:UnregisterEvent('PLAYER_LOGIN')
Nenue@87 118 self:Reanchor()
Nenue@87 119 self:Update()
Nenue@84 120 end
Nenue@84 121 end
Nenue@84 122 end
Nenue@84 123
Nenue@84 124 function VeneerCore:OnDragStart()
Nenue@84 125 self:StartMoving()
Nenue@84 126 end
Nenue@84 127
Nenue@84 128
Nenue@84 129 function VeneerCore:OnDragStop()
Nenue@84 130 self:StopMovingOrSizing()
Nenue@84 131 end
Nenue@84 132
Nenue@84 133 function VeneerCore:Setup ()
Nenue@87 134 self.initialized = true
Nenue@84 135 if (not VeneerData) or (not VeneerData.version) then
Nenue@84 136 VeneerData = defaults
Nenue@84 137 end
Nenue@84 138 self.data = VeneerData
Nenue@87 139 self:ExecuteOnClusters(nil, 'Setup')
Nenue@87 140 end
Nenue@84 141
Nenue@84 142
Nenue@87 143 function VeneerCore:GetClusterFromArgs (...)
Nenue@87 144 local primaryAnchor
Nenue@87 145 local insertPosition
Nenue@87 146 local clusterTable = self.FrameClusters
Nenue@87 147 for i = 1, select('#', ...) do
Nenue@87 148 local arg = select(i, ...)
Nenue@87 149 local argType = type(arg)
Nenue@87 150 if argType == 'string' then
Nenue@87 151 if not primaryAnchor then
Nenue@87 152 primaryAnchor = arg
Nenue@87 153 end
Nenue@87 154 clusterTable[arg] = clusterTable[arg] or {}
Nenue@87 155 clusterTable = clusterTable[arg]
Nenue@87 156 print(string.rep(' ', i)..'anchor cluster', i, arg)
Nenue@87 157 elseif argType == 'boolean' then
Nenue@87 158 insertPosition = 1
Nenue@87 159 end
Nenue@87 160 end
Nenue@87 161 if not primaryAnchor then
Nenue@87 162 primaryAnchor = 'TOPLEFT'
Nenue@87 163 end
Nenue@87 164 if not insertPosition then
Nenue@87 165 insertPosition = #clusterTable + 1
Nenue@87 166 end
Nenue@87 167
Nenue@87 168
Nenue@87 169 return primaryAnchor, clusterTable, insertPosition
Nenue@84 170 end
Nenue@84 171
Nenue@84 172 function VeneerCore:AddHandler(handler, ...)
Nenue@84 173 print('*** Adding handler:', handler.moduleName or handler:GetName())
Nenue@87 174
Nenue@87 175 local anchorGroup, clusterTable, clusterIndex = self:GetClusterFromArgs(...)
Nenue@87 176 if clusterIndex == 1 then
Nenue@87 177 for i, frame in ipairs(clusterTable) do
Nenue@87 178 frame.clusterIndex = i + 1
Nenue@87 179 end
Nenue@84 180 end
Nenue@87 181 tinsert(clusterTable, clusterIndex, handler)
Nenue@87 182 print('cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex)
Nenue@87 183
Nenue@87 184
Nenue@87 185 handler.anchorCluster = clusterTable
Nenue@87 186 handler.anchorIndex = clusterIndex
Nenue@84 187 for k,v in pairs(VeneerHandlerMixin) do
Nenue@84 188 if not handler[k] then
Nenue@87 189 print(' * from mixin:', k)
Nenue@84 190 handler[k] = v
Nenue@84 191 end
Nenue@84 192 end
Nenue@87 193 if self.initialized then
Nenue@87 194 print(' -- doing initialization')
Nenue@87 195 if handler.Setup and not handler.initialized then
Nenue@87 196 handler:Setup()
Nenue@87 197 handler.initialized = true
Nenue@87 198 end
Nenue@87 199 self:InternalReanchor(handler)
Nenue@87 200
Nenue@87 201 end
Nenue@87 202 end
Nenue@87 203
Nenue@87 204 function VeneerCore:Reanchor()
Nenue@87 205 self:ExecuteOnClusters(nil, 'Reanchor')
Nenue@88 206 self:DynamicReanchor(self)
Nenue@87 207 end
Nenue@87 208
Nenue@87 209 function VeneerCore:Update()
Nenue@87 210 self:ExecuteOnClusters(nil, 'Update')
Nenue@88 211 self:Reanchor()
Nenue@87 212 end
Nenue@87 213
Nenue@87 214 -- updates anchor relations to and from the target handler
Nenue@87 215 function VeneerCore:GetAnchor(...)
Nenue@87 216
Nenue@87 217 end
Nenue@87 218
Nenue@88 219 -- Evaluates frames visibility and chains them accordingly
Nenue@88 220
Nenue@88 221 function VeneerCore:DynamicReanchor(parent)
Nenue@88 222 parent = parent or self
Nenue@88 223 print('|cFF88FF00DynamicReanchor()')
Nenue@88 224 for anchorPoint, cluster in pairs(parent.FrameClusters) do
Nenue@88 225 local lastFrame
Nenue@88 226 for index, frame in ipairs(cluster) do
Nenue@88 227 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
Nenue@88 228 if frame:IsVisible() then
Nenue@88 229 anchorPoint = frame.anchorPoint
Nenue@88 230
Nenue@88 231
Nenue@88 232 frame:ClearAllPoints()
Nenue@88 233 if lastFrame then
Nenue@88 234 frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0)
Nenue@88 235 else
Nenue@88 236 frame:SetPoint(anchorPoint, UIParent, anchorPoint, 0, 0)
Nenue@88 237 end
Nenue@88 238 lastFrame = frame
Nenue@88 239 end
Nenue@88 240
Nenue@88 241 end
Nenue@88 242 end
Nenue@88 243 end
Nenue@88 244
Nenue@88 245 -- Evaluates the current visibility state and re-anchors adjacent blocks accordingly
Nenue@87 246 function VeneerCore:InternalReanchor(handler, printFunc)
Nenue@87 247 print('|cFF00FFFFVeneer:InternalReanchor('..handler:GetName()..')')
Nenue@87 248 local anchorPoint = handler.anchorPath or handler.anchorPoint
Nenue@87 249 local anchorParent, anchorTo = UIParent, anchorPoint
Nenue@88 250 local subPoint, subTo
Nenue@88 251 local nextFrame
Nenue@88 252 for index, frame in ipairs(handler.anchorCluster) do
Nenue@87 253
Nenue@88 254 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
Nenue@88 255 if frame:IsVisible() then
Nenue@88 256 if frame ~= handler then
Nenue@88 257 anchorParent = frame
Nenue@88 258 anchorTo = ANCHOR_OFFSET_POINT[anchorPoint]
Nenue@87 259
Nenue@88 260 else
Nenue@88 261 nextFrame = handler.anchorCluster[index+1]
Nenue@88 262 if nextFrame then
Nenue@88 263
Nenue@88 264 subPoint = nextFrame.anchorPath or nextFrame.anchorPoint
Nenue@88 265 subTo = ANCHOR_OFFSET_POINT[subPoint]
Nenue@88 266 nextFrame:ClearAllPoints()
Nenue@88 267 nextFrame:SetPoint(subPoint, handler, subTo, 0, 0)
Nenue@88 268 print(' -- pushing '..nextFrame:GetName()..' down the anchor chain', subPoint, subTo)
Nenue@88 269 end
Nenue@88 270 break
Nenue@87 271 end
Nenue@87 272 end
Nenue@87 273 end
Nenue@87 274
Nenue@88 275 if handler:IsVisible() then
Nenue@88 276 handler:SetPoint(anchorPoint, anchorParent, anchorTo, 0, 0)
Nenue@88 277 else
Nenue@88 278 if anchorParent and nextFrame then
Nenue@88 279 nextFrame:SetPoint(subPoint, handler, subTo, 0, 0)
Nenue@88 280 end
Nenue@88 281 end
Nenue@88 282
Nenue@87 283
Nenue@87 284 print(handler.anchorPoint, anchorParent, anchorTo)
Nenue@87 285 if printFunc then
Nenue@87 286 printFunc('|cFF88FF00'..handler:GetName()..':SetPoint(', handler.anchorPoint, anchorParent, anchorTo)
Nenue@87 287 end
Nenue@88 288 end
Nenue@87 289
Nenue@88 290 function VeneerCore:SlideBlock(frame, ...)
Nenue@88 291
Nenue@88 292 local anchorPoint, parent, anchorTo, pX,pY = ...
Nenue@88 293 print(' |cFF0088FFSlide:|r', frame, 'to', parent, pX,pY)
Nenue@88 294 local qX, qY = pX, pY
Nenue@88 295 local bX, bY
Nenue@88 296 local dX, dY = 0, 0
Nenue@88 297 local aX, aY = frame:GetLeft(), frame:GetTop()
Nenue@88 298 local str = ''
Nenue@88 299 if not aX then
Nenue@88 300 dY = ((anchorPoint == 'TOP') and frame:GetHeight()) or (((anchorPoint == 'BOTTOM') and -frame:GetHeight()) or 0)
Nenue@88 301 dX = ((anchorPoint == 'LEFT') and -frame:GetWidth()) or (((anchorPoint == 'RIGHT') and frame:GetWidth()) or 0)
Nenue@88 302 qX = pX + dX
Nenue@88 303 qY = pY + dY
Nenue@88 304 aX, aY = qX, qY
Nenue@88 305 bX, bY = pX, pY
Nenue@88 306 str = '|cFFFFFF00relative|r'
Nenue@88 307 else
Nenue@88 308 frame:ClearAllPoints()
Nenue@88 309
Nenue@88 310 bX, bY = frame:GetLeft(), frame:GetTop()
Nenue@88 311 dX, dY = (bX-aX), (bY-aY)
Nenue@88 312
Nenue@88 313 str = '|cFFFFFF00existing|r'
Nenue@88 314 end
Nenue@88 315
Nenue@88 316 if ((dX ~= 0) or (dY ~= 0)) and frame.BlockSlide then
Nenue@88 317 print(' |cFF00FF88Slide result:|r',str, dX, dY)
Nenue@88 318
Nenue@88 319 frame:ClearAllPoints()
Nenue@88 320 frame:SetPoint(anchorPoint, parent, anchorTo, qX, qY)
Nenue@88 321 frame.BlockSlide.dX = dX
Nenue@88 322 frame.BlockSlide.dY = dY
Nenue@88 323 frame.BlockSlide.sourcePoint = {anchorPoint, parent, anchorTo, qX, qY}
Nenue@88 324 frame.BlockSlide.destPoint = {anchorPoint, parent, anchorTo, pX,pY}
Nenue@88 325 frame.BlockSlide.translation:SetOffset(dX, dY)
Nenue@88 326 frame.BlockSlide:Play()
Nenue@88 327 return
Nenue@88 328 end
Nenue@84 329 end
Nenue@84 330
Nenue@88 331
Nenue@84 332 function VeneerCore:ExecuteOnClusters(layer, method)
Nenue@84 333 self.parserDepth = self.parserDepth + 1
Nenue@84 334 if not layer then
Nenue@87 335 if self.parserDepth > 1 then
Nenue@84 336 tinsert(self.pendingCalls, method)
Nenue@84 337 print('delaying walk for', method)
Nenue@84 338 return
Nenue@84 339 end
Nenue@87 340 print('|cFF00FF00Veneer:ExecuteOnClusters|r('..tostring(layer)..', '..method..')')
Nenue@84 341 else
Nenue@87 342 print(' Level '..self.parserDepth)
Nenue@84 343 end
Nenue@87 344
Nenue@87 345 layer = layer or self.FrameClusters
Nenue@84 346 for anchor, cluster in pairs(layer) do
Nenue@84 347 for index, frame in ipairs(cluster) do
Nenue@87 348 print(' '..anchor..'.'..index..' = '..frame:GetName())
Nenue@84 349 if frame[method] then
Nenue@87 350 print(' |cFF00FF00'..frame:GetName())
Nenue@87 351 frame[method](frame, true)
Nenue@84 352 end
Nenue@84 353 end
Nenue@84 354 if cluster.FrameClusters then
Nenue@84 355 self:ExecuteOnClusters(cluster.FrameClusters, method)
Nenue@84 356 end
Nenue@84 357 end
Nenue@84 358 self.parserDepth = self.parserDepth - 1
Nenue@84 359
Nenue@84 360 if (self.parserDepth == 0) and (#self.pendingCalls >= 1) then
Nenue@84 361 local delayedMethod = tremove(self.pendingCalls, 1)
Nenue@84 362 print('starting delayed walk for', delayedMethod)
Nenue@84 363 self:ExecuteOnClusters(nil, delayedMethod)
Nenue@84 364 end
Nenue@84 365 end
Nenue@84 366
Nenue@72 367 local VeneerButton_OnDragStart = function(self)
Nenue@72 368 self.startingLeft = self:GetLeft()
Nenue@72 369 self.startingBottom = self:GetBottom()
Nenue@72 370 self.anchors = self.anchors or {}
Nenue@72 371 table.wipe(self.anchors)
Nenue@72 372
Nenue@72 373 local frame = self:GetParent()
Nenue@72 374 local n = frame:GetNumPoints()
Nenue@72 375 for i = 1, n do
Nenue@72 376 local anchor, parent, relative, x, y = frame:GetPoint(i)
Nenue@72 377 self.anchors[i] = {
Nenue@72 378 anchor = anchor,
Nenue@72 379 parent = parent,
Nenue@72 380 relative = relative,
Nenue@72 381 x = x,
Nenue@72 382 y = y
Nenue@72 383 }
Nenue@72 384 end
Nenue@72 385
Nenue@72 386 print(self:GetName(), 'start moving', self.startingLeft, self.startingBottom)
Nenue@72 387 self:StartMoving()
Nenue@72 388 end
Nenue@72 389
Nenue@72 390 local VeneerButton_OnDragStop = function(self)
Nenue@72 391 self:StopMovingOrSizing()
Nenue@72 392 if self.OnDragStop then
Nenue@72 393 self.OnDragStop(self)
Nenue@72 394 else
Nenue@72 395 local frame = self:GetParent()
Nenue@72 396 local dx = self:GetLeft() - self.startingLeft
Nenue@72 397 local dy = self:GetBottom() - self.startingBottom
Nenue@72 398
Nenue@72 399 frame:ClearAllPoints()
Nenue@72 400 for i, point in ipairs(self.anchors) do
Nenue@72 401 frame:SetPoint(point.anchor, point.parent, point.relative, point.x + dx, point.y + dy)
Nenue@72 402 print('adjusting anchor', point.anchor, point.parent, point.relative, point.x + dx, point.y + dy)
Nenue@72 403 end
Nenue@72 404 end
Nenue@72 405 end
Nenue@72 406
Nenue@72 407 local Veneer_FixMovers = function()
Nenue@72 408 for frame, veneer in pairs(veneers) do
Nenue@72 409 if veneer:IsMoving() then
Nenue@72 410 VeneerButton_OnDragStop(veneer)
Nenue@72 411 end
Nenue@72 412 end
Nenue@72 413 end
Nenue@71 414
Nenue@71 415 local VeneerButton_Update = function(self)
Nenue@71 416 if configMode then
Nenue@72 417 self:SetScript('OnDragStart', VeneerButton_OnDragStart)
Nenue@72 418 self:SetScript('OnDragStop', VeneerButton_OnDragStop)
Nenue@72 419 self:SetMovable(true)
Nenue@72 420 self:EnableMouse(true)
Nenue@71 421 self:RegisterForDrag('LeftButton')
Nenue@71 422
Nenue@71 423 self.bg:SetColorTexture(0,1,0,0.5)
Nenue@72 424 for i, region in ipairs(self.configLayers) do
Nenue@72 425 region:Show()
Nenue@72 426 end
Nenue@72 427 self:Show()
Nenue@71 428 else
Nenue@71 429
Nenue@71 430 self:SetScript('OnDragStart', self.StartMoving)
Nenue@71 431 self:SetScript('OnDragStop', self.StopMovingOrSizing)
Nenue@71 432 self:SetMovable(false)
Nenue@71 433 self:EnableMouse(false)
Nenue@71 434
Nenue@71 435 self.bg:SetColorTexture(0,1,0,0)
Nenue@72 436 for i, region in ipairs(self.configLayers) do
Nenue@72 437 region:Hide()
Nenue@72 438 end
Nenue@72 439 if self.isHidden then
Nenue@72 440 self:Hide()
Nenue@72 441 end
Nenue@72 442
Nenue@71 443 end
Nenue@71 444 end
Nenue@71 445
Nenue@71 446 local ToggleVeneerConfig = function()
Nenue@71 447 if configMode then
Nenue@71 448 configMode = false
Nenue@84 449 Veneer:print('Config mode off.')
Nenue@71 450 else
Nenue@71 451 configMode = true
Nenue@84 452 Veneer:print('Config mode on.')
Nenue@71 453 end
Nenue@71 454
Nenue@71 455 for frame, veneer in pairs(veneers) do
Nenue@71 456 VeneerButton_Update(veneer)
Nenue@71 457 end
Nenue@71 458 end
Nenue@71 459
Nenue@71 460 local VeneerButton_OnShow = function(self)
Nenue@71 461 VeneerButton_Update(self)
Nenue@71 462 end
Nenue@71 463
Nenue@88 464 -- Takes frame handle and assigns a block to it
Nenue@84 465 function VeneerCore:Acquire (frame, template)
Nenue@71 466 if not frame then
Nenue@71 467 print('|cFFFF4400Unable to acquire frame...|r')
Nenue@71 468 return
Nenue@71 469 end
Nenue@84 470 local veneer = self.Frames[frame]
Nenue@84 471 if not veneer then
Nenue@84 472 local name = type(frame) == 'table' and GetTableName(frame) or GetAnonymousName()
Nenue@84 473 veneer = CreateFrame('Frame', name, frame, template or 'VeneerTemplate')
Nenue@84 474 print('+veneer', name)
Nenue@71 475
Nenue@84 476 veneer:SetAllPoints(frame)
Nenue@84 477 veneer:SetParent(frame)
Nenue@84 478 veneer.label:SetText(name)
Nenue@84 479 veneer.bg:SetColorTexture(0,0,0,0)
Nenue@84 480 veneer:Hide()
Nenue@84 481 veneer:EnableMouse(false)
Nenue@84 482
Nenue@84 483 veneer:SetScript('OnShow', VeneerButton_OnShow)
Nenue@84 484
Nenue@84 485 -- find current X/Y
Nenue@84 486 veneer.currentLeft = frame:GetLeft()
Nenue@84 487 veneer.currentTop = frame:GetTop()
Nenue@84 488 self.Frames[frame] = veneer
Nenue@71 489 end
Nenue@71 490
Nenue@84 491 return veneer
Nenue@71 492 end
Nenue@0 493
Nenue@88 494 function VeneerHandlerMixin:Reanchor (anchorAll)
Nenue@88 495 if not anchorAll then
Nenue@88 496 Veneer:InternalReanchor(self)
Nenue@88 497 end
Nenue@80 498
Nenue@88 499 end
Nenue@80 500
Nenue@88 501 function VeneerAnimationMixin:OnPlay()
Nenue@88 502 PlaySoundKitID(229)
Nenue@88 503 print('|cFF00FF00Anim:OnPlay|r @', unpack(self.sourcePoint))
Nenue@88 504 end
Nenue@88 505 function VeneerAnimationMixin:OnStop()
Nenue@88 506 PlaySoundKitID(229)
Nenue@88 507 end
Nenue@88 508 function VeneerAnimationMixin:OnFinished()
Nenue@88 509 PlaySoundKitID(229)
Nenue@88 510 print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
Nenue@88 511 self:GetParent():ClearAllPoints()
Nenue@88 512 self:GetParent():SetPoint(unpack(self.destPoint))
Nenue@88 513 end