Neuron

Neuron

98.2k Downloads

Varous bugs and fixes for drag and drop issues

DejayRezme opened this issue ยท 2 comments

commented

Issue description:

There are various issues and strange things with drag and drop things. I've played around with the code and I think I fixed them all! Almost all changes are in ACTIONBUTTON_DragAndDrop.lua and ACTIONBUTTON.lua only minor changes. I should do this properly with github but for now I just attached those two files.

Technical info:

  • Addon Version: 1.4.3
  • Client: Retail
  • Client Patch Version: 9.0.2

The official blizzard actionbar behavior (no addons loaded or e.g. dominos) is either: You can pick up and drag an action without releasing left mouse button then drop on an actionbar.
Or pick up a spell and release left mouse button outside of actionbars, then drop with mouse down.
Releasing left mouse button or click left mouse button again anywhere but an actionbar does not "destroy" the cursor icon, you have to press down right mouse button to release it.
If an actionbar is locked you can still drag actions onto it and previous actions are picked up.

The above is what I think neuron should emulate. There are currently the following bugs:

  1. Drop from mount journal has the wrong spell name for paladin and chaueffered mounts (fixed)
  2. Dropping something into existing button does pick up previous button data but curor is not updated (fixed with GetMacroDragData and SetMouseCursor)
  3. Dropping items into locked actionbar should pickup old spell and allow daisy chaining (fixed with IsDragOk() and checking macroDrag)
  4. Dragging from a neuron actionbar shouldn't cancel with left click and doesn't cancel properly with right click by wiping macroDrag (fixed by listening to HIDEGRID and using a timeout to wipe or keep macroDrag data)
  5. Dragging from an empty button creates a ? cursorIcon (fixed)
  6. When ShowGrid is set to off, the grid should show and continue to show with every startDrag or pickup. But the behavior of is inconsistent. Even just picking up inside the spellbook and waiting 0-3 seconds wills stop showing the grid (not fixed, must be about some timed bar neuron update)

The main problem is that if you drag any action or picked up spellID on an existing neuron actionbutton, blizzard calls ACTIONBAR_HIDEGRID and sets the cursorType and spellID / item to nil. The only way to "rescue" the cursorType is by listening to OnMouseDown. So the crusorType should be saved in macroDrag until OnDragReceive or PostClick, and only macroDrag should be used to fill actionbuttons.

So the strategy to fix all this is to store the data from GetCursorInfo as early as possible when OnMouseDown, OnMouseUp, PostClick or OnReceiveDrag is called and only use that data. Also start a timeout by storing the current GetTime + 0.01. When ACTIONBAR_HIDEGRID is called we erase that data if we have timed out. This lets us release actions savely on right click while ignoring the ACTIONBAR_HIDEGRID spam during drag and drop

PickUpMacro is replaced GetMacroDragData and ClearDragData
GetMacroDragData creates a new table that contain the drag data and and also contains spellID or item for cursor.

OnMouseDown now checks the cursorType and saves it in macroDrag to be used later in OnReceiveDrag or PostClick

OnReceiveDrag and PostClick now check the cursor or if we have dragData matches.

SetMouseCuror now only uses the macroDrag table

commented

Issues #281, #355 and #356 should be fixed with my patch and could be closed after testing

Not fixed are issues #287 and #364. I don't know what's going on with the showgrid