Author: leavengood Date: 2011-06-25 06:24:54 +0200 (Sat, 25 Jun 2011) New Revision: 42311 Changeset: https://dev.haiku-os.org/changeset/42311 Ticket: https://dev.haiku-os.org/ticket/7253 Modified: haiku/trunk/src/apps/showimage/ShowImageView.cpp haiku/trunk/src/apps/showimage/ShowImageView.h Log: Make the zoom "sticky" at 1.0 for about half a second when zooming with the mousewheel. It might be a bit annoying, not sure yet. Implements #7253. Modified: haiku/trunk/src/apps/showimage/ShowImageView.cpp =================================================================== --- haiku/trunk/src/apps/showimage/ShowImageView.cpp 2011-06-25 03:24:25 UTC (rev 42310) +++ haiku/trunk/src/apps/showimage/ShowImageView.cpp 2011-06-25 04:24:54 UTC (rev 42311) @@ -71,6 +71,7 @@ // the delay time for hiding the cursor in 1/10 seconds (the pulse rate) #define HIDE_CURSOR_DELAY_TIME 20 +#define STICKY_ZOOM_DELAY_TIME 5 #define SHOW_IMAGE_ORIENTATION_ATTRIBUTE "ShowImage:orientation" @@ -196,6 +197,7 @@ fShowCaption(false), fShowingPopUpMenu(false), fHideCursorCountDown(HIDE_CURSOR_DELAY_TIME), + fStickyZoomCountDown(0), fIsActiveWin(true), fDefaultCursor(NULL), fGrabCursor(NULL) @@ -253,6 +255,10 @@ } else fHideCursorCountDown--; } + + if (fStickyZoomCountDown > 0) + fStickyZoomCountDown--; + } @@ -1355,10 +1361,16 @@ uint32 buttons; GetMouse(&where, &buttons); - if (dy < 0) - ZoomIn(where); - else if (dy > 0) - ZoomOut(where); + if (fStickyZoomCountDown <= 0) { + if (dy < 0) + ZoomIn(where); + else if (dy > 0) + ZoomOut(where); + + if (fZoom == 1.0) + fStickyZoomCountDown = STICKY_ZOOM_DELAY_TIME; + } + } } Modified: haiku/trunk/src/apps/showimage/ShowImageView.h =================================================================== --- haiku/trunk/src/apps/showimage/ShowImageView.h 2011-06-25 03:24:25 UTC (rev 42310) +++ haiku/trunk/src/apps/showimage/ShowImageView.h 2011-06-25 04:24:54 UTC (rev 42311) @@ -219,6 +219,9 @@ int fHideCursorCountDown; // Hides the cursor when it reaches zero + int fStickyZoomCountDown; + // Make the zoom sticky at 1.0 when zoomed with the mousewheel + bool fIsActiveWin; // Is the parent window the active window?