OpenTTD

Tasklist

FS#3406 - Move mouse cursor while scrolling option

Attached to Project: OpenTTD
Opened by gogglesguy (gogglesguy) - Tuesday, 22 December 2009, 19:03 GMT
Last edited by andythenorth (andythenorth) - Wednesday, 16 August 2017, 11:21 GMT
Type Patch
Category Interface
Status Closed
Assigned To andythenorth (andythenorth)
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The right-button mouse scrolling (panning) feels somewhat unnatural to me. For me to make it more natural I already turn on the "Reverse Scroll Direction" which already really helps alot. But in addition I would like to see an option that makes the mouse cursor move while you scroll.

Right now when you do a right click scroll, the mouse cursor will stay in a fixed position on screen, while the rest of the scene moves as you move the mouse. I like to make the mouse cursor move as well. The intended effect is that the mouse cursor keep pointing at same the location in the scene.
This task depends upon

Closed by  andythenorth (andythenorth)
Wednesday, 16 August 2017, 11:21 GMT
Reason for closing:  Won't implement
Additional comments about closing:  Flyspray clean up: more than 5 years old, and not obvious what should be done with this next, so closing. If this offends, discuss with andythenorth in irc. Thanks.
Comment by Simon Williams (systemparadox) - Tuesday, 12 January 2010, 17:43 GMT
I wouldn't want this behaviour to replace the existing way of doing things. I can't see it working when you scroll long distances (which I often do).

I don't know why you've got reverse scrolling on, but each to his own. Think of it as moving the camera and it'll make more sense I think.
Comment by John Beech (Markavian) - Friday, 26 November 2010, 10:40 GMT
The way I usually use mouse pan/scroll is I see something just off screen, I drag it closer to me, then I click on it --- which means I expect the thing I want to be directly under my cursor.

I searched to find this after encountering the same issue trying to play the game. Locking the mouse cursor means I have to lift up and reposition my mouse on my mousepad, which I haven't had to do since I was 6 years old. This is a really terrible user interface issue.

People on IRC tell me:
Edit:
src/window.cpp
_cursor.fix_at = true

to fix it. Would be nice if there was an option in the interface options panel.

BRB downloading libraries and compilers.
Comment by Simon Williams (systemparadox) - Saturday, 27 November 2010, 13:19 GMT
It's getting a little confusing to work out what everyone wants. When talking about locking the cursor, please state what it is locked to (it is always locked to something, you can't have an unlocked cursor).

Current behaviour:
Mouse cursor stays fixed to the camera(/screen). Camera moves in the direction of the mouse (scene moves in the opposite direction). With reverse scroll direction on, the scene moves in the direction of the mouse.

Maybe we should make this more obvious in the option, i.e. change it to "Mouse scrolls: [scene|camera]" or something.

gogglesguy wants:
Reversed scroll direction, with the mouse cursor fixed to the scene. So what we want is to add an option like "Lock scrolling cursor to: [scene|camera]".

John Beech wants:
The same as gogglesguy I think. I'm not sure what you mean about having the thing you want directly under the cursor- I thought it was off-screen?
Comment by gogglesguy (gogglesguy) - Saturday, 27 November 2010, 16:45 GMT
I think John and I want the same thing. I guess the idea can be best described as clicking the mouse somewhere in the scene and then pulling it towards the location you want to have it (usually the center of the screen). Like moving a table cloth with your finger, you move the whole scene with the mouse cursor. Both finger and mouse cursor move in this case. Hence the cursor will keep pointing to the same location in the scene (as opposed to the same screen location).

To illustrate, you click on a tile in the upper right corner of the screen, and then drag your mouse to the lower left corner of the screen. Both the tile you clicked on and the mouse cursor will now be in the lower left corner of the screen.

When John talks about locking the cursor, he means the cursor will stay on a fixed position on screen while the camera/scene is scrolling.

Hope this makes it more clearer.
Comment by Simon Williams (systemparadox) - Saturday, 27 November 2010, 17:09 GMT
That makes sense. So the 2 options I described should make everyone happy. Unfortunately I don't have time to implement it at the moment.
Comment by Simon Williams (systemparadox) - Monday, 06 December 2010, 21:58 GMT
Ok this should fix it. I did originally add an option for "Scroll with mouse unlocked", but after testing the available combinations between that and "reverse scroll direction" I decided there was no point.

