-rw-r--r-- | src/controller/exp004mouse.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/controller/exp004mouse.c b/src/controller/exp004mouse.c index 8e8f986..72791d5 100644 --- a/src/controller/exp004mouse.c +++ b/src/controller/exp004mouse.c @@ -1,5 +1,6 @@ #include "exp004mouse.h" #include "exp004processhits.h" +#include "exp004reshape.h" #include "../view/exp004geometry.h" #include "../view/exp004state0.h" #include "../util/check_error.h" @@ -17,10 +18,31 @@ exp004mouse (int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) { + if (S.selecting == true && S.zoom == true) + { + GLint viewport[4]; + glGetIntegerv (GL_VIEWPORT, viewport); + + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + + /* + * Convert the selection boundary from window coordinates to + * world coordinates. + */ + + gluOrtho2D(-20.0, + 20.0, + -20.0, + 20.0); + + glutPostRedisplay (); + } + /* * Complete a selection if one was started and not cancelled. */ - if (S.selecting == true) + if (S.selecting == true && S.zoom == false) { /* @@ -57,14 +79,6 @@ exp004mouse (int button, int state, int x, int y) GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); - /* - gluPickMatrix ((GLdouble) x, - (GLdouble) (viewport[3] - y), - N, - N, - viewport); - */ - double c_x = 0.0; double c_y = 0.0; double w = 0.0; |