WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Nameplates Target Mouse DOWN (https://www.wowinterface.com/forums/showthread.php?t=55235)

Taudier 03-14-17 08:40 AM

Nameplates Target Mouse DOWN
 
Hello, is there a way to target a unit by mouse down on nameplates ? currently it responds to mouse up event.

SDPhantom 03-14-17 02:22 PM

Short answer, no.

The nameplates themselves don't actually handle the click events. They're passed through to WorldFrame that does everything in C code. I don't even think a SecureUnitFrameTemplate can be set up to distinguish OnMouseUp and OnMouseDown events since they run their secure code from OnClick.

Taudier 03-14-17 05:51 PM

I put a button over the nameplates to target the mouseover, but it makes them to not respond to the mouseover anymore.

It seems not possible to retrieve the GetText() of the name with the SecureHandlerStateTemplate in a secure way.

nameplateX are not supported by the SecureActionButtonTemplate, and anyway it seems not possible to retrieve them in a secure way.

Overall, i guess it's a dead end.

MunkDev 03-14-17 06:47 PM

Haven't tried it, but maybe this works:
Lua Code:
  1. local button = CreateFrame("Button", "MouseoverButton", nil, "SecureHandlerStateTemplate, SecureActionButtonTemplate")
  2.  
  3. button:SetAttribute("type", "target")
  4. button:SetAttribute("unit", "mouseover")
  5. button:RegisterForClicks("AnyDown")
  6.  
  7. RegisterStateDriver(button, "mouseover", "[@mouseover,exists]true;nil")
  8.  
  9. button:SetAttribute("_onstate-mouseover", [[
  10.     if newstate then
  11.         self:SetBindingClick(true, "BUTTON1", self)
  12.     else
  13.         self:ClearBindings()
  14.     end
  15. ]])

Taudier 03-15-17 03:53 AM

The problem is that the area of mouseover is much bigger than the nameplates area.

It is possible to SetBindingClick "OnEnter" a nameplate area, but one frame must be hidden to retrieve the mouseover, which makes it unavailidable for a "OnLeave" event in order to reactivate it. Maybe by creating a frame box arround the nameplates...

thanks for your help


All times are GMT -6. The time now is 08:44 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI