CapsAdmin / pac3

advanced avatar customization for garrysmod
GNU General Public License v3.0
205 stars 94 forks source link

[develop branch] Radial menu sometimes incorrectly sets mouse position #1342

Open OctothorpeObelus opened 8 months ago

OctothorpeObelus commented 8 months ago

Seemingly at random, opening the radial events menu will set the mouse position to the right side of the wheel rather than in the center. Latest commit in use. To reproduce, use the develop branch and simply use the event wheel a few times. It does not appear to be consistent but it does happen often.

image

pingu7867 commented 8 months ago

Where's your cursor in the screenshot? I don't see it.

Our eventwheel code doesn't set cursor pos. Normally, gmod constantly sets it to the center when in first person (or well, just by default... thirdperson addons don't tend to enable gui.EnableScreenClicker). But you have stuff like the C context menu that saves its own cursor position.

The problem is the gui.EnableScreenClicker mode doesn't know which menu element, game mode or hacky GUI render hook you're supposed to be on or which one you want to use. Switching has to be done manually and we have to hope there's no conflicting codes that fight over control of it because each mode change forces its gui.EnableScreenClicker state over the whole game.

The way the original eventwheel works doesn't focus on how far the mouse is relative to the center, but rather it does angle checks. But if your cursor is smack dab at the center, it defaults to a rightward angle. When gui.EnableScreenClicker is turned off in the middle of when it's shown, the cursor reverts to gmod's default behavior, it gets placed at the center and the event wheel thinks it's "right" (and it's at the center even if you don't see it).

TL;DR you have something else running gui.EnableScreenClicker(false) before you closed the eventwheel. That might be the eventlist (the static grid variation of the eventwheel) or another addon.