summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--src/Makefile.am4
-rw-r--r--src/controller/exp004mouse.c55
-rw-r--r--src/controller/mousewheel.c45
-rw-r--r--src/controller/mousewheel.h11
-rw-r--r--src/controller/performzoom.c65
-rw-r--r--src/controller/performzoom.h9
-rw-r--r--src/view/exp004view.c4
7 files changed, 149 insertions, 44 deletions
diff --git a/src/controller/exp004mouse.c b/src/controller/exp004mouse.c
index 17ff19c..cf09bef 100644
--- a/src/controller/exp004mouse.c
+++ b/src/controller/exp004mouse.c
@@ -1,6 +1,7 @@
#include "exp004mouse.h"
#include "exp004processhits.h"
#include "exp004reshape.h"
+#include "performzoom.h"
#include "set_ortho.h"
#include "../view/exp004geometry.h"
#include "../view/exp004state0.h"
@@ -28,53 +29,19 @@ exp004mouse (int button, int state, int x, int y)
if (x == S.selection.x || y == S.selection.y)
return;
- /*
- * Convert the selection boundary from window coordinates to
- * world coordinates.
- */
- glMatrixMode (GL_MODELVIEW);
- glLoadIdentity ();
- GLdouble model[16];
- glGetDoublev (GL_MODELVIEW_MATRIX, model);
- GLdouble projection[16];
- glGetDoublev (GL_PROJECTION_MATRIX, projection);
GLint viewport[4];
glGetIntegerv (GL_VIEWPORT, viewport);
- check_error (__FILE__, __LINE__);
-
- GLdouble start_position[3];
- gluUnProject (S.selection.x,
- viewport[3] - S.selection.y,
- 0,
- model,
- projection,
- viewport,
- &start_position[0],
- &start_position[1], &start_position[2]);
-
- check_error (__FILE__, __LINE__);
-
- GLdouble end_position[3];
- gluUnProject (x,
- viewport[3] - y,
- 0,
- model,
- projection,
- viewport,
- &end_position[0], &end_position[1], &end_position[2]);
-
- check_error (__FILE__, __LINE__);
-
- S.zoom.active = true;
- S.zoom.coords[0] = fmin (start_position[0], end_position[0]);
- S.zoom.coords[1] = fmax (start_position[0], end_position[0]);
- S.zoom.coords[2] = fmin (start_position[1], end_position[1]);
- S.zoom.coords[3] = fmax (start_position[1], end_position[1]);
-
- exp004reshape (S.viewport.w, S.viewport.h);
-
- glutPostRedisplay ();
+ printf ("Zooming to: %i, %i, %i, %i\n",
+ S.selection.x,
+ viewport[3] - S.selection.y,
+ x,
+ viewport[3] - y);
+
+ performzoom (S.selection.x,
+ viewport[3] - S.selection.y,
+ x,
+ viewport[3] - y);
}
/*

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.