1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

add lv_obj_finish_transitions

This commit is contained in:
Gabor Kiss-Vamosi 2020-02-25 10:47:30 +01:00
parent 963140fd74
commit cb4fee4197
2 changed files with 29 additions and 3 deletions

View File

@ -1603,6 +1603,27 @@ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state)
lv_obj_set_state(obj, new_state);
}
}
/**
* Finish all pending transitions on a part of an object
* @param obj pointer to an object
* @param part part of the object, e.g `LV_BRN_PART_MAIN` or `LV_OBJ_PART_ALL` for all parts
*/
void lv_obj_finish_transitions(lv_obj_t * obj, uint8_t part)
{
/*Animate all related transition to the end value*/
lv_style_trans_t * tr;
tr = lv_ll_get_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
LV_LL_READ(LV_GC_ROOT(_lv_obj_style_trans_ll), tr) {
if(tr->obj == obj && (part == tr->part || part == LV_OBJ_PART_ALL)) {
trans_anim_cb(tr, 255);
}
}
/*Free all related transition data*/
trans_del(obj, part, 0xFF);
}
/**
* Set a an event handler function for an object.
* Used by the user to react on event which happens with the object.

View File

@ -252,7 +252,7 @@ enum {
LV_OBJ_PART_MAIN,
_LV_OBJ_PART_VIRTUAL_LAST = 0x01,
_LV_OBJ_PART_REAL_LAST = 0x40,
_LV_OBJ_PART_ALL = 0xFF,
LV_OBJ_PART_ALL = 0xFF,
};
typedef uint8_t lv_obj_part_t;
@ -716,6 +716,13 @@ void lv_obj_add_state(lv_obj_t * obj, lv_state_t state);
*/
void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state);
/**
* Finish all pending transitions on a part of an object
* @param obj pointer to an object
* @param part part of the object, e.g `LV_BRN_PART_MAIN` or `LV_OBJ_PART_ALL` for all parts
*/
void lv_obj_finish_transitions(lv_obj_t * obj, uint8_t part);
/**
* Set a an event handler function for an object.
* Used by the user to react on event which happens with the object.
@ -1266,8 +1273,6 @@ bool lv_obj_is_focused(const lv_obj_t * obj);
*/
lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name);
/**
* Initialize a rectangle descriptor from an object's styles
* @param obj pointer to an object