[haiku-development] ShowImage patch
- From: Christian Packmann <Christian.Packmann@xxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Fri, 27 Feb 2009 10:53:40 +0100
/trunk/src/apps/showimage/ Patches ShowImageView.cpp, mousewheel scroll behavior: - when <Shift> is held during scroll, scrolls x-axis - when <Ctrl> or <Command> held during scroll, zooms in/outI think these are small but useful changes, which provide higher usability - much better than having to use the scrollbar for horiz. scrolls or use menus/shortcuts for zoom control. While this behavior is not exactly intuitive, it doesn't change the default behavior, so it won't hurt anyone... I hope. :)
Christian
Index: ShowImageView.cpp
===================================================================
--- ShowImageView.cpp (revision 29181)
+++ ShowImageView.cpp (working copy)
@@ -1707,16 +1707,33 @@
// |dy| is the number of notches scrolled up or down.
// When the wheel is scrolled down (towards the user) dy > 0
// When the wheel is scrolled up (away from the user) dy < 0
+
+ // Modifier keys influence the behavior of scrolling:
+ // Shift transforms y-scroll to the x-axis
+ // Control or Command zoom in/out
const float kscrollBy = 40;
float dy, dx;
float x, y;
x = 0; y = 0;
+ uint32 mod = modifiers();
+
if (msg->FindFloat("be:wheel_delta_x", &dx) == B_OK)
x = dx * kscrollBy;
- if (msg->FindFloat("be:wheel_delta_y", &dy) == B_OK)
- y = dy * kscrollBy;
-
- ScrollRestrictedBy(x, y);
+ if (msg->FindFloat("be:wheel_delta_y", &dy) == B_OK) {
+ if ( mod & B_SHIFT_KEY ) {
+ x = dy * kscrollBy;
+ }
+ else if ( mod & B_COMMAND_KEY || mod & B_CONTROL_KEY ) {
+ if ( dy <= 0.0 )
+ ZoomIn();
+ else
+ ZoomOut();
+ }
+ else
+ y = dy * kscrollBy;
+ }
+
+ ScrollRestrictedBy(x, y);
}
- Follow-Ups:
- [haiku-development] Re: ShowImage patch
- From: Gabriele Biffi
- [haiku-development] Re: ShowImage patch
Other related posts:
- » [haiku-development] ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Gabriele Biffi
- » [haiku-development] Re: ShowImage patch - Gabriele Biffi
- » [haiku-development] Re: ShowImage patch - Humdinger
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - William A. Lawson
- » [haiku-development] Re: ShowImage patch - Matt
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Gabriele Biffi
- » [haiku-development] Re: ShowImage patch - Humdinger
- » [haiku-development] Re: ShowImage patch - Jonas Sundström
- » [haiku-development] Re: ShowImage patch - Humdinger
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Jonas Sundström
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Jonas Sundström
- » [haiku-development] Re: ShowImage patch - Urias McCullough
- » [haiku-development] Re: ShowImage patch - Jonas Sundström
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Truls Becken
- » [haiku-development] Re: ShowImage patch - Humdinger
- » [haiku-development] Re: ShowImage patch - Humdinger
- » [haiku-development] Re: ShowImage patch - Stephan Assmus
- » [haiku-development] Re: ShowImage patch - Jonas Sundström
- » [haiku-development] Re: ShowImage patch - Ingo Weinhold
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Ingo Weinhold
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Ryan Leavengood
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Jonas Sundström
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - François Revol
- » [haiku-development] Re: ShowImage patch - Jorge G. Mare
- » [haiku-development] Re: ShowImage patch - Humdinger
- » [haiku-development] Re: ShowImage patch - Humdinger
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - François Revol
- » [haiku-development] Re: ShowImage patch - François Revol
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - PulkoMandy
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - PulkoMandy
- » [haiku-development] Re: ShowImage patch - Rene Gollent
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Axel Dörfler
- » [haiku-development] Re: ShowImage patch - Stephan Assmus
- » [haiku-development] Re: ShowImage patch - François Revol
- » [haiku-development] Re: ShowImage patch - Humdinger
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Christian Packmann
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Stephan Aßmus
- » [haiku-development] Re: ShowImage patch - Axel Dörfler