Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-28-16, 01:48 PM   #1
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 123
Minimap button highlight dragging

When I drag the minimap button along the edge, it remains the halo of highlight as you can see in the picture

This is the code:

XML code (I used nopaste service to avoid wall text)

https://nopaste.me/view/2875c949

Lua code

Lua Code:
  1. function MyMod:onMinimapButtonClick(button)
  2.     if (button == "LeftButton") then
  3.         print("foo")
  4.     end
  5.     if (button == "RightButton") then
  6.         print("bar")
  7.     end
  8. end
  9.  
  10. MyMod.mmdp = 45 -- MyMod minimap button default position
  11.  
  12. function MyMod_MinimapButton_Reposition()
  13.     MyMod_MinimapButton:SetPoint("TOPLEFT","Minimap","TOPLEFT",52-(80*cos(MyMod.mmdp)),(80*sin(MyMod.mmdp))-52)
  14. end
  15.  
  16. function MyMod:onMinimapButtonUpdate()
  17.  
  18.     local xpos,ypos = GetCursorPosition()
  19.     local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom()
  20.  
  21.     xpos = xmin-xpos/UIParent:GetScale()+70 -- get coordinates as differences from the center of the minimap
  22.     ypos = ypos/UIParent:GetScale()-ymin-70
  23.  
  24.     MyMod.mmdp = math.deg(math.atan2(ypos,xpos)) -- save the degrees we are relative to the minimap center
  25.     MyMod_MinimapButton_Reposition() -- move the button
  26. end

Can you help me?
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Minimap button highlight dragging


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off