[Upstream merge r63510] Elementary map : fix zoom-out bug
authorDaniel Juyung Seo <juyung.seo@samsung.com>
Tue, 27 Sep 2011 08:01:21 +0000 (17:01 +0900)
committerDaniel Juyung Seo <juyung.seo@samsung.com>
Tue, 27 Sep 2011 08:01:21 +0000 (17:01 +0900)
From: Kim Yunhan <spbear@gmail.com>

When you test elm_map with mouse wheel, it worked abnormally because of some bug.
So I made some more patch for fixing it.
This patch file also includes a previous patch (zoom-out issue).

git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@63510 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

Conflicts:

src/lib/elm_map.c

src/lib/elm_map.c

index c6b0e96..922a87d 100644 (file)
@@ -101,8 +101,8 @@ typedef struct _Track_Dump Track_Dump;
 #define NOMINATIM_ATTR_LON "lon"
 #define NOMINATIM_ATTR_LAT "lat"
 
-#define PINCH_ZOOM_MIN 0.1
-#define PINCH_ZOOM_MAX 5.0
+#define PINCH_ZOOM_MIN 0.25
+#define PINCH_ZOOM_MAX 4.0
 
 #define GPX_NAME "name>"
 #define GPX_COORDINATES "trkpt "
@@ -1974,27 +1974,26 @@ _mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi
    half_w = (float)w * 0.5;
    half_h = (float)h * 0.5;
 
-   if (!wd->wheel_zoom) wd->wheel_zoom = 1.0;
    if (ev->z > 0)
      {
         wd->zoom_method = ZOOM_METHOD_OUT;
-        wd->wheel_zoom -= 0.05;
-        if (wd->wheel_zoom <= PINCH_ZOOM_MIN) wd->wheel_zoom = PINCH_ZOOM_MIN;
+        wd->wheel_zoom -= 0.1;
+        if (wd->wheel_zoom <= -2.0) wd->wheel_zoom = -2.0;
      }
    else
      {
         wd->zoom_method = ZOOM_METHOD_IN;
-        wd->wheel_zoom += 0.2;
-        if (wd->wheel_zoom >= PINCH_ZOOM_MAX) wd->wheel_zoom = PINCH_ZOOM_MAX;
+        wd->wheel_zoom += 0.1;
+        if (wd->wheel_zoom >= 2.0) wd->wheel_zoom = 2.0;
      }
 
    if (!wd->paused)
      {
-   wd->pinch.level = wd->wheel_zoom;
-   wd->pinch.cx = x + half_w;
-   wd->pinch.cy = y + half_h;
-   if (wd->calc_job) ecore_job_del(wd->calc_job);
-   wd->calc_job = ecore_job_add(_calc_job, wd);
+        wd->pinch.level = pow(2.0, wd->wheel_zoom);
+        wd->pinch.cx = x + half_w;
+        wd->pinch.cy = y + half_h;
+        if (wd->calc_job) ecore_job_del(wd->calc_job);
+        wd->calc_job = ecore_job_add(_calc_job, wd);
      }
 
    if (wd->wheel_timer) ecore_timer_del(wd->wheel_timer);
@@ -2025,17 +2024,20 @@ _wheel_timer_cb(void *data)
         wd->wheel_timer = NULL;
         return ECORE_CALLBACK_CANCEL;
      }
-   if (wd->zoom_method == ZOOM_METHOD_IN) zoom = (int)ceil(wd->wheel_zoom - 1.0);
-   else if (wd->zoom_method == ZOOM_METHOD_OUT) zoom = (int)floor((-1.0 / wd->wheel_zoom) + 1.0);
+   if (wd->zoom_method == ZOOM_METHOD_IN) zoom = (int)ceil(wd->wheel_zoom);
+   else if (wd->zoom_method == ZOOM_METHOD_OUT) zoom = (int)floor(wd->wheel_zoom);
    else
      {
         wd->wheel_timer = NULL;
         return ECORE_CALLBACK_CANCEL;
      }
+
    wd->mode = ELM_MAP_ZOOM_MODE_MANUAL;
+   wd->pinch.level = 1.0;
    elm_map_zoom_set(data, wd->zoom + zoom);
    wd->wheel_zoom = 0.0;
    wd->wheel_timer = NULL;
+   wd->zoom_method = ZOOM_METHOD_NONE;
    return ECORE_CALLBACK_CANCEL;
 }