Browse Source

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
pull/49/head
Ian MacArthur 11 years ago
parent
commit
460544455d
  1. 28
      test/fracviewer.cxx

28
test/fracviewer.cxx

@ -331,7 +331,33 @@ void agvSwitchMoveMode(int move) @@ -331,7 +331,33 @@ void agvSwitchMoveMode(int move)
void agvHandleButton(int button, int state, int x, int y)
{
if (button > GLUT_RIGHT_BUTTON)return;
// 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;

Loading…
Cancel
Save