Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Preventing Unwanted Drag Events #4261

Open
wzdev-ci opened this issue Dec 18, 2014 · 15 comments
Open

Preventing Unwanted Drag Events #4261

wzdev-ci opened this issue Dec 18, 2014 · 15 comments

Comments

@wzdev-ci
Copy link
Contributor

type_patch (an actual patch, not a request for one) | by wuz21m


Hi, this is my first patch! (Thanks for all the efforts!)

Warzone 2100 has this annoying behavior that even the smallest drag counts as a selection events.

It has happened to me multiple times that when I am clicking furiously to get the units to move, it acts as selection and unselects my units (I wonder how many units I lost to that).

But worry not!

I have written this small patch against display.cpp. When a drag event is to be registered, it uses a simple Manhattan distance. If it is less than a hardcoded value (10 at the moment), it will not register as selection.

Based on my testing, it is taking away many issues!


Issue migrated from trac:4261 at 2022-04-16 11:47:44 -0700

@wzdev-ci
Copy link
Contributor Author

NoQ commented


Yay welcome.

At a glance, (1) nowadays we try to avoid custom integer types like UDWORD and use just int whenever possible, (2) now mouseX() and mouseY() are getting evaluated twice (harmless, i guess).

Also, i don't remember such problems with my mice. Are you setting some high sensitivity?

I can still try to see how it feels.

@wzdev-ci
Copy link
Contributor Author

wuz21m commented


Thanks for your comments.
I applied your suggestions.

It seems that a weird bug has slipped under my testing.
If you drag from the upper left and lower right it works, but if you drag from the upper right and lower left it doesn't work.

Give me a bit of time to track this down. I'll update the patch then.

Sorry!

@wzdev-ci
Copy link
Contributor Author

wuz21m uploaded file fix_click_slippage.patch (1.5 KiB)

@wzdev-ci
Copy link
Contributor Author

wuz21m commented


OK I fixed the issue, it had to do with type conversions.
UDWORD is uint32_t and it doesn't like subtractions that are negative, every unsigned thing had to be type-casted to int.

I also increased the delta to 50 pixels, it worked pretty well for the tests I made at 1280x720. It is gonna need more tweaking for extra solutions and trade-off between accurate selection and unwanted drag recognition.

Basically, if you rapidly click to move (e.g. when panicking and running away from artillery), it repeatedly takes the mixture of quick clicking and minor mouse movement for drag. E.g. a 5x10 pixel drag recognized at some point where you actually wanted to click to get the unit to move.

@wzdev-ci
Copy link
Contributor Author

wuz21m commented


Any updates on this patch?

Did anyone test it?

@wzdev-ci
Copy link
Contributor Author

vexed changed blocking which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

vexed changed blockedby which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

vexed changed _comment0 which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

vexed commented


Sorry, been busy with getting the 3.1.2 release ready.

What resolution do you play at ?
(What I mean is, this must work for 640x480 users as well, since that is a supported resolution)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jan 3, 2015

wuz21m commented


I developed and tried it on 1280x720.

I am gathering some usage stats of my own play so I could give good data. I will post them ASAP.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jan 3, 2015

stiv commented


We may need different settings based on monitor resolution. A little data could help figure that out. A smart person could add that to the WZ config file.

At the very least, this should work across 640 - 1400 (x resolution). Huge monitor support would be a bonus.

@wzdev-ci
Copy link
Contributor Author

Per commented


We really should reconsider the minimum resolution. Even cheap phones nowadays support 720p (1024x720) at a minimum.

@wzdev-ci
Copy link
Contributor Author

Per commented


So what we need to commmit this patch is a calculated version of the constant '50' that varies depending on the resolution, right? Anyone want to playtest to find a useful scale?

@wzdev-ci
Copy link
Contributor Author

vexed commented


Isn't this kind of change player specific ?
I don't really have any issues with the current way it is done, thus, I think if this is incorporated, it should be a option to toggle it on/off.

@wzdev-ci
Copy link
Contributor Author

Cyp commented


Does this do something different than changing DRAG_THRESHOLD to 50? Maybe DRAG_THRESHOLD could be made configurable instead?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant