-rw-r--r-- | src/controller/actions/set_ortho.c | 13 | ||||
-rw-r--r-- | src/controller/actions/zoom.c | 70 | ||||
-rw-r--r-- | src/controller/actions/zoom.h | 4 | ||||
-rw-r--r-- | src/controller/callbacks/display.c | 6 | ||||
-rw-r--r-- | src/controller/callbacks/keyboard.c | 7 | ||||
-rw-r--r-- | src/controller/callbacks/mouse.c | 49 | ||||
-rw-r--r-- | src/controller/callbacks/mouse_wheel.c | 66 | ||||
-rw-r--r-- | src/controller/callbacks/reshape.c | 68 | ||||
-rw-r--r-- | src/model/geometry/density_legend_geometry.c | 18 | ||||
-rw-r--r-- | src/model/state/zoom_info.h | 1 | ||||
-rw-r--r-- | src/model/state/zoom_info_init.c | 6 |
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; |
28 | 28 | ||
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; |
38 | 38 | ||
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); |
41 | 51 | ||
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 | } |
47 | 82 | ||
48 | /* | 83 | /* |