From: Bluezery <ohpowel@gmail.com>
authorBluezery <ohpowel@gmail.com>
Thu, 22 Dec 2011 07:54:59 +0000 (07:54 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Thu, 22 Dec 2011 07:54:59 +0000 (07:54 +0000)
Subject: [E-devel]  [Patch][elm_map] Mouse wheel bug fix

There is mouse wheel bug. Actually I have made it in previous patch :p

When using mouse wheel, tile size was changed between 0.5 ~ 2.0 before
zoom level is changed. But actually it should be changed between
1.0 ~ 2.0. I have fixed it. If tile size is below 1.0,  it does zoom-out.
And if tile size is above 2.0, it does zoom-in.

SVN revision: 66459

src/lib/elm_map.c

index 269943c..7c06b96 100644 (file)
@@ -1643,6 +1643,7 @@ _mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi
 
    if (!wd->paused)
      {
+        int zoom_diff = 0;
         Evas_Event_Mouse_Wheel *ev = (Evas_Event_Mouse_Wheel*) event_info;
         Evas_Coord x, y, w, h;
 
@@ -1652,23 +1653,33 @@ _mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi
         wd->calc_job = ecore_job_add(_calc_job, wd);
 
         wd->wheel_diff -= ev->z;
-        wd->pinch.level = pow(2.0, (double)wd->wheel_diff/10);
+        wd->pinch.level = wd->pinch.diff * pow(2.0, (double)wd->wheel_diff/10);
         wd->pinch.cx = x + ((double)w * 0.5);
         wd->pinch.cy = y + ((double)h * 0.5);
 
-        if (wd->wheel_diff >= 10 || wd->wheel_diff <= -10)
+        if (wd->pinch.level > 2.0 || wd->pinch.level < 1.0)
           {
-
+             wd->wheel_diff = 0;
+             if (wd->pinch.level > 2.0)
+               {
+                  zoom_diff = 1;
+                  wd->pinch.diff = 1.0;
+                  wd->pinch.level = 1.0;
+               }
+             else if (wd->pinch.level < 1.0)
+               {
+                  zoom_diff = -1;
+                  wd->pinch.diff = 2.0;
+                  wd->pinch.level = 2.0;
+               }
 
              Elm_Map_Zoom_Mode temp;
              temp = wd->mode;
              wd->mode = ELM_MAP_ZOOM_MODE_MANUAL;
              wd->paused = EINA_TRUE;
-             elm_map_zoom_set(data, wd->zoom + (wd->wheel_diff/10));
+             elm_map_zoom_set(data, wd->zoom + zoom_diff);
              wd->paused = EINA_FALSE;
              wd->mode = temp;
-             wd->pinch.level = 1.0;
-            wd->wheel_diff = 0;
           }
         else
           {