Page 1 of 2

Patch: Left click scrolling

Posted: 27 Jan 2008 19:17
by illogict
Hello!

As part as my porting effort of OpenTTD to Maemo devices, here is a patch to enable left-click scrolling. Thanks to it, scrolling is now a breeze on touch-screen devices, and is also made easier to laptop users using a touchpad (and not to forget also Mac users).
To use it, you only need to press the left-mouse button anywhere on the map that does not have something that will popup information, and move the mouse. Release the button when you are done.
Patch has been made against latest SVN (r11993).

Comments are of course welcomed, and please don't be too harsh for my first post on this forum and my first patch :D

Re: Patch: Left click scrolling

Posted: 27 Jan 2008 19:48
by Bilbo
This may be good for those touch screens and perhaps not only for touch screens, other people may perhaps like it too.

But I think you should add some way to turn this feature on and off in the settings. Some people may not like that the scrolling could interfere with their ordinary left mouse button usage ...

Re: Patch: Left click scrolling

Posted: 28 Jan 2008 12:28
by Zephyris
Excellent, now I can use my wacom to play! I have vista, so I can't use buildottd to test it, so a couple of questions:
Does the mouse cursor move when you drag the map - ie. is it a "grab and pull" feeling?
Does it/could it use additional cursors to show mouse function? A hand and a closed hand would make it more intuative...

And I would say it definitely needs a switch...

Re: Patch: Left click scrolling

Posted: 28 Jan 2008 12:46
by bokkie
Binaries, specially for Zephyris for his hard work on the graphic replacement set ;) :

Re: Patch: Left click scrolling

Posted: 28 Jan 2008 13:14
by elf_sander
Maybe this would be a nice patch for the DS port that is beïng developped.

Re: Patch: Left click scrolling

Posted: 29 Jan 2008 08:34
by Zuu
Very nice!

I'm a wacom-user too.. I actually made a similar patch myself where I used middle mouse button instead. To do so I had to make changes in the SDL-driver as OpenTTD is not generally aware of middle clicks. My intention was never to make it to trunk unless there where a demand and with no replies to my thread I did not made any effort to make it accepted in trunk.

Please consider to both use X and Y axis as for some devices X is easier to use and for some other Y might be easier to use.


Edit:
Zephyris wrote:Does the mouse cursor move when you drag the map - ie. is it a "grab and pull" feeling?
For absolute devices such as wacom (in absolute mode) you can not possible not move the cursor if the pen is moved. Yes you can call an API function in SDL or DirectX to swap the cursor to another position on the screen, but immediately it will be moved back since the input device use absolute addressing. What you can do is to hide the mouse cursor. But for relative input devices such as the touch area on a laptop you could force the pointer to stay on the same position though.
Zephyris wrote:Does it/could it use additional cursors to show mouse function? A hand and a closed hand would make it more intuative...
Um, are we thinking about the same kind of scrolling as in what would happen if you used the scroll wheel on a input device that has that. Because for scrolling in the sense of zooming the map I think the hand sends the wrong signals. A hand more tells the user that it will grab the map and move it, not zoom. At least in my world, but our views might differ.

Re: Patch: Left click scrolling

Posted: 29 Jan 2008 13:41
by illogict
Here, by scrolling, I really meant scrolling, not zooming, like the right click-scrolling implemented in OpenTTD.
I'm currently making an updated version of the patch, that will take into account all comments, and also work betting with touchscreens.
Thank you for all your comments!

Re: Patch: Left click scrolling

Posted: 29 Jan 2008 15:27
by FooBar
I just tried the patch, and I like it :D

I don't think a 'grab and pull' feature is useful: you'd grab the map in one edge, move the mouse to the other edge. Right then your cursor ended up at the opposite edge, so you'd have to move it back to the original edge and repeat.
This wouldn't be too much of a problem for touch-screen devices, but would render the function useless for a laptop's touchpad.

Re: Patch: Left click scrolling

Posted: 29 Jan 2008 21:31
by Bjarni
Bilbo wrote:But I think you should add some way to turn this feature on and off in the settings. Some people may not like that the scrolling could interfere with their ordinary left mouse button usage ...
This is a must. I would hate to get "random" scrolls. Unlike popular believes a fair amount of macs has multibutton mice. The exception are MacBooks/PowerBooks but they can use two finger scrolling instead.
As for the feature itself I can imagine that it can be rather good for certain devices. A Maemo port sounds nice. Maybe you will even be so nice (to yourself and other Maemo users) not to run away when the port is half working like the last porter :?

Re: Patch: Left click scrolling

Posted: 29 Jan 2008 22:40
by Zephyris
It needs to be a grab and pull method, otherwise it is very hard to use with wacom tablets etc... Have you actually tried it with one of these devices?

This is because when the of the way the map movement is determined from mouse position. It currently uses the "first person shooter method" - the mouse is moved, the relative movement logged, and the mouse cursor reset to its original location. This does not work for absolute positioning devices such as touch screens and wacom tablets. The symptom of this is the scrolling is almost uncontrollable, and you have to put the pointing device precisely back to where it started to stop map movement.

