forked from enlightenment/efl
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>
This commit is contained in:
parent
f3166f1c51
commit
f9f4030433
|
@ -224,5 +224,16 @@ group { name: "elm/spinner/base/vertical";
|
|||
align: 0.0 0.5;
|
||||
}
|
||||
}
|
||||
part { name: "elm.dragable.slider"; type: RECT;
|
||||
repeat_events: 1;
|
||||
dragable.x: 0 0 0;
|
||||
dragable.y: 1 1 0;
|
||||
description { state: "default" 0.0;
|
||||
fixed: 1 0;
|
||||
rel1.to: "elm.swallow.text_button";
|
||||
rel2.to: "elm.swallow.text_button";
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,15 +260,18 @@ _drag_cb(void *data,
|
|||
{
|
||||
double pos = 0.0, delta;
|
||||
Evas_Object *obj = data;
|
||||
const char *style;
|
||||
|
||||
ELM_SPINNER_DATA_GET(obj, sd);
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (sd->entry_visible) return;
|
||||
|
||||
style = elm_widget_style_get(obj);
|
||||
|
||||
if (sd->button_layout)
|
||||
{
|
||||
if (!strncmp(elm_widget_style_get(obj), "vertical", 8))
|
||||
if (!strncmp(style, "vertical", 8))
|
||||
eo_do((Eo *)wd->resize_obj,
|
||||
edje_obj_part_drag_value_get("elm.dragable.slider", NULL, &pos));
|
||||
else
|
||||
|
@ -288,6 +291,9 @@ _drag_cb(void *data,
|
|||
delta = sd->drag_val_step * sd->step * _elm_config->scale;
|
||||
if (pos < sd->drag_prev_pos) delta *= -1;
|
||||
sd->drag_prev_pos = pos;
|
||||
|
||||
/* Dragable is inverse of spinner value */
|
||||
if (!strncmp(style, "vertical", 8)) delta *= -1;
|
||||
/* If we are on rtl mode, change the delta to be negative on such changes */
|
||||
if (elm_widget_mirrored_get(obj)) delta *= -1;
|
||||
if (_value_set(data, sd->val + delta)) _label_write(data);
|
||||
|
|
Loading…
Reference in New Issue