summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2014-11-30 15:29:34 +0200
committerYakov Goldberg <yakov.g@samsung.com>2014-12-01 10:48:53 +0200
commit406dcc7ee44e41196097efdce736f17356f5bf13 (patch)
treebd7e0cfd254b5bdb85f77656f3bf2aa895b1a149 /src/bin
parente936bf0c04a6be0356a6e0e0c4b671ecd458b68c (diff)
Calculate borders of nested drop targets.
Example: suppose we have box, box and table. So when dragging we first enter first box, and then - table. Second box will be missed if empty. Drop into teh second box will be done by dropping in items.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/egui_gui/dnd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bin/egui_gui/dnd.c b/src/bin/egui_gui/dnd.c
index 75b3e39..1543d09 100644
--- a/src/bin/egui_gui/dnd.c
+++ b/src/bin/egui_gui/dnd.c
@@ -131,13 +131,15 @@ _drop_target_iterate(Gui_Widget **drop_candidate, Gui_Session *session, Evas_Coo
131 Dep_Id *wdg_id; 131 Dep_Id *wdg_id;
132 Eo *o; 132 Eo *o;
133 Evas_Coord ox, oy, ow, oh; 133 Evas_Coord ox, oy, ow, oh;
134 double aprx = 0.05;
134 135
135 const Eina_List *lst, *l; 136 const Eina_List *lst, *l;
136 lst = wdg_children_list_get(*drop_candidate); 137 lst = wdg_children_list_get(*drop_candidate);
137 EINA_LIST_FOREACH(lst, l, wdg_id) 138 EINA_LIST_FOREACH(lst, l, wdg_id)
138 { 139 {
139 Gui_Widget *w = wdg_get(wdg_id); 140 Gui_Widget *w = wdg_get(wdg_id);
140 if (!wdg_data_get(w, DROP_TARGET)) 141 /* if widget is not active, or is not a drop target, continue. */
142 if (!w || !wdg_data_get(w, DROP_TARGET))
141 continue; 143 continue;
142 o = session_eo_get(session, w); 144 o = session_eo_get(session, w);
143 eo_do(o, evas_obj_position_get(&ox, &oy)); 145 eo_do(o, evas_obj_position_get(&ox, &oy));
@@ -146,7 +148,12 @@ _drop_target_iterate(Gui_Widget **drop_candidate, Gui_Session *session, Evas_Coo
146 ((y >= oy) && (y <= oy + oh))) 148 ((y >= oy) && (y <= oy + oh)))
147 { 149 {
148 *drop_candidate = w; 150 *drop_candidate = w;
149 stop = EINA_FALSE; 151 /* Suppose we have win, a resize object box, and a table packed into the box.
152 * We drag, so want to enter the box first, and table after.
153 * So while pointer in in 5% of width of the box, force to return the box as a drop target. */
154 if (((x > ox + (Evas_Coord) (ow * aprx)) && (x <= ox + (Evas_Coord) (ow * (1- aprx)))) &&
155 ((y > oy + (Evas_Coord) (oh * aprx)) && (y <= oy + (Evas_Coord) (oh * (1- aprx)))))
156 stop = EINA_FALSE;
150 } 157 }
151 } 158 }
152 159