-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/reshape.c b/src/controller/callbacks/reshape.c index fec5443..0414be6 100644 --- a/src/controller/callbacks/reshape.c +++ b/src/controller/callbacks/reshape.c | |||
@@ -21,23 +21,25 @@ reshape (int w, int h) | |||
21 | { | 21 | { |
22 | if (w >= h) | 22 | if (w >= h) |
23 | { | 23 | { |
24 | double scale | 24 | double scale |
25 | = ( ( (S.zoom.coords[1] - S.zoom.coords[0]) * ((double) w / (double) h) ) | 25 | = |
26 | - (S.zoom.coords[1] - S.zoom.coords[0]) ) | 26 | (((S.zoom.coords[1] - |
27 | * 0.5; | 27 | S.zoom.coords[0]) * ((double) w / (double) h)) - |
28 | (S.zoom.coords[1] - S.zoom.coords[0])) * 0.5; | ||
28 | 29 | ||
29 | S.ortho.min_x = S.zoom.coords[0] - scale; | 30 | S.ortho.min_x = S.zoom.coords[0] - scale; |
30 | S.ortho.max_x = S.zoom.coords[1] + scale; | 31 | S.ortho.max_x = S.zoom.coords[1] + scale; |
31 | S.ortho.min_y = S.zoom.coords[2]; | 32 | S.ortho.min_y = S.zoom.coords[2]; |
32 | S.ortho.max_y = S.zoom.coords[3]; | 33 | S.ortho.max_y = S.zoom.coords[3]; |
33 | } | 34 | } |
34 | else | 35 | else |
35 | { | 36 | { |
36 | double scale | 37 | double scale |
37 | = ( ( (S.zoom.coords[3] - S.zoom.coords[2]) * ((double) h / (double) w) ) | 38 | = |
38 | - (S.zoom.coords[3] - S.zoom.coords[2]) ) | 39 | (((S.zoom.coords[3] - |
39 | * 0.5; | 40 | S.zoom.coords[2]) * ((double) h / (double) w)) - |
40 | 41 | (S.zoom.coords[3] - S.zoom.coords[2])) * 0.5; | |
42 | |||
41 | S.ortho.min_x = S.zoom.coords[0]; | 43 | S.ortho.min_x = S.zoom.coords[0]; |
42 | S.ortho.max_x = S.zoom.coords[1]; | 44 | S.ortho.max_x = S.zoom.coords[1]; |
43 | S.ortho.min_y = S.zoom.coords[2] - scale; | 45 | S.ortho.min_y = S.zoom.coords[2] - scale; |
@@ -45,7 +47,7 @@ reshape (int w, int h) | |||
45 | } | 47 | } |
46 | } | 48 | } |
47 | 49 | ||
48 | else | 50 | else |
49 | { | 51 | { |
50 | /* | 52 | /* |
51 | * This scaling produces an odd effect when the coordinates are | 53 | * This scaling produces an odd effect when the coordinates are |
@@ -68,7 +70,7 @@ reshape (int w, int h) | |||
68 | S.ortho.min_y = S.ortho_min; | 70 | S.ortho.min_y = S.ortho_min; |
69 | S.ortho.max_y = S.ortho_max; | 71 | S.ortho.max_y = S.ortho_max; |
70 | } | 72 | } |
71 | } | 73 | } |
72 | 74 | ||
73 | set_ortho (); | 75 | set_ortho (); |
74 | 76 | ||