Quantcast
Minimap button highlight dragging - WoWInterface
Thread Tools Display Modes
06-28-16, 01:48 PM   #1
Benalish
A Theradrim Guardian
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 60
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
06-28-16, 02:59 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,259
Generally doing SetPoint without doing a ClearAllPoints first creates a second point for a frame ie. streching it from the original point to the new second (third...) point. ClearAllPoints "unlocks" the frame to locate it in a new position altogether.

The only time this doesn't apply is just after the frame is first created as it has no point set at that time.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 06-28-16 at 03:02 PM.
  Reply With Quote
06-30-16, 05:46 AM   #3
Benalish
A Theradrim Guardian
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 60
Very well. You can mark this thread as solved

Last edited by Benalish : 07-01-16 at 05:04 AM.
  Reply With Quote

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

Thread Tools
Display Modes

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