elm_transit: Support zoom keeping current map effect.
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Tue, 23 Dec 2014 00:36:37 +0000 (09:36 +0900)
committerChunEon Park <hermet@hermet.pe.kr>
Tue, 23 Dec 2014 00:37:11 +0000 (09:37 +0900)
Summary:
Support zoom keeping current map effect.

Reviewers: Hermet

Reviewed By: Hermet

Differential Revision: https://phab.enlightenment.org/D1805

src/lib/elm_transit.c

index 784aca2..d516ca3 100644 (file)
@@ -1093,27 +1093,48 @@ _transit_effect_zoom_op(Elm_Transit_Effect *effect, Elm_Transit *transit , doubl
    Evas_Object *obj;
    Eina_List *elist;
    Elm_Transit_Effect_Zoom *zoom = effect;
-   Evas_Map *map;
+   Elm_Transit_Obj_Data *obj_data;
+   Evas_Map *map, *base_map;
    Evas_Coord x, y, w, h;
-
-   map = evas_map_new(4);
-   if (!map) return;
-
-   evas_map_util_object_move_sync_set(map, EINA_TRUE);
+   Evas_Coord mx, my, mz;
+   int i, point_cnt;
 
    EINA_LIST_FOREACH(transit->objs, elist, obj)
      {
+        mz = zoom->from + (progress * zoom->to);
+
+        obj_data = evas_object_data_get(obj, _transit_key);
+        if (obj_data->state->map_enabled)
+          {
+             base_map = obj_data->state->map;
+             if (!base_map) return;
+             map = evas_map_dup(base_map);
+             if (!map) return;
+             point_cnt = evas_map_count_get(map);
+             for (i = 0; i < point_cnt; i++)
+               {
+                  evas_map_point_coord_get(base_map, i, &mx, &my, NULL);
+                  evas_map_point_coord_set(map, i, mx, my, mz);
+               }
+          }
+        else
+          {
+             map = evas_map_new(4);
+             if (!map) return;
+             evas_map_util_points_populate_from_object_full(map, obj, mz);
+          }
+        evas_map_util_object_move_sync_set(map, EINA_TRUE);
+
         evas_object_geometry_get(obj, &x, &y, &w, &h);
-        evas_map_util_points_populate_from_object_full(map, obj, zoom->from +
-                                                       (progress * zoom->to));
         _recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE);
         evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0,
                                      _TRANSIT_FOCAL);
         if (!transit->smooth) evas_map_smooth_set(map, EINA_FALSE);
         evas_object_map_set(obj, map);
         evas_object_map_enable_set(obj, EINA_TRUE);
+
+        evas_map_free(map);
      }
-   evas_map_free(map);
 }
 
 static Elm_Transit_Effect *