diff options
author | Subodh Kumar <s7158.kumar@samsung.com> | 2019-07-12 11:58:35 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-07-12 12:04:06 -0400 |
commit | 2854702f8ec4c7899473f737c31420de429e9359 (patch) | |
tree | df1f3516e842152abdf49c5848baa14e7bbed281 /src/lib/edje/edje_calc.c | |
parent | a9504b9e75c4c9d9b1c76b4a06134f7a66faf88d (diff) |
edje: Add support for map zoom to use other part center.
Summary:
Current:
In edc, zoom is supposed to happen from object center, there is no way to
change the center of the zoom.
Changes:
Adding support to change the center of zooming just like map rotation by using
other part's center.
@feature
Reviewers: cedric, zmike
Reviewed By: zmike
Subscribers: zmike, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9115
Diffstat (limited to '')
-rw-r--r-- | src/lib/edje/edje_calc.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 0619574e93..f3d31c8502 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c | |||
@@ -8,8 +8,11 @@ static void _edje_part_make_rtl(Edje_Part_Description_C | |||
8 | static Edje_Part_Description_Common *_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type); | 8 | static Edje_Part_Description_Common *_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type); |
9 | 9 | ||
10 | static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, | 10 | static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, |
11 | Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc, | 11 | Edje_Part_Description_Common *desc, |
12 | Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp, | 12 | Edje_Part_Description_Common *chosen_desc, |
13 | Edje_Real_Part *center, | ||
14 | Edje_Real_Part *zoom_center, | ||
15 | Edje_Real_Part *light, Edje_Real_Part *persp, | ||
13 | Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y, | 16 | Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y, |
14 | Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y, | 17 | Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y, |
15 | Edje_Real_Part *clip_to, | 18 | Edje_Real_Part *clip_to, |
@@ -2279,6 +2282,7 @@ static void | |||
2279 | _edje_part_recalc_single_map(Edje *ed, | 2282 | _edje_part_recalc_single_map(Edje *ed, |
2280 | Edje_Real_Part *ep EINA_UNUSED, | 2283 | Edje_Real_Part *ep EINA_UNUSED, |
2281 | Edje_Real_Part *center, | 2284 | Edje_Real_Part *center, |
2285 | Edje_Real_Part *zoom_center, | ||
2282 | Edje_Real_Part *light, | 2286 | Edje_Real_Part *light, |
2283 | Edje_Real_Part *persp, | 2287 | Edje_Real_Part *persp, |
2284 | Edje_Part_Description_Common *desc, | 2288 | Edje_Part_Description_Common *desc, |
@@ -2293,6 +2297,7 @@ _edje_part_recalc_single_map(Edje *ed, | |||
2293 | 2297 | ||
2294 | EINA_COW_CALC_MAP_BEGIN(params, params_write) | 2298 | EINA_COW_CALC_MAP_BEGIN(params, params_write) |
2295 | { | 2299 | { |
2300 | //rotation center | ||
2296 | if (center) | 2301 | if (center) |
2297 | { | 2302 | { |
2298 | params_write->center.x = ed->x + center->x + (center->w / 2); | 2303 | params_write->center.x = ed->x + center->x + (center->w / 2); |
@@ -2304,6 +2309,17 @@ _edje_part_recalc_single_map(Edje *ed, | |||
2304 | params_write->center.y = ed->y + params->final.y + (params->final.h / 2); | 2309 | params_write->center.y = ed->y + params->final.y + (params->final.h / 2); |
2305 | } | 2310 | } |
2306 | params_write->center.z = 0; | 2311 | params_write->center.z = 0; |
2312 | //zoom center | ||
2313 | if (zoom_center) | ||
2314 | { | ||
2315 | params_write->zoom_center.x = ed->x + zoom_center->x + (zoom_center->w / 2); | ||
2316 | params_write->zoom_center.y = ed->y + zoom_center->y + (zoom_center->h / 2); | ||
2317 | } | ||
2318 | else | ||
2319 | { | ||
2320 | params_write->zoom_center.x = ed->x + params->final.x + (params->final.w / 2); | ||
2321 | params_write->zoom_center.y = ed->y + params->final.y + (params->final.h / 2); | ||
2322 | } | ||
2307 | 2323 | ||
2308 | params_write->rotation.x = desc->map.rot.x; | 2324 | params_write->rotation.x = desc->map.rot.x; |
2309 | params_write->rotation.y = desc->map.rot.y; | 2325 | params_write->rotation.y = desc->map.rot.y; |
@@ -2680,6 +2696,7 @@ _edje_part_recalc_single(Edje *ed, | |||
2680 | Edje_Part_Description_Common *desc, | 2696 | Edje_Part_Description_Common *desc, |
2681 | Edje_Part_Description_Common *chosen_desc, | 2697 | Edje_Part_Description_Common *chosen_desc, |
2682 | Edje_Real_Part *center, | 2698 | Edje_Real_Part *center, |
2699 | Edje_Real_Part *zoom_center, | ||
2683 | Edje_Real_Part *light, | 2700 | Edje_Real_Part *light, |
2684 | Edje_Real_Part *persp, | 2701 | Edje_Real_Part *persp, |
2685 | Edje_Real_Part *rel1_to_x, | 2702 | Edje_Real_Part *rel1_to_x, |
@@ -3056,7 +3073,7 @@ _edje_part_recalc_single(Edje *ed, | |||
3056 | EINA_COW_CALC_PHYSICS_END(params, params_write); | 3073 | EINA_COW_CALC_PHYSICS_END(params, params_write); |
3057 | } | 3074 | } |
3058 | #endif | 3075 | #endif |
3059 | _edje_part_recalc_single_map(ed, ep, center, light, persp, desc, chosen_desc, params); | 3076 | _edje_part_recalc_single_map(ed, ep, center, zoom_center, light, persp, desc, chosen_desc, params); |
3060 | } | 3077 | } |
3061 | 3078 | ||
3062 | static void | 3079 | static void |
@@ -3616,7 +3633,7 @@ _edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf, | |||
3616 | //zoom | 3633 | //zoom |
3617 | evas_map_util_zoom(map, | 3634 | evas_map_util_zoom(map, |
3618 | pf->ext->map->zoom.x, pf->ext->map->zoom.y, | 3635 | pf->ext->map->zoom.x, pf->ext->map->zoom.y, |
3619 | pf->ext->map->center.x, pf->ext->map->center.y); | 3636 | pf->ext->map->zoom_center.x, pf->ext->map->zoom_center.y); |
3620 | 3637 | ||
3621 | //rotate | 3638 | //rotate |
3622 | evas_map_util_3d_rotate(map, | 3639 | evas_map_util_3d_rotate(map, |
@@ -3853,6 +3870,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
3853 | int statep2 = -1; | 3870 | int statep2 = -1; |
3854 | int statecl = -1; | 3871 | int statecl = -1; |
3855 | Edje_Real_Part *center[2] = { NULL, NULL }; | 3872 | Edje_Real_Part *center[2] = { NULL, NULL }; |
3873 | Edje_Real_Part *zoom_center[2] = { NULL, NULL }; | ||
3856 | Edje_Real_Part *light[2] = { NULL, NULL }; | 3874 | Edje_Real_Part *light[2] = { NULL, NULL }; |
3857 | Edje_Real_Part *persp[2] = { NULL, NULL }; | 3875 | Edje_Real_Part *persp[2] = { NULL, NULL }; |
3858 | Edje_Real_Part *rp1[4] = { NULL, NULL, NULL, NULL }; | 3876 | Edje_Real_Part *rp1[4] = { NULL, NULL, NULL, NULL }; |
@@ -4172,6 +4190,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
4172 | if (ep->param1.description->map.on) | 4190 | if (ep->param1.description->map.on) |
4173 | { | 4191 | { |
4174 | center[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.rot.id_center, &statec1); | 4192 | center[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.rot.id_center, &statec1); |
4193 | zoom_center[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.zoom.id_center, &statec1); | ||
4175 | light[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.id_light, &statel1); | 4194 | light[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.id_light, &statel1); |
4176 | 4195 | ||
4177 | if (chosen_desc->map.persp_on) | 4196 | if (chosen_desc->map.persp_on) |
@@ -4183,6 +4202,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
4183 | if (ep->param2 && ep->param2->description->map.on) | 4202 | if (ep->param2 && ep->param2->description->map.on) |
4184 | { | 4203 | { |
4185 | center[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.rot.id_center, &statec2); | 4204 | center[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.rot.id_center, &statec2); |
4205 | zoom_center[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.zoom.id_center, &statec2); | ||
4186 | light[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.id_light, &statel2); | 4206 | light[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.id_light, &statel2); |
4187 | 4207 | ||
4188 | if (chosen_desc->map.persp_on) | 4208 | if (chosen_desc->map.persp_on) |
@@ -4218,7 +4238,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
4218 | #endif | 4238 | #endif |
4219 | { | 4239 | { |
4220 | _edje_part_recalc_single(ed, ep, ep->param1.description, | 4240 | _edje_part_recalc_single(ed, ep, ep->param1.description, |
4221 | chosen_desc, center[0], light[0], | 4241 | chosen_desc, center[0], zoom_center[0], light[0], |
4222 | persp[0], rp1[Rel1X], rp1[Rel1Y], | 4242 | persp[0], rp1[Rel1X], rp1[Rel1Y], |
4223 | rp1[Rel2X], rp1[Rel2Y], clip1, confine_to, | 4243 | rp1[Rel2X], rp1[Rel2Y], clip1, confine_to, |
4224 | threshold, p1, mmw, mmh, | 4244 | threshold, p1, mmw, mmh, |
@@ -4264,7 +4284,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
4264 | #endif | 4284 | #endif |
4265 | { | 4285 | { |
4266 | _edje_part_recalc_single(ed, ep, ep->param2->description, | 4286 | _edje_part_recalc_single(ed, ep, ep->param2->description, |
4267 | chosen_desc, center[1], light[1], | 4287 | chosen_desc, center[1], zoom_center[1], light[1], |
4268 | persp[1], rp2[Rel1X], rp2[Rel1Y], | 4288 | persp[1], rp2[Rel1X], rp2[Rel1Y], |
4269 | rp2[Rel2X], rp2[Rel2Y], clip2, confine_to, | 4289 | rp2[Rel2X], rp2[Rel2Y], clip2, confine_to, |
4270 | threshold, p2, mmw, mmh, | 4290 | threshold, p2, mmw, mmh, |
@@ -4549,6 +4569,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
4549 | p3_write->center.x = INTP(p1->ext->map->center.x, p2->ext->map->center.x, pos); | 4569 | p3_write->center.x = INTP(p1->ext->map->center.x, p2->ext->map->center.x, pos); |
4550 | p3_write->center.y = INTP(p1->ext->map->center.y, p2->ext->map->center.y, pos); | 4570 | p3_write->center.y = INTP(p1->ext->map->center.y, p2->ext->map->center.y, pos); |
4551 | p3_write->center.z = INTP(p1->ext->map->center.z, p2->ext->map->center.z, pos); | 4571 | p3_write->center.z = INTP(p1->ext->map->center.z, p2->ext->map->center.z, pos); |
4572 | p3_write->zoom_center.x = INTP(p1->ext->map->zoom_center.x, p2->ext->map->zoom_center.x, pos); | ||
4573 | p3_write->zoom_center.y = INTP(p1->ext->map->zoom_center.y, p2->ext->map->zoom_center.y, pos); | ||
4552 | p3_write->rotation.x = FFP(p1->ext->map->rotation.x, p2->ext->map->rotation.x, pos); | 4574 | p3_write->rotation.x = FFP(p1->ext->map->rotation.x, p2->ext->map->rotation.x, pos); |
4553 | p3_write->rotation.y = FFP(p1->ext->map->rotation.y, p2->ext->map->rotation.y, pos); | 4575 | p3_write->rotation.y = FFP(p1->ext->map->rotation.y, p2->ext->map->rotation.y, pos); |
4554 | p3_write->rotation.z = FFP(p1->ext->map->rotation.z, p2->ext->map->rotation.z, pos); | 4576 | p3_write->rotation.z = FFP(p1->ext->map->rotation.z, p2->ext->map->rotation.z, pos); |