I cannot see anyone wanting the mouse unlocked when scrolling is not reversed, since the cursor is moving in the opposite direction to the scene. Likewise, I can now see why this bug report came about. Reversed scrolling with a locked cursor (the existing behaviour) doesn't make sense either.

So the attached patch makes the cursor unlocked when using reversed scrolling, but keeps it locked when using the regular scrolling direction.

EDIT: Simplified patch slightly. Annoyingly, flyspray won't let me overwrite or delete the old one, but it will let me upload 2 with the same name :S
Comment by gogglesguy (gogglesguy) - Monday, 06 December 2010, 22:19 GMT
I just tried your (first) patch and it works really well. Thanks.
Comment by John Beech (Markavian) - Tuesday, 07 December 2010, 12:58 GMT
Looks great simon, just compiling to the second patch to test now.

Works as intended, thanks.
Comment by Remko Bijker (Rubidium) - Tuesday, 07 December 2010, 14:04 GMT
What's the point of this patch when it simply duplicates the left-click scrolling behaviour? The current (without patch) behaviour was requested a long time ago. Changing its behaviour doesn't seem the right thing to do, especially when left-click scrolling does exactly the same.
Comment by Simon Williams (systemparadox) - Tuesday, 07 December 2010, 14:57 GMT
Left-click scrolling is horrible and should only be used by people who don't have enough buttons on their mouse (or a touchscreen).

This patch makes reversed-direction right-click scrolling work correctly, without breaking normal right-click scrolling. I suspect the behaviour request you refer to was in relation to the normal scrolling direction, which this patch does not change. Got a task number for that request?
Comment by Simon Williams (systemparadox) - Tuesday, 07 December 2010, 15:03 GMT
See also: task 3285.
Comment by Remko Bijker (Rubidium) - Tuesday, 07 December 2010, 15:27 GMT
It's sadly enough from the era before this tracker existed (r3222). Given it wasn't requested on the forum it must have been requested via IRC, of which I don't have a log from back then.
Comment by Remko Bijker (Rubidium) - Tuesday, 07 December 2010, 15:52 GMT
In any case, in my opinion, this patch does destroy the current behaviour of that setting. With that patch I can't scroll the whole map without having to let go of the mouse button, but without patch I can. In other words, you're effectively removing a useful feature for quickly scrolling the map by limiting the amount of map scroll to the window you can actually see. Even then, you need to release the mouse go to the other side of the window click and drag to continue.

So maybe this change "fixes" OpenTTD to behave like you want it to behave, but it removes the scroll-all-map-without-releasing-the-mouse-button feature. As such it is by no way a simple fix as it's basically (drastically) changing the behaviour of something without a way back.
Comment by Simon Williams (systemparadox) - Tuesday, 07 December 2010, 16:04 GMT
Scrolling the map without releasing the button is something I do a lot too. But I'm not using reversed scrolling. With reversed scrolling, locking the cursor to the screen simply doesn't make sense.

I can put in another option if you'd prefer, that is what I was originally going to do. But if you try it I'm sure you'll see what I mean: locked reversed scrolling makes no sense, and unlocked normal scrolling makes even less sense.
Comment by Simon Williams (systemparadox) - Wednesday, 15 December 2010, 14:54 GMT
Alternative patch which adds the option "Lock cursor while scrolling" (defaults to true, the current behaviour).
Comment by Denis Pesotsky (ObeyKun) - Thursday, 13 June 2013, 02:58 GMT
> I wouldn't want this behaviour to replace the existing way of doing things. I can't see it working when you scroll long distances (which I often do).

That's easy. All is needed for smart hand scrolling is wrapping cursor to opposite bound when it reaches any screen bound. Of course it needs some margin (I use 5px in one of my projects). Something like that: http://paste.kde.org/772040/.

As example you can look at Okular documents viewer or at my project: http://www.qfrost.net/download/0.17.7/qfrost-release-win32.zip, just press Ok in first window and then use right click and drag in main area.

Maybe it will work better with check like this: http://paste.kde.org/772046/

Loading...