Tischel / TPie

FFXIV Dalamud plugin for ring-shaped hotbars
GNU Affero General Public License v3.0
34 stars 16 forks source link

Bug with "keep previous ring center" #23

Closed chimera74 closed 2 years ago

chimera74 commented 2 years ago

Since the last plugin update my nested rings appear at the edge of the screen. tpie If it is not a common bug then it has something to do with my setup - Dual display, game on the secondary one, on the right, borderless window. Old behavior without "keep previous ring center" is still ok.

Zenith-One commented 2 years ago

I'm having the same issue.

Looking at the code, it seems the most likely culprit is this bit.

I think the problem is that the code takes the coordinates of the center of the circle in the context of the FF window and then moves the mouse to those coordinates. However I think SetCursorPos uses system display as its baseline, not the FF window. In order to achieve the correct behavior using that method, I think you would need to somehow figure out where the FF window lives and then do some math.

Alternately if it is possible to check where the mouse position is in the FF window, you could find the difference between the mouse position in the FF window and the desired position to move it to within the FF window. Then, figure out the global mouse x/y, and apply the same difference to it.

For example, if the center of the pie should be at (50,50) in the FF window, but the mouse is at (30,60), the desired change would be (20,-10). Then, you find the global mouse x,y is say (1020, 986). So you set the mouse cursor position to (1040, 976)

You could also use something like this method in order to avoid all the math: ClientToScreen

Tischel commented 2 years ago

It is as you say. I'll take a look at it eventually, for now disable the option 🙏 .

Zenith-One commented 2 years ago

This is officially my first c# commit ever. Hopefully it's useful to you :)