summaryrefslogtreecommitdiffstats
Unidiff
-rw-r--r--src/controller/actions/set_ortho.c13
-rw-r--r--src/controller/actions/zoom.c70
-rw-r--r--src/controller/actions/zoom.h4
-rw-r--r--src/controller/callbacks/display.c6
-rw-r--r--src/controller/callbacks/keyboard.c7
-rw-r--r--src/controller/callbacks/mouse.c49
-rw-r--r--src/controller/callbacks/mouse_wheel.c66
-rw-r--r--src/controller/callbacks/reshape.c68
-rw-r--r--src/model/geometry/density_legend_geometry.c18
-rw-r--r--src/model/state/zoom_info.h1
-rw-r--r--src/model/state/zoom_info_init.c6
11 files changed, 197 insertions, 111 deletions
diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c
index f901476..34ff290 100644
--- a/src/controller/callbacks/mouse.c
+++ b/src/controller/callbacks/mouse.c
@@ -25,7 +25,7 @@ mouse (int button, int state, int x, int y)
25 {25 {
26 // Deactive a panning event if one was happening.26 // Deactive a panning event if one was happening.
27 S.pan.active = false;27 S.pan.active = false;
2828
29 if (S.selection.active && 29 if (S.selection.active &&
30 S.selection.purpose == ZOOM &&30 S.selection.purpose == ZOOM &&
31 glutGetModifiers () == GLUT_ACTIVE_CTRL)31 glutGetModifiers () == GLUT_ACTIVE_CTRL)
@@ -35,14 +35,49 @@ mouse (int button, int state, int x, int y)
35 */35 */
36 if (x == S.selection.x || y == S.selection.y)36 if (x == S.selection.x || y == S.selection.y)
37 return;37 return;
3838
39 /*
40 * Convert the selection boundary from window coordinates to
41 * world coordinates.
42 */
43 glMatrixMode (GL_MODELVIEW);
44 glLoadIdentity ();
45 GLdouble model[16];
46 glGetDoublev (GL_MODELVIEW_MATRIX, model);
47 GLdouble projection[16];
48 glGetDoublev (GL_PROJECTION_MATRIX, projection);
39 GLint viewport[4];49 GLint viewport[4];
40 glGetIntegerv (GL_VIEWPORT, viewport);50 glGetIntegerv (GL_VIEWPORT, viewport);
4151
42 zoom (S.selection.x, 52 check_error (__FILE__, __LINE__);
43 viewport[3] - S.selection.y, 53
44 x, 54 GLdouble start_position[3];
45 viewport[3] - y);55 gluUnProject (x,
56 viewport[3] -y,
57 0,
58 model,
59 projection,
60 viewport,
61 &start_position[0],
62 &start_position[1], &start_position[2]);
63
64 check_error (__FILE__, __LINE__);
65
66 GLdouble end_position[3];
67 gluUnProject (S.selection.x,
68 viewport[3] - S.selection.y,
69 0,
70 model,
71 projection,
72 viewport,
73 &end_position[0], &end_position[1], &end_position[2]);
74
75 check_error (__FILE__, __LINE__);
76
77 zoom (fmin (start_position[0], end_position[0]),
78 fmin (start_position[1], end_position[1]),
79 fmax (start_position[0], end_position[0]),
80 fmax (start_position[1], end_position[1]));
46 }81 }
4782
48 /*83 /*

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.