Skip to content

Instantly share code, notes, and snippets.

@nefftd
Created August 15, 2014 21:02
Show Gist options
  • Save nefftd/0d83ce8796df469c4f8f to your computer and use it in GitHub Desktop.
Save nefftd/0d83ce8796df469c4f8f to your computer and use it in GitHub Desktop.
if not psize then return end
local scaler = CreateFrame('frame', nil, WorldFrame, 'SecureHandlerStateTemplate')
scaler:SetAllPoints()
scaler:Execute('Children = newtable()')
scaler:SetFrameRef('PlayerFrame', PlayerFrame)
scaler:SetAttribute('_onstate-mousestate', ([[ -- Resizes clickable area of all nameplates on mouseover
if newstate == 'on' then
local prevNum = #Children
wipe(Children)
local PlayerFrame = self:GetFrameRef('PlayerFrame')
self:GetParent():GetChildList(Children)
local n = 0
for i, f in pairs(Children) do
if strmatch(f:GetName() or '', '^NamePlate%d+$') then
--f:SetScale(0.6)
f:SetWidth(%d) f:SetHeight(%d)
n = n + 1
end
end
print('Found '..#Children..' nameplates. SETSIZE on '..n..' of them.')
end
]]):format(unpack(psize)))
RegisterStateDriver(scaler, 'mousestate', '[@mouseover,exists] on; off;')
local Delayed = true
local function DelayedCameraFix(self) -- Moves the camera after one frame
Delayed = not Delayed
if Delayed then
self:SetScript('OnUpdate', nil)
FlipCameraYaw(-0.005)
end
end
scaler:HookScript('OnAttributeChanged', function(self, attribute, state)
FlipCameraYaw(0.005) -- Forces nameplates to reposition by nudging the camera, otherwise scaling can be off
self:SetScript('OnUpdate', DelayedCameraFix)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment