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.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42311 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood 2011-06-25 04:24:54 +00:00
parent 0f06b3de2a
commit 281ad93ce7
2 changed files with 19 additions and 4 deletions

View File

@ -71,6 +71,7 @@ class PopUpMenu : public BPopUpMenu {
// 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 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode,
fShowCaption(false),
fShowingPopUpMenu(false),
fHideCursorCountDown(HIDE_CURSOR_DELAY_TIME),
fStickyZoomCountDown(0),
fIsActiveWin(true),
fDefaultCursor(NULL),
fGrabCursor(NULL)
@ -253,6 +255,10 @@ ShowImageView::Pulse()
} else
fHideCursorCountDown--;
}
if (fStickyZoomCountDown > 0)
fStickyZoomCountDown--;
}
@ -1355,10 +1361,16 @@ ShowImageView::_MouseWheelChanged(BMessage *msg)
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;
}
}
}

View File

@ -219,6 +219,9 @@ private:
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?