summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2019-05-23 20:11:44 +0900
committerHermet Park <hermetpark@gmail.com>2019-05-23 20:11:44 +0900
commit451959973ddb5e1723f8c26b22420b6566cea026 (patch)
treefc554f092a2aa07d9396c55db8a58f06d452f238
parent708f67c4889fe7c08cb0860e3f19ca2fa54f7fa0 (diff)
Efl.Ui.Textpath: fix a size problem
Summary: Textpath set its hint_size using its position and calulated path information. The path information is calculated using center postion, radius & start angle. For example, if textpath position is 0,0 and center positon of path is 100,100 and radius 50, then text will be located on the rigth side of textpath object. Moreover there is another problem. [Step to reproduce] 1. Launch elementary_test 2. open Efl.Ui.Textpath 3. see circle is not center aligned. 4. click Clockwise 1 ~ 2 times center position is changed repeatedly. This occurs because textpath size is calculated by position_set. It does not make sense that changing postion defines its size. So this patch is setting textpath hint_size using only given center position. The text will position on the middle of textpath object always. Reviewers: Hermet, jsuya Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8930
-rw-r--r--src/lib/elementary/efl_ui_textpath.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/src/lib/elementary/efl_ui_textpath.c b/src/lib/elementary/efl_ui_textpath.c
index f9c906ab1a..df712c1615 100644
--- a/src/lib/elementary/efl_ui_textpath.c
+++ b/src/lib/elementary/efl_ui_textpath.c
@@ -403,7 +403,7 @@ _text_draw(void *data)
403} 403}
404 404
405static void 405static void
406_path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Bool set_min) 406_path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
407{ 407{
408 const Efl_Gfx_Path_Command_Type *cmd; 408 const Efl_Gfx_Path_Command_Type *cmd;
409 const double *points; 409 const double *points;
@@ -508,10 +508,6 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Bool set_min)
508 } 508 }
509 cmd++; 509 cmd++;
510 } 510 }
511 if (set_min)
512 {
513 efl_gfx_hint_size_min_set(obj, rect.size);
514 }
515 } 511 }
516} 512}
517 513
@@ -563,7 +559,7 @@ _ellipsis_set(Efl_Ui_Textpath_Data *pd, Eo *obj)
563static void 559static void
564_efl_ui_textpath_efl_gfx_path_commit(Eo *obj, Efl_Ui_Textpath_Data *pd) 560_efl_ui_textpath_efl_gfx_path_commit(Eo *obj, Efl_Ui_Textpath_Data *pd)
565{ 561{
566 _path_data_get(obj, pd, EINA_TRUE); 562 _path_data_get(obj, pd);
567 _sizing_eval(pd); 563 _sizing_eval(pd);
568} 564}
569 565
@@ -651,7 +647,7 @@ _path_start_angle_adjust(Eo *obj, Efl_Ui_Textpath_Data *pd)
651 pd->circle.start_angle - offset_angle, 647 pd->circle.start_angle - offset_angle,
652 360); 648 360);
653 } 649 }
654 _path_data_get(obj, pd, EINA_TRUE); 650 _path_data_get(obj, pd);
655} 651}
656 652
657EOLIAN static void 653EOLIAN static void
@@ -753,8 +749,34 @@ _efl_ui_textpath_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Textpath_Data *pd)
753EOLIAN static void 749EOLIAN static void
754_efl_ui_textpath_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Position2D pos) 750_efl_ui_textpath_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Position2D pos)
755{ 751{
752 Eina_Position2D opos, diff;
753 Efl_Ui_Textpath_Segment *seg;
754 double sx, sy, csx, csy, cex, cey, ex, ey;
755
756 opos = efl_gfx_entity_position_get(obj);
757
758 diff.x = pos.x - opos.x;
759 diff.y = pos.y - opos.y;
760
756 efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos); 761 efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
757 _path_data_get(obj, pd, EINA_FALSE); 762
763 EINA_INLIST_FOREACH(pd->segments, seg)
764 {
765 eina_bezier_values_get(&seg->bezier, &sx, &sy, &csx, &csy,
766 &cex, &cey, &ex, &ey);
767 sx += diff.x;
768 sy += diff.y;
769 csx += diff.x;
770 csy += diff.y;
771 cex += diff.x;
772 cey += diff.y;
773 ex += diff.x;
774 ey += diff.y;
775
776 eina_bezier_values_set(&seg->bezier, sx, sy, csx, csy,
777 cex, cey, ex, ey);
778 }
779
758 _text_draw(pd); 780 _text_draw(pd);
759} 781}
760 782
@@ -792,9 +814,11 @@ _efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double
792 radius * 2, start_angle, 360); 814 radius * 2, start_angle, 360);
793 } 815 }
794 816
795 _path_data_get(obj, pd, EINA_TRUE); 817 _path_data_get(obj, pd);
796 _path_start_angle_adjust(obj, pd); 818 _path_start_angle_adjust(obj, pd);
797 _sizing_eval(pd); 819 _sizing_eval(pd);
820
821 efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(x * 2, y * 2));
798} 822}
799 823
800EOLIAN static int 824EOLIAN static int