-rw-r--r-- | Makefile.am | 17 | ||||
-rw-r--r-- | src/controller/actions/pan.c | 23 | ||||
-rw-r--r-- | src/controller/actions/set_ortho.c | 5 | ||||
-rw-r--r-- | src/controller/actions/zoom.c | 8 | ||||
-rw-r--r-- | src/controller/callbacks/keyboard.c | 2 | ||||
-rw-r--r-- | src/controller/callbacks/mouse.c | 30 | ||||
-rw-r--r-- | src/controller/callbacks/mouse_motion.c | 2 | ||||
-rw-r--r-- | src/controller/callbacks/mouse_wheel.c | 8 | ||||
-rw-r--r-- | src/controller/callbacks/reshape.c | 26 | ||||
-rw-r--r-- | src/model/geometry/map_geometry.c | 10 | ||||
-rw-r--r-- | src/model/state/pan_info_init.h | 2 | ||||
-rw-r--r-- | src/model/state/zoom_info_init.c | 2 |
12 files changed, 70 insertions, 65 deletions
diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c index 34ff290..5f5be43 100644 --- a/src/controller/callbacks/mouse.c +++ b/src/controller/callbacks/mouse.c | |||
@@ -25,8 +25,8 @@ 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) |
32 | { | 32 | { |
@@ -35,7 +35,7 @@ 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 | /* | 39 | /* |
40 | * Convert the selection boundary from window coordinates to | 40 | * Convert the selection boundary from window coordinates to |
41 | * world coordinates. | 41 | * world coordinates. |
@@ -48,21 +48,21 @@ mouse (int button, int state, int x, int y) | |||
48 | glGetDoublev (GL_PROJECTION_MATRIX, projection); | 48 | glGetDoublev (GL_PROJECTION_MATRIX, projection); |
49 | GLint viewport[4]; | 49 | GLint viewport[4]; |
50 | glGetIntegerv (GL_VIEWPORT, viewport); | 50 | glGetIntegerv (GL_VIEWPORT, viewport); |
51 | 51 | ||
52 | check_error (__FILE__, __LINE__); | 52 | check_error (__FILE__, __LINE__); |
53 | 53 | ||
54 | GLdouble start_position[3]; | 54 | GLdouble start_position[3]; |
55 | gluUnProject (x, | 55 | gluUnProject (x, |
56 | viewport[3] -y, | 56 | viewport[3] - y, |
57 | 0, | 57 | 0, |
58 | model, | 58 | model, |
59 | projection, | 59 | projection, |
60 | viewport, | 60 | viewport, |
61 | &start_position[0], | 61 | &start_position[0], |
62 | &start_position[1], &start_position[2]); | 62 | &start_position[1], &start_position[2]); |
63 | 63 | ||
64 | check_error (__FILE__, __LINE__); | 64 | check_error (__FILE__, __LINE__); |
65 | 65 | ||
66 | GLdouble end_position[3]; | 66 | GLdouble end_position[3]; |
67 | gluUnProject (S.selection.x, | 67 | gluUnProject (S.selection.x, |
68 | viewport[3] - S.selection.y, | 68 | viewport[3] - S.selection.y, |
@@ -71,9 +71,9 @@ mouse (int button, int state, int x, int y) | |||
71 | projection, | 71 | projection, |
72 | viewport, | 72 | viewport, |
73 | &end_position[0], &end_position[1], &end_position[2]); | 73 | &end_position[0], &end_position[1], &end_position[2]); |
74 | 74 | ||
75 | check_error (__FILE__, __LINE__); | 75 | check_error (__FILE__, __LINE__); |
76 | 76 | ||
77 | zoom (fmin (start_position[0], end_position[0]), | 77 | zoom (fmin (start_position[0], end_position[0]), |
78 | fmin (start_position[1], end_position[1]), | 78 | fmin (start_position[1], end_position[1]), |
79 | fmax (start_position[0], end_position[0]), | 79 | fmax (start_position[0], end_position[0]), |
@@ -83,7 +83,7 @@ mouse (int button, int state, int x, int y) | |||
83 | /* | 83 | /* |
84 | * Complete a selection if one was started and not cancelled. | 84 | * Complete a selection if one was started and not cancelled. |
85 | */ | 85 | */ |
86 | if (S.selection.active && | 86 | if (S.selection.active && |
87 | S.selection.purpose == SET && | 87 | S.selection.purpose == SET && |
88 | glutGetModifiers () == GLUT_ACTIVE_CTRL) | 88 | glutGetModifiers () == GLUT_ACTIVE_CTRL) |
89 | { | 89 | { |
@@ -161,9 +161,8 @@ mouse (int button, int state, int x, int y) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | // Begin selection. | 163 | // Begin selection. |
164 | if (button == GLUT_LEFT_BUTTON && | 164 | if (button == GLUT_LEFT_BUTTON && |
165 | state == GLUT_DOWN && | 165 | state == GLUT_DOWN && glutGetModifiers () == GLUT_ACTIVE_CTRL) |
166 | glutGetModifiers () == GLUT_ACTIVE_CTRL) | ||
167 | { | 166 | { |
168 | S.selection.active = true; | 167 | S.selection.active = true; |
169 | S.selection.x = x; | 168 | S.selection.x = x; |
@@ -172,8 +171,7 @@ mouse (int button, int state, int x, int y) | |||
172 | 171 | ||
173 | // Pan. | 172 | // Pan. |
174 | if (button == GLUT_LEFT_BUTTON && | 173 | if (button == GLUT_LEFT_BUTTON && |
175 | state == GLUT_DOWN && | 174 | state == GLUT_DOWN && glutGetModifiers () != GLUT_ACTIVE_CTRL) |
176 | glutGetModifiers () != GLUT_ACTIVE_CTRL) | ||
177 | { | 175 | { |
178 | /* | 176 | /* |
179 | * Detection of the first point in a panning event. | 177 | * Detection of the first point in a panning event. |