Devices your patch will work with (relative mouse movement):
Mouse
Laptop touchpad
Tracking ball

Devices it won't (absolute mouse positioning):
Wacom
Touch screen

*edit* I have tried it out more and it seems this is not quite the symptoms seen, it is just lurchy and really oversensitive!

Re: Patch: Left click scrolling

Posted: 30 Jan 2008 18:00
by Zuu
Zephyris wrote:*edit* I have tried it out more and it seems this is not quite the symptoms seen, it is just lurchy and really oversensitive!
I also tested it and for me it is just as sensitive as when I am paning the map with the "right mouse button" on my pen. Personally I like how sensitive it is and how it work more like a joystick. But the new left-button paning do slow down and eventually comes to a stop. The slow down is as you mentioned far from smooth. When right-button-paning I would keep my pen tip within a one centimeter from the orgin when moving fast and even closer when moving slow. (I have an A5 Itous second generation.)

But for a touch screen the sensitiveness of the paning is probably way to high since touch-screen sensitiveness is rather low probably because fingers are much bigger than pens.


Personally I really hope that noone will "fix" the sensitiveness since after getting used to it it is very nice. :)

Re: Patch: Left click scrolling

Posted: 30 Jan 2008 18:15
by illogict
Here is an updated version. It is now a drag and pull like: scroll direction will thus be the same whether you select "reverse scroll direction" option or not.
As it is not the same scroll as the others, I'm searching for another term, maybe some have ideas? :D
It also has its own option to be enabled.
It has been tested on my n810, the full port will follow.

Patch is against r12019.
Please apply the patch for the multiple mouse events treatment issue (http://www.tt-forums.net/viewtopic.php?f=33&t=36029) before this one, in order to avoid some issue with touch-screens for instance, and please comment :)

Re: Patch: Left click scrolling

Posted: 30 Jan 2008 18:44
by Zephyris
Thank you for adding that feature, sorry if I sounded arsey earlier, it was a long day! It may be worth submitting both these patches letting people chose their personal preference.

Re: Patch: Left click scrolling

Posted: 30 Jan 2008 19:16
by illogict
No problem at all :)
Anyway, my primary will is to make something fully usable with touchscreens, and I didn't have time to fully test the first patch with the n810 before posting it here.
Now that I think about it, the next step should be to have a fully unified patch, with the option to choose how we want it to act.

Re: Patch: Left click scrolling

Posted: 30 Jan 2008 19:52
by FooBar
Very nice second version! Works charmingly just with a regular mouse!

I'd love to see both options integraded, so that the user can choose between no left button scrolling and either of you two versions of the patch.

Re: Patch: Left click scrolling

Posted: 31 Jan 2008 10:31
by illogict
Please find attached an updated version, that now has selectable way of working, either standard (works exactly like right-click scrolling), or Drag'n'Pull.
This has been made agains r12026 + latest version of my multiple mouse events treatment patch, that you should apply before this one.
Please comment.

Re: Patch: Left click scrolling

Posted: 31 Jan 2008 19:48
by FooBar
illogict wrote:... that you should apply before this one...
I can't apply two patches with BuildOTTD :(

So I hope this thing gets in trunk real soon :D

Re: Patch: Left click scrolling

Posted: 31 Jan 2008 20:29
by DaleStan
Just concatenate them into a single file.

Re: Patch: Left click scrolling

Posted: 31 Jan 2008 20:32
by Bilbo
FooBar wrote:
illogict wrote:... that you should apply before this one...
I can't apply two patches with BuildOTTD :(

So I hope this thing gets in trunk real soon :D
Well, you can :)

copy /b first.patch + second.patch merged.patch
then apply merged.patch ... of course the patches must not have any conflicts :)

Alternatively, you can use simply mingw + svn directly :)

Re: Patch: Left click scrolling

Posted: 02 Feb 2008 22:40
by Zuu
illogict wrote:Please find attached an updated version, that now has selectable way of working, either standard (works exactly like right-click scrolling), or Drag'n'Pull.
This has been made agains r12026 + latest version of my multiple mouse events treatment patch, that you should apply before this one.
Please comment.
I built r12026 with
* twice_treated_mouse_events-updated.patch (currently last version)
* openttd-left_scrolling-updated_2.patch (currently last version)

(using Wacom) With "standard" mode I noticed that left-button-scroll setting set to standard the map movement it behaves the same as right-button movement, which is nice.

(using trackball) Works fine aswell i think. (don't use it much when I'm playing unless I'm on my laptop which lacks an ancient COM-port)


Naming
First I'm not native speaker of English so my understanding of the word "scrolling" might be slightly wrong. Also note that in the patch-screen there is already an option for "Function of scrollwheel".

Personally I'd rather not name translating the map "scrolling" as to me the word "scrolling" is bound to something that is done in one dimension. Such as scrolling with a scroll-wheel or the counterpart on laptops. I don't know about native English speakers but here "scroll" is commonly used as an abbreviation for scroll-wheel. Therefor I find it a bad choice to call this feature "left click scrolling".

Better ideas?
Perhaps "left click map movement"?