mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
group related fixes
This commit is contained in:
parent
2ebb68af96
commit
5ef87d7359
@ -247,6 +247,11 @@ void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points)
|
||||
*/
|
||||
void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point)
|
||||
{
|
||||
if(indev == NULL) {
|
||||
point->x = 0;
|
||||
point->y = 0;
|
||||
return;
|
||||
}
|
||||
if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) {
|
||||
point->x = -1;
|
||||
point->y = -1;
|
||||
@ -488,6 +493,14 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
}
|
||||
/*Pressing*/
|
||||
else if(data->state == LV_INDEV_STATE_PR && prev_state == LV_INDEV_STATE_PR) {
|
||||
|
||||
if(data->key == LV_KEY_ENTER) {
|
||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSING, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_PRESSING, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
|
||||
/*Long press time has elapsed?*/
|
||||
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) {
|
||||
i->proc.long_pr_sent = 1;
|
||||
|
@ -3749,6 +3749,12 @@ static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv
|
||||
tr_prev = lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
|
||||
if(tr->obj == obj && (part == tr->part || part == 0xFF) && (prop == tr->prop || prop == 0xFF)) {
|
||||
/* Remove the transitioned property from trans. style
|
||||
* to allow changing it by normal styles*/
|
||||
lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part);
|
||||
lv_style_t * style_trans = lv_style_list_get_transition_style(list);
|
||||
lv_style_remove_prop(style_trans, tr->prop);
|
||||
|
||||
lv_anim_del(tr, NULL);
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
@ -3796,15 +3802,9 @@ static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v)
|
||||
static void trans_anim_start_cb(lv_anim_t * a)
|
||||
{
|
||||
lv_style_trans_t * tr = a->var;
|
||||
|
||||
lv_style_property_t prop_tmp = tr->prop;
|
||||
|
||||
/*Init prop to an invalid values to be sure `trans_del` won't delete the just added `tr`*/
|
||||
tr->prop = 0;
|
||||
/*Delete the relate transition if any*/
|
||||
trans_del(tr->obj, tr->part, prop_tmp, tr);
|
||||
|
||||
tr->prop = prop_tmp;
|
||||
|
||||
/*Start the animation from the current value*/
|
||||
if((prop_tmp & 0xF) < LV_STYLE_ID_COLOR) { /*Int*/
|
||||
tr->start_value._int = _lv_obj_get_style_int(tr->obj, tr->part, prop_tmp);
|
||||
@ -3818,11 +3818,20 @@ static void trans_anim_start_cb(lv_anim_t * a)
|
||||
else { /*Ptr*/
|
||||
tr->start_value._ptr = _lv_obj_get_style_ptr(tr->obj, tr->part, prop_tmp);
|
||||
}
|
||||
|
||||
/*Init prop to an invalid values to be sure `trans_del` won't delete this added `tr`*/
|
||||
tr->prop = 0;
|
||||
/*Delete the relate transition if any*/
|
||||
trans_del(tr->obj, tr->part, prop_tmp, tr);
|
||||
|
||||
tr->prop = prop_tmp;
|
||||
|
||||
}
|
||||
|
||||
static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
{
|
||||
lv_style_trans_t * tr = a->var;
|
||||
|
||||
/* Remove the transitioned property from trans. style
|
||||
* to allow changing it by normal styles*/
|
||||
lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part);
|
||||
|
@ -488,7 +488,7 @@ static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area)
|
||||
anim_cur_value_x = (((anim_cur_value_end_x - anim_cur_value_start_x) * ext->cur_value_anim.anim_state) /
|
||||
LV_BAR_ANIM_STATE_END);
|
||||
|
||||
if(anim_cur_value_end_x < anim_cur_value_start_x)
|
||||
// if(anim_cur_value_end_x < anim_cur_value_start_x)
|
||||
anim_cur_value_x += anim_cur_value_start_x;
|
||||
}
|
||||
else
|
||||
|
@ -829,9 +829,13 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSING) {
|
||||
uint16_t btn_pr;
|
||||
uint16_t btn_pr = LV_BTNMATRIX_BTN_NONE;
|
||||
/*Search the pressed area*/
|
||||
lv_indev_get_point(param, &p);
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(indev);
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) return LV_RES_OK;
|
||||
|
||||
lv_indev_get_point(indev, &p);
|
||||
btn_pr = get_button_from_point(btnm, &p);
|
||||
/*Invalidate to old and the new areas*/
|
||||
if(btn_pr != ext->btn_id_pr) {
|
||||
|
@ -483,14 +483,18 @@ static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask)
|
||||
uint16_t i;
|
||||
lv_coord_t cir_w = lv_obj_get_style_scale_width(cpicker, LV_CPICKER_PART_MAIN);
|
||||
|
||||
/* The inner line ends will be masked out.
|
||||
* So make lines a little bit longer because the masking makes a more even result */
|
||||
lv_coord_t cir_w_extra = cir_w + line_dsc.width;
|
||||
|
||||
for(i = 0; i <= 360; i += LV_CPICKER_DEF_QF) {
|
||||
line_dsc.color = angle_to_mode_color(cpicker, i);
|
||||
|
||||
lv_point_t p[2];
|
||||
p[0].x = cx + (r * lv_trigo_sin(i) >> LV_TRIGO_SHIFT);
|
||||
p[0].y = cy + (r * lv_trigo_sin(i + 90) >> LV_TRIGO_SHIFT);
|
||||
p[1].x = cx + ((r - cir_w) * lv_trigo_sin(i) >> LV_TRIGO_SHIFT);
|
||||
p[1].y = cy + ((r - cir_w) * lv_trigo_sin(i + 90) >> LV_TRIGO_SHIFT);
|
||||
p[1].x = cx + ((r - cir_w_extra) * lv_trigo_sin(i) >> LV_TRIGO_SHIFT);
|
||||
p[1].y = cy + ((r - cir_w_extra) * lv_trigo_sin(i + 90) >> LV_TRIGO_SHIFT);
|
||||
|
||||
lv_draw_line(&p[0], &p[1], mask, &line_dsc);
|
||||
}
|
||||
@ -697,6 +701,7 @@ static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * p
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
|
||||
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||
lv_color_hsv_t hsv_cur;
|
||||
hsv_cur = ext->hsv;
|
||||
@ -718,7 +723,7 @@ static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * p
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
}
|
||||
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
|
||||
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
|
||||
lv_color_hsv_t hsv_cur;
|
||||
hsv_cur = ext->hsv;
|
||||
|
||||
@ -750,8 +755,15 @@ static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * p
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
if(indev == NULL) return res;
|
||||
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(indev);
|
||||
lv_point_t p;
|
||||
lv_indev_get_point(indev, &p);
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) {
|
||||
p.x = cpicker->coords.x1 + lv_obj_get_width(cpicker) / 2;
|
||||
p.y = cpicker->coords.y1 + lv_obj_get_height(cpicker) / 2;
|
||||
}
|
||||
else {
|
||||
lv_indev_get_point(indev, &p);
|
||||
}
|
||||
|
||||
if((LV_MATH_ABS(p.x - ext->last_press_point.x) > indev->driver.drag_limit / 2) ||
|
||||
(LV_MATH_ABS(p.y - ext->last_press_point.y) > indev->driver.drag_limit / 2)) {
|
||||
|
@ -106,7 +106,7 @@ lv_obj_t * lv_dropdown_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->page = NULL;
|
||||
ext->options = "Option 1\nOption 2\nOption 3";
|
||||
ext->options = NULL;
|
||||
ext->symbol = LV_SYMBOL_DOWN;
|
||||
ext->text = "Select";
|
||||
ext->static_txt = 1;
|
||||
@ -128,7 +128,7 @@ lv_obj_t * lv_dropdown_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Init the new drop down list drop down list*/
|
||||
if(copy == NULL) {
|
||||
|
||||
lv_dropdown_set_static_options(ddlist, "Option 1\nOption 2\nOption 3");
|
||||
lv_theme_apply(ddlist, LV_THEME_DROPDOWN);
|
||||
}
|
||||
/*Copy an existing drop down list*/
|
||||
|
@ -85,7 +85,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
ext->last_sel_btn = NULL;
|
||||
ext->last_sel_btn = NULL;
|
||||
#endif
|
||||
ext->act_sel_btn = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user