diff options
| author | Ian MacArthur <imacarthur@gmail.com> | 2014-06-06 21:46:42 +0000 |
|---|---|---|
| committer | Ian MacArthur <imacarthur@gmail.com> | 2014-06-06 21:46:42 +0000 |
| commit | 460544455d9f449ce80abdab22e0244698444158 (patch) | |
| tree | 6c3903ff9c50dcf3dc5c91939fb8187c38d1156d | |
| parent | 63b5ee9ef18982811a7a0bf5b973ad730de5fe00 (diff) | |
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
| -rw-r--r-- | test/fracviewer.cxx | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/test/fracviewer.cxx b/test/fracviewer.cxx index e19fd568c..ca1c274ed 100644 --- a/test/fracviewer.cxx +++ b/test/fracviewer.cxx @@ -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: |
