summaryrefslogtreecommitdiffstats
Unidiff
-rw-r--r--Makefile.am17
-rw-r--r--src/controller/actions/pan.c23
-rw-r--r--src/controller/actions/set_ortho.c5
-rw-r--r--src/controller/actions/zoom.c8
-rw-r--r--src/controller/callbacks/keyboard.c2
-rw-r--r--src/controller/callbacks/mouse.c30
-rw-r--r--src/controller/callbacks/mouse_motion.c2
-rw-r--r--src/controller/callbacks/mouse_wheel.c8
-rw-r--r--src/controller/callbacks/reshape.c26
-rw-r--r--src/model/geometry/map_geometry.c10
-rw-r--r--src/model/state/pan_info_init.h2
-rw-r--r--src/model/state/zoom_info_init.c2
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;
2829
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 else35 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 }
4749
48 else 50 else
49 {51 {
50 /*52 /*
51 * This scaling produces an odd effect when the coordinates are53 * 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 }
7274
73 set_ortho ();75 set_ortho ();
7476

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.