27 files changed, 179 insertions, 549 deletions
diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c index 16e8b8b..f594c23 100644 --- a/src/controller/callbacks/mouse.c +++ b/src/controller/callbacks/mouse.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "reshape.h" | 9 | #include "reshape.h" |
10 | #include <GL/glut.h> | 10 | #include <GL/glut.h> |
11 | #include <math.h> | 11 | #include <math.h> |
12 | #include <stdio.h> | ||
12 | #include <stdlib.h> | 13 | #include <stdlib.h> |
13 | 14 | ||
14 | /* | 15 | /* |
@@ -19,8 +20,12 @@ | |||
19 | void | 20 | void |
20 | mouse (int button, int state, int x, int y) | 21 | mouse (int button, int state, int x, int y) |
21 | { | 22 | { |
23 | // Release left button. | ||
22 | if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) | 24 | if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) |
23 | { | 25 | { |
26 | // Deactive a panning event if one was happening. | ||
27 | S.pan.active = false; | ||
28 | |||
24 | if (S.selection.active && S.selection.purpose == ZOOM) | 29 | if (S.selection.active && S.selection.purpose == ZOOM) |
25 | { | 30 | { |
26 | /* | 31 | /* |
@@ -41,7 +46,9 @@ mouse (int button, int state, int x, int y) | |||
41 | /* | 46 | /* |
42 | * Complete a selection if one was started and not cancelled. | 47 | * Complete a selection if one was started and not cancelled. |
43 | */ | 48 | */ |
44 | if (S.selection.active && S.selection.purpose == SET) | 49 | if (S.selection.active && |
50 | S.selection.purpose == SET && | ||
51 | glutGetModifiers () == GLUT_ACTIVE_CTRL) | ||
45 | { | 52 | { |
46 | 53 | ||
47 | /* | 54 | /* |
@@ -116,12 +123,31 @@ mouse (int button, int state, int x, int y) | |||
116 | 123 | ||
117 | } | 124 | } |
118 | 125 | ||
119 | if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) | 126 | // Begin selection. |
127 | if (button == GLUT_LEFT_BUTTON && | ||
128 | state == GLUT_DOWN && | ||
129 | glutGetModifiers () == GLUT_ACTIVE_CTRL) | ||
120 | { | 130 | { |
121 | S.selection.active = true; | 131 | S.selection.active = true; |
122 | S.selection.x = x; | 132 | S.selection.x = x; |
123 | S.selection.y = y; | 133 | S.selection.y = y; |
124 | } | 134 | } |
125 | 135 | ||
136 | // Pan. | ||
137 | if (button == GLUT_LEFT_BUTTON && | ||
138 | state == GLUT_DOWN && | ||
139 | glutGetModifiers () != GLUT_ACTIVE_CTRL) | ||
140 | { | ||
141 | /* | ||
142 | * Detection of the first point in a panning event. | ||
143 | */ | ||
144 | if (S.pan.active == false) | ||
145 | { | ||
146 | S.pan.active = true; | ||
147 | S.pan.begin[0] = x; | ||
148 | S.pan.begin[1] = y; | ||
149 | } | ||
150 | } | ||
151 | |||
126 | return; | 152 | return; |
127 | } | 153 | } |