summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubodh Kumar <s7158.kumar@samsung.com>2016-02-12 21:00:50 +0100
committerCedric BAIL <cedric@osg.samsung.com>2016-02-12 21:00:53 +0100
commitcbbf08b4ed1157efaa1597cad798fb506c1853a8 (patch)
treef42c98aa5056a24e9f9371f679d61089247012c5
parentf5b3d50b8801d4ec450d4dfbc5e64ecebba8265e (diff)
spinner: fix vertical drag style and logic
Summary: Fix vertical drag style and logic. For vertical spinner graggable should move in y direction and since drag value is inverse of spinner increment and decrement so delta should be inversed. @fix Test Plan: 1. Elementary test 2. Vertical spinner Reviewers: cedric Projects: #elementary Differential Revision: https://phab.enlightenment.org/D3662 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--data/themes/edc/elm/spinner.edc11
-rw-r--r--src/lib/elm_spinner.c8
2 files changed, 18 insertions, 1 deletions
diff --git a/data/themes/edc/elm/spinner.edc b/data/themes/edc/elm/spinner.edc
index 9b4257d71..463c6c3ea 100644
--- a/data/themes/edc/elm/spinner.edc
+++ b/data/themes/edc/elm/spinner.edc
@@ -224,5 +224,16 @@ group { name: "elm/spinner/base/vertical";
224 align: 0.0 0.5; 224 align: 0.0 0.5;
225 } 225 }
226 } 226 }
227 part { name: "elm.dragable.slider"; type: RECT;
228 repeat_events: 1;
229 dragable.x: 0 0 0;
230 dragable.y: 1 1 0;
231 description { state: "default" 0.0;
232 fixed: 1 0;
233 rel1.to: "elm.swallow.text_button";
234 rel2.to: "elm.swallow.text_button";
235 color: 0 0 0 0;
236 }
237 }
227 } 238 }
228} 239}
diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c
index 45674bdad..0e94cf119 100644
--- a/src/lib/elm_spinner.c
+++ b/src/lib/elm_spinner.c
@@ -260,15 +260,18 @@ _drag_cb(void *data,
260{ 260{
261 double pos = 0.0, delta; 261 double pos = 0.0, delta;
262 Evas_Object *obj = data; 262 Evas_Object *obj = data;
263 const char *style;
263 264
264 ELM_SPINNER_DATA_GET(obj, sd); 265 ELM_SPINNER_DATA_GET(obj, sd);
265 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 266 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
266 267
267 if (sd->entry_visible) return; 268 if (sd->entry_visible) return;
268 269
270 style = elm_widget_style_get(obj);
271
269 if (sd->button_layout) 272 if (sd->button_layout)
270 { 273 {
271 if (!strncmp(elm_widget_style_get(obj), "vertical", 8)) 274 if (!strncmp(style, "vertical", 8))
272 eo_do((Eo *)wd->resize_obj, 275 eo_do((Eo *)wd->resize_obj,
273 edje_obj_part_drag_value_get("elm.dragable.slider", NULL, &pos)); 276 edje_obj_part_drag_value_get("elm.dragable.slider", NULL, &pos));
274 else 277 else
@@ -288,6 +291,9 @@ _drag_cb(void *data,
288 delta = sd->drag_val_step * sd->step * _elm_config->scale; 291 delta = sd->drag_val_step * sd->step * _elm_config->scale;
289 if (pos < sd->drag_prev_pos) delta *= -1; 292 if (pos < sd->drag_prev_pos) delta *= -1;
290 sd->drag_prev_pos = pos; 293 sd->drag_prev_pos = pos;
294
295 /* Dragable is inverse of spinner value */
296 if (!strncmp(style, "vertical", 8)) delta *= -1;
291 /* If we are on rtl mode, change the delta to be negative on such changes */ 297 /* If we are on rtl mode, change the delta to be negative on such changes */
292 if (elm_widget_mirrored_get(obj)) delta *= -1; 298 if (elm_widget_mirrored_get(obj)) delta *= -1;
293 if (_value_set(data, sd->val + delta)) _label_write(data); 299 if (_value_set(data, sd->val + delta)) _label_write(data);