Page 1 of 1

Mac OS X Trackpad zooming gesture

Posted: 18 Sep 2010 22:40
by triplea
Hello Mac friends,

after I found out I could scroll the map without having to press the trackpad all the way down to simulate the right click (Advanced Settings > Interaction > Function of scrollwheel = Scroll map) but using just two fingers touch, another question came up: how to zoom the map in this mode? First, I used + and - on the keyboard, but today I felt being fed up with such an inconvinience and created the following patch:
trackpad_zooming.diff
(2.04 KiB) Downloaded 209 times
It allows users of recent MacBooks / MacBook Pros / Magic Trackpads to use the zooming two-finger gesture to zoom in/out the map in OpenTTD. Originally I made it for myself but may be somebody was looking for this feature as well.

Warning: this patch was tested to be applied to the 1.0.4 Tag, not the Trunk. But as far as affected files remain unchanged, it should be possible to do this on trunk as well.

Have fun!

Re: Mac OS X Trackpad zooming gesture

Posted: 18 Sep 2010 23:25
by Chris
Will this work for other (non-mac) multiple-touch/multiple gesture trackpads?

Re: Mac OS X Trackpad zooming gesture

Posted: 18 Sep 2010 23:44
by avdg
Can you port this patch to the trunk

Stable is not the place to be if you want new features
(except if you like it to give that job to the users doing them self)

Re: Mac OS X Trackpad zooming gesture

Posted: 19 Sep 2010 00:04
by avdg
Class 165 wrote:Will this work for other (non-mac) multiple-touch/multiple gesture trackpads?
No, not with this patch. This patch adds some code to mac specific files to get input data from the trackpath. However, if you could add some way to retrieve the actions from the trackpath on windows (which I am afraid thats the hardest part), it should be possible.

Edit: looks like windows 7 has a multitouch api, so it shouldn't be very hard to implement it ( http://code.msdn.microsoft.com/WindowsTouch and http://msdn.microsoft.com/en-us/library ... S.85).aspx)

Re: Mac OS X Trackpad zooming gesture

Posted: 19 Sep 2010 19:53
by triplea
avdg wrote:Can you port this patch to the trunk
Stable is not the place to be if you want new features
(except if you like it to give that job to the users doing them self)
You're right.
This one is for the trunk / r20829.
trackpad_zooming.diff
for trunk / r20829
(1.94 KiB) Downloaded 130 times
BTW, there are some other gestures that Mac trackpad can provide:

* Two fingers moving in opposite semicircles is a gesture meaning rotate.
* Three fingers brushing across the trackpad surface in a common direction is a swipe gesture.

Any ideas what would be they nice for? Rotate movement needs some finger exercise to master it, so eg. Firefox decided not to use it. But three-finger swipe is genial, Firefox uses it for back/forward (swipe left/right) and scroll to top/bottom (swipe up/down). I think community should decide or vote how to utilise these shortcuts. I see no clear decision like with zoom/pinch.

Re: Mac OS X Trackpad zooming gesture

Posted: 19 Sep 2010 20:33
by avdg
I have tested the patch and my first impression was that the scroll was fast.
I think the best solution would be to add an option called "set zoomspeed", which would be comparable with the "map scrollwheel speed".

I also noticed that the zoom does more then only zooming, it allow you also to scroll through the content of the small windows in openttd.

tested OS: osx 10.6.4

Re: Mac OS X Trackpad zooming gesture

Posted: 19 Sep 2010 21:17
by triplea
avdg wrote:I have tested the patch and my first impression was that the scroll was fast.
I think the best solution would be to add an option called "set zoomspeed", which would be comparable with the "map scrollwheel speed".
Or even an option to switch it off completely, because some wouldn't like that zooming triggers sometimes when the user is not so careful with two-finger scrolling.
avdg wrote:I also noticed that the zoom does more then only zooming, it allow you also to scroll through the content of the small windows in openttd.
Seen that as well. Minimap zooming works indeed.

Re: Mac OS X Trackpad zooming gesture

Posted: 19 Sep 2010 21:30
by avdg
avdg wrote:I also noticed that the zoom does more then only zooming, it allow you also to scroll through the content of the small windows in openttd.
Not only minimaps, but also everything with a scroll event like scrolling trough lists and hiding windows (by scrolling on the "shade window" button or the captionbar)

Re: Mac OS X Trackpad zooming gesture

Posted: 02 Oct 2010 09:29
by xmirakulix
Scrolling the map up/down and left/right works perfectly using the magic mouse when setting the "scrolling wheel" function to scroll map.

Is there a way to use the magic mouse as well as a gesture-input device in openttd? So that the zooming gesture can be performed on the magic mouse?