Another stab at STR #3090.

Now, instead of just ignoring the scrollwheel
events, I try to make the scene zoom in/out
in response to the wheel instead.

Seems to be working; not sure I have the
zoom sensitivity set to a sensible avlue, though!



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10185 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Ian MacArthur 2014-06-06 21:46:42 +00:00
parent 63b5ee9ef1
commit 460544455d

View File

@ -331,11 +331,37 @@ void agvSwitchMoveMode(int move)
void agvHandleButton(int button, int state, int x, int y)
{
if (button > GLUT_RIGHT_BUTTON)return;
if (state == GLUT_DOWN && downb == -1) {
// deal with mouse wheel events, that fltk sends as buttons 3 or 4
//if (button > GLUT_RIGHT_BUTTON)return;
if ((state == GLUT_DOWN) && ((button == 3) || (button == 4))) {
// attempt to process scrollwheel as zoom in/out
float deltay = 0.25;
if (button == 3) {
deltay = (-0.25);
}
downb = -1;
downDist = EyeDist;
downEx = Ex;
downEy = Ey;
downEz = Ez;
downEyeMove = EyeMove;
EyeMove = 0;
EyeDist = downDist + deltay;
Ex = downEx - E_SENS*deltay*sin(TORAD(EyeAz))*cos(TORAD(EyeEl));
Ey = downEy - E_SENS*deltay*sin(TORAD(EyeEl));
Ez = downEz + E_SENS*deltay*cos(TORAD(EyeAz))*cos(TORAD(EyeEl));
EyeMove = downEyeMove;
glutPostRedisplay();
return;
}
else if (button > GLUT_RIGHT_BUTTON)return; // ignore any other button...
if (state == GLUT_DOWN && downb == -1) {
lastx = downx = x;
lasty = downy = y;
downb = button;
downb = button;
switch (button) {
case GLUT_LEFT_BUTTON: