mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-27 11:43:43 +08:00
anim path reworked + minor changes
This commit is contained in:
parent
7dad802981
commit
f242eba9c1
@ -74,7 +74,7 @@ lv_indev_t * lv_indev_get_act(void)
|
||||
|
||||
/**
|
||||
* Reset one or all input devices
|
||||
* @param indev
|
||||
* @param indev pointer to an input device to reset or NULL to reset all of them
|
||||
*/
|
||||
void lv_indev_reset(lv_indev_t * indev)
|
||||
{
|
||||
@ -90,13 +90,13 @@ void lv_indev_reset(lv_indev_t * indev)
|
||||
|
||||
/**
|
||||
* Reset the long press state of an input device
|
||||
* @param indev_proc pointer to an input device
|
||||
* @param indev pointer to an input device
|
||||
*/
|
||||
void lv_indev_reset_lpr(lv_indev_t * indev_proc)
|
||||
void lv_indev_reset_lpr(lv_indev_t * indev)
|
||||
{
|
||||
indev_proc->proc.long_pr_sent = 0;
|
||||
indev_proc->proc.longpr_rep_timestamp = lv_tick_get();
|
||||
indev_proc->proc.pr_timestamp = lv_tick_get();
|
||||
indev->proc.long_pr_sent = 0;
|
||||
indev->proc.longpr_rep_timestamp = lv_tick_get();
|
||||
indev->proc.pr_timestamp = lv_tick_get();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,8 +115,8 @@ void lv_indev_enable(lv_hal_indev_type_t type, bool enable)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a cursor for a mouse input device
|
||||
* @param indev pointer to an input device (type: 'LV_INDEV_TYPE_MOUSE')
|
||||
* Set a cursor for a pointer input device
|
||||
* @param indev pointer to an input device (type: 'LV_INDEV_TYPE_POINTER')
|
||||
* @param cur_obj pointer to an object to be used as cursor
|
||||
*/
|
||||
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)
|
||||
|
@ -42,7 +42,7 @@ lv_indev_t * lv_indev_get_act(void);
|
||||
|
||||
/**
|
||||
* Reset one or all input devices
|
||||
* @param indev
|
||||
* @param indev pointer to an input device to reset or NULL to reset all of them
|
||||
*/
|
||||
void lv_indev_reset(lv_indev_t * indev);
|
||||
|
||||
@ -50,7 +50,7 @@ void lv_indev_reset(lv_indev_t * indev);
|
||||
* Reset the long press state of an input device
|
||||
* @param indev_proc pointer to an input device
|
||||
*/
|
||||
void lv_indev_reset_lpr(lv_indev_t * indev_proc);
|
||||
void lv_indev_reset_lpr(lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Enable input devices device by type
|
||||
@ -60,8 +60,8 @@ void lv_indev_reset_lpr(lv_indev_t * indev_proc);
|
||||
void lv_indev_enable(lv_hal_indev_type_t type, bool enable);
|
||||
|
||||
/**
|
||||
* Set a cursor for a mouse input device
|
||||
* @param indev pointer to an input device (type: 'LV_INDEV_TYPE_MOUSE')
|
||||
* Set a cursor for a pointer input device
|
||||
* @param indev pointer to an input device (type: 'LV_INDEV_TYPE_POINTER')
|
||||
* @param cur_obj pointer to an object to be used as cursor
|
||||
*/
|
||||
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj);
|
||||
|
@ -729,7 +729,7 @@ void lv_obj_refresh_style(lv_obj_t * obj)
|
||||
* @param style pointer to a style. Only the objects with this style will be notified
|
||||
* (NULL to notify all objects)
|
||||
*/
|
||||
void lv_obj_report_style_mod(void * style)
|
||||
void lv_obj_report_style_mod(lv_style_t * style)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
LL_READ(scr_ll, i) {
|
||||
@ -927,7 +927,7 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1
|
||||
a.time = time;
|
||||
a.act_time = (int32_t)-delay;
|
||||
a.end_cb = (void(*)(void*))cb;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.playback_pause = 0;
|
||||
a.repeat_pause = 0;
|
||||
a.playback = 0;
|
||||
|
@ -332,7 +332,7 @@ void lv_obj_refresh_style(lv_obj_t * obj);
|
||||
* @param style pointer to a style. Only the objects with this style will be notified
|
||||
* (NULL to notify all objects)
|
||||
*/
|
||||
void lv_obj_report_style_mod(void * style);
|
||||
void lv_obj_report_style_mod(lv_style_t * style);
|
||||
|
||||
/*-----------------
|
||||
* Attribute set
|
||||
|
@ -133,7 +133,7 @@ void lv_style_init (void)
|
||||
|
||||
/*Pretty color style*/
|
||||
memcpy(&lv_style_pretty_color, &lv_style_pretty, sizeof(lv_style_t));
|
||||
lv_style_pretty_color.text.color = LV_COLOR_MAKE(0xd0, 0xd0, 0xd0);
|
||||
lv_style_pretty_color.text.color = LV_COLOR_MAKE(0xe0, 0xe0, 0xe0);
|
||||
lv_style_pretty_color.image.color = LV_COLOR_MAKE(0xe0, 0xe0, 0xe0);
|
||||
lv_style_pretty_color.line.color = LV_COLOR_MAKE(0xc0, 0xc0, 0xc0);
|
||||
lv_style_pretty_color.body.main_color = LV_COLOR_MAKE(0x6b, 0x9a, 0xc7);
|
||||
@ -236,7 +236,7 @@ void lv_style_anim_create(lv_style_anim_t * anim)
|
||||
a.start = 0;
|
||||
a.end = LV_STYLE_ANIM_RES;
|
||||
a.fp = (lv_anim_fp_t)style_animator;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = style_animation_common_end_cb;
|
||||
a.act_time = anim->act_time;
|
||||
a.time = anim->time;
|
||||
|
@ -111,7 +111,7 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_sty
|
||||
mask_aa.y2 = (mask->y2 << LV_AA) + 1;
|
||||
#endif
|
||||
|
||||
#if USE_LV_SHADOW
|
||||
#if USE_LV_SHADOW && LV_VDB_SIZE
|
||||
if(style->body.shadow.width != 0) {
|
||||
lv_draw_rect_shadow(&coord_aa, &mask_aa, style);
|
||||
}
|
||||
@ -1209,7 +1209,7 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_LV_SHADOW
|
||||
#if USE_LV_SHADOW && LV_VDB_SIZE
|
||||
|
||||
/**
|
||||
* Draw a shadow
|
||||
|
@ -44,7 +44,7 @@ static lv_indev_t *indev_list = NULL;
|
||||
*/
|
||||
void lv_indev_drv_init(lv_indev_drv_t *driver)
|
||||
{
|
||||
driver->read_fp = NULL;
|
||||
driver->read = NULL;
|
||||
driver->type = LV_INDEV_TYPE_NONE;
|
||||
}
|
||||
|
||||
@ -106,8 +106,8 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t *data)
|
||||
{
|
||||
bool cont = false;
|
||||
|
||||
if(indev->driver.read_fp) {
|
||||
cont = indev->driver.read_fp(data);
|
||||
if(indev->driver.read) {
|
||||
cont = indev->driver.read(data);
|
||||
} else {
|
||||
memset(data, 0, sizeof(lv_indev_data_t));
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ typedef struct {
|
||||
/*Initialized by the user and registered by 'lv_indev_add()'*/
|
||||
typedef struct {
|
||||
lv_hal_indev_type_t type; /*Input device type*/
|
||||
bool (*read_fp)(lv_indev_data_t *data); /*Function pointer to read data. Return 'true' if there is still data to be read (buffered)*/
|
||||
bool (*read)(lv_indev_data_t *data); /*Function pointer to read data. Return 'true' if there is still data to be read (buffered)*/
|
||||
}lv_indev_drv_t;
|
||||
|
||||
struct _lv_obj_t;
|
||||
|
@ -18,10 +18,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define ANIM_PATH_LENGTH 129 /*Elements in a path array*/
|
||||
#define ANIM_PATH_START 64 /*In path array a value which corresponds to the start position*/
|
||||
#define ANIM_PATH_END 192 /* ... to the end position. Not required, just for clearance.*/
|
||||
#define ANIM_PATH_NORM_SHIFT 7 /*ANIM_PATH_START - ANIM_PATH_END. Must be 2^N. The exponent goes here. */
|
||||
#define LV_ANIM_RESOLUTION 1024
|
||||
#define LV_ANIM_RES_SHIFT 10
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -40,18 +38,6 @@ static lv_ll_t anim_ll;
|
||||
static uint32_t last_task_run;
|
||||
static bool anim_del_global_flag = false;
|
||||
|
||||
static lv_anim_path_t anim_path_lin[] =
|
||||
{64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
|
||||
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192};
|
||||
|
||||
static lv_anim_path_t anim_path_step[] =
|
||||
{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 192,};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@ -141,24 +127,41 @@ uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a predefine animation path
|
||||
* @param name name of the path from 'anim_path_name_t'
|
||||
* @return pointer to the path array
|
||||
* Calculate the current value of an animation applying linear characteristic
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
lv_anim_path_t * lv_anim_get_path(lv_anim_path_name_t name)
|
||||
int32_t lv_anim_path_linear(const lv_anim_t *a)
|
||||
{
|
||||
switch (name) {
|
||||
case LV_ANIM_PATH_LIN:
|
||||
return anim_path_lin;
|
||||
break;
|
||||
case LV_ANIM_PATH_STEP:
|
||||
return anim_path_step;
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
/*Calculate the current step*/
|
||||
|
||||
uint16_t step;
|
||||
if(a->time == a->act_time) step = LV_ANIM_RESOLUTION; /*Use the last value id the time fully elapsed*/
|
||||
else step = (a->act_time * LV_ANIM_RESOLUTION) / a->time;
|
||||
|
||||
|
||||
/* Get the new value which will be proportional to the current element of 'path_p'
|
||||
* and the 'start' and 'end' values*/
|
||||
int32_t new_value;
|
||||
new_value = (int32_t) step * (a->end - a->start);
|
||||
new_value = new_value >> LV_ANIM_RES_SHIFT;
|
||||
new_value += a->start;
|
||||
|
||||
return new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation applying step characteristic.
|
||||
* (Set end value on the end of the animation)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_step(const lv_anim_t *a)
|
||||
{
|
||||
if(a->act_time >= a->time) return a->end;
|
||||
else return a->start;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@ -185,21 +188,10 @@ static void anim_task (void * param)
|
||||
if(a->act_time >= 0) {
|
||||
if(a->act_time > a->time) a->act_time = a->time;
|
||||
|
||||
/* Get the index of the path array based on the elapsed time*/
|
||||
uint8_t path_i;
|
||||
if(a->time == a->act_time) {
|
||||
path_i = ANIM_PATH_LENGTH - 1; /*Use the last value id the time fully elapsed*/
|
||||
} else {
|
||||
path_i = a->act_time * (ANIM_PATH_LENGTH - 1) / a->time;
|
||||
}
|
||||
/* Get the new value which will be proportional to the current element of 'path_p'
|
||||
* and the 'start' and 'end' values*/
|
||||
int32_t new_val;
|
||||
new_val = (int32_t)(a->path[path_i] - ANIM_PATH_START) * (a->end - a->start);
|
||||
new_val = new_val >> ANIM_PATH_NORM_SHIFT;
|
||||
new_val += a->start;
|
||||
int32_t new_value;
|
||||
new_value = a->path(a);
|
||||
|
||||
if(a->fp != NULL) a->fp(a->var, new_val); /*Apply the calculated value*/
|
||||
if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/
|
||||
|
||||
/*If the time is elapsed the animation is ready*/
|
||||
if(a->act_time >= a->time) {
|
||||
|
@ -28,23 +28,19 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_ANIM_PATH_LIN,
|
||||
LV_ANIM_PATH_STEP,
|
||||
}lv_anim_path_name_t;
|
||||
struct _lv_anim_t;
|
||||
|
||||
typedef uint8_t lv_anim_path_t;
|
||||
typedef int32_t(*lv_anim_path_t)(const struct _lv_anim_t*);
|
||||
|
||||
typedef void (*lv_anim_fp_t)(void *, int32_t);
|
||||
typedef void (*lv_anim_cb_t)(void *);
|
||||
|
||||
typedef struct
|
||||
typedef struct _lv_anim_t
|
||||
{
|
||||
void * var; /*Variable to animate*/
|
||||
lv_anim_fp_t fp; /*Animator function*/
|
||||
lv_anim_cb_t end_cb; /*Call it when the animation is ready*/
|
||||
lv_anim_path_t * path; /*An array with the steps of animations*/
|
||||
lv_anim_fp_t fp; /*Animator function*/
|
||||
lv_anim_cb_t end_cb; /*Call it when the animation is ready*/
|
||||
lv_anim_path_t path; /*An array with the steps of animations*/
|
||||
int32_t start; /*Start value*/
|
||||
int32_t end; /*End value*/
|
||||
int16_t time; /*Animation time in ms*/
|
||||
@ -63,7 +59,7 @@ a.var = obj;
|
||||
a.start = lv_obj_get_height(obj);
|
||||
a.end = new_height;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_height;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = 200;
|
||||
@ -106,12 +102,19 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp);
|
||||
uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end);
|
||||
|
||||
/**
|
||||
* Get a predefine animation path
|
||||
* @param name name of the path from 'anim_path_name_t'
|
||||
* @return pointer to the path array
|
||||
* Calculate the current value of an animation applying linear characteristic
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
lv_anim_path_t * lv_anim_get_path(lv_anim_path_name_t name);
|
||||
int32_t lv_anim_path_linear(const lv_anim_t *a);
|
||||
|
||||
/**
|
||||
* Calculate the current value of an animation applying step characteristic.
|
||||
* (Set end value on the end of the animation)
|
||||
* @param a pointer to an animation
|
||||
* @return the current value to set
|
||||
*/
|
||||
int32_t lv_anim_path_step(const lv_anim_t *a);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -262,7 +262,7 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
|
||||
}
|
||||
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){b8 >> 7 | g8 >> 7 | r8 >> 7})
|
||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(b8 >> 7 | g8 >> 7 | r8 >> 7)})
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 6, g8 >> 5, r8 >> 5}})
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
|
@ -28,7 +28,7 @@ extern "C" {
|
||||
#define SYMBOL_LIST "\xC0"
|
||||
#define SYMBOL_OK "\xC1"
|
||||
#define SYMBOL_CLOSE "\xC2"
|
||||
#define SYMBOL_POWER "\xC3"
|
||||
#define SYMBOL_POWER "\xC3"
|
||||
#define SYMBOL_SETTINGS "\xC4"
|
||||
#define SYMBOL_HOME "\xC5"
|
||||
#define SYMBOL_REFRESH "\xC6"
|
||||
|
@ -135,7 +135,7 @@ void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time)
|
||||
a.start = ext->cur_value;
|
||||
a.end = new_value;
|
||||
a.fp = (lv_anim_fp_t)lv_bar_set_value;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = anim_time;
|
||||
|
@ -613,7 +613,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time)
|
||||
a.start = lv_obj_get_height(ddlist);
|
||||
a.end = new_height;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_height;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = (lv_anim_cb_t)lv_ddlist_pos_current_option;
|
||||
a.act_time = 0;
|
||||
a.time = ext->anim_time;
|
||||
|
@ -744,7 +744,7 @@ static void lv_label_refr_text(lv_obj_t * label)
|
||||
anim.start = lv_font_get_width_scale(font, ' ');
|
||||
anim.act_time = 0;
|
||||
anim.end_cb = NULL;
|
||||
anim.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
anim.path = lv_anim_path_linear;
|
||||
anim.time = 3000;
|
||||
anim.playback_pause = (((lv_font_get_width_scale(style->text.font, ' ') + style->text.letter_space) * 1000) /ext->anim_speed)
|
||||
* ANIM_WAIT_CHAR_COUNT;
|
||||
@ -774,7 +774,7 @@ static void lv_label_refr_text(lv_obj_t * label)
|
||||
anim.start = lv_font_get_width_scale(font, ' ');
|
||||
anim.act_time = 0;
|
||||
anim.end_cb = NULL;
|
||||
anim.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
anim.path = lv_anim_path_linear;
|
||||
anim.playback_pause = (((lv_font_get_width_scale(style->text.font, ' ') + style->text.letter_space) * 1000) / ext->anim_speed) * ANIM_WAIT_CHAR_COUNT;;
|
||||
anim.repeat_pause = anim.playback_pause;
|
||||
|
||||
|
@ -387,7 +387,7 @@ void lv_list_up(lv_obj_t * list)
|
||||
a.start = lv_obj_get_y(scrl);
|
||||
a.end = new_y;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_y;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = LV_LIST_FOCUS_TIME;
|
||||
@ -430,7 +430,7 @@ void lv_list_down(lv_obj_t * list)
|
||||
a.start = lv_obj_get_y(scrl);
|
||||
a.end = new_y;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_y;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = LV_LIST_FOCUS_TIME;
|
||||
|
@ -323,7 +323,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
|
||||
a.playback = 0;
|
||||
a.repeat = 0;
|
||||
a.var = ext->scrl;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.fp = (lv_anim_fp_t) lv_obj_set_y;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
|
@ -435,7 +435,7 @@ static void refr_position(lv_obj_t *roller, bool anim_en)
|
||||
a.start = lv_obj_get_y(roller_scrl);
|
||||
a.end = new_y;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_y;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = ext->ddlist.anim_time;
|
||||
|
@ -420,14 +420,16 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
lv_style_t *knob_style = lv_slider_get_style(slider, LV_SLIDER_STYLE_KNOB);
|
||||
lv_coord_t shadow_w = knob_style->body.shadow.width;
|
||||
if(ext->knob_in == 0) {
|
||||
lv_coord_t x = LV_MATH_MIN(w / 2 + 1 + shadow_w, h / 2 + 1 + shadow_w); /*The smaller size is the knob diameter*/
|
||||
/* The smaller size is the knob diameter
|
||||
* +2 for the possible rounding error*/
|
||||
lv_coord_t x = LV_MATH_MIN(w / 2 + 2 + shadow_w, h / 2 + 2 + shadow_w);
|
||||
if(slider->ext_size < x) slider->ext_size = x;
|
||||
} else {
|
||||
lv_coord_t pad = LV_MATH_MIN(style->body.padding.hor, style->body.padding.ver);
|
||||
if(pad < 0) {
|
||||
pad = -pad;
|
||||
if(slider->ext_size < pad) slider->ext_size = pad;
|
||||
}
|
||||
if(pad < 0) pad = -pad;
|
||||
if(pad < 1) pad = 1; /*For possible rounding errors*/
|
||||
if(slider->ext_size < pad) slider->ext_size = pad;
|
||||
|
||||
if(slider->ext_size < shadow_w) slider->ext_size = shadow_w;
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
|
@ -73,10 +73,10 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t *th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_slider_set_style(new_sw, LV_SW_STYLE_BG, th->sw.bg);
|
||||
lv_slider_set_style(new_sw, LV_SW_STYLE_INDIC, th->sw.indic);
|
||||
lv_slider_set_style(new_sw, LV_SW_STYLE_KNOB_OFF, th->sw.knob_off);
|
||||
lv_slider_set_style(new_sw, LV_SW_STYLE_KNOB_ON, th->sw.knob_on);
|
||||
lv_sw_set_style(new_sw, LV_SW_STYLE_BG, th->sw.bg);
|
||||
lv_sw_set_style(new_sw, LV_SW_STYLE_INDIC, th->sw.indic);
|
||||
lv_sw_set_style(new_sw, LV_SW_STYLE_KNOB_OFF, th->sw.knob_off);
|
||||
lv_sw_set_style(new_sw, LV_SW_STYLE_KNOB_ON, th->sw.knob_on);
|
||||
} else {
|
||||
/*Let the slider' style*/
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
a.repeat_pause = 0;
|
||||
a.playback = 1;
|
||||
a.playback_pause = 0;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
|
||||
a.path = lv_anim_path_step;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
|
||||
@ -200,7 +200,7 @@ void lv_ta_add_char(lv_obj_t * ta, char c)
|
||||
a.repeat_pause = 0;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
|
||||
a.path = lv_anim_path_step;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
}
|
||||
@ -243,7 +243,7 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt)
|
||||
a.repeat_pause = 0;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
|
||||
a.path = lv_anim_path_step;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
}
|
||||
@ -329,7 +329,7 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
|
||||
a.repeat_pause = 0;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
|
||||
a.path = lv_anim_path_step;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
}
|
||||
@ -402,7 +402,7 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
a.repeat_pause = 0;
|
||||
a.playback = 1;
|
||||
a.playback_pause = 0;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
|
||||
a.path = lv_anim_path_step;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
|
||||
|
@ -185,7 +185,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
|
||||
lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(ext->content));
|
||||
lv_page_set_sb_mode(h, LV_SB_MODE_AUTO);
|
||||
lv_page_set_style(h, LV_PAGE_STYLE_BG, &lv_style_transp);
|
||||
lv_page_set_style(h, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);
|
||||
lv_page_set_style(h, LV_PAGE_STYLE_SCRL, &lv_style_transp);
|
||||
|
||||
if(page_signal == NULL) page_signal = lv_obj_get_signal_func(h);
|
||||
if(page_scrl_signal == NULL) page_scrl_signal = lv_obj_get_signal_func(lv_page_get_scrl(h));
|
||||
@ -255,7 +255,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
a.start = lv_obj_get_x(ext->content);
|
||||
a.end = cont_x;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_x;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = ext->anim_time;
|
||||
@ -281,7 +281,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
a.start = lv_obj_get_x(ext->indic);
|
||||
a.end = indic_x;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_x;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.path = lv_anim_path_linear;
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = ext->anim_time;
|
||||
|
@ -241,6 +241,7 @@ static void bar_init(void)
|
||||
bar_indic.body.padding.hor = 0;
|
||||
bar_indic.body.padding.ver = 0;
|
||||
bar_indic.body.shadow.width = LV_DPI / 20;
|
||||
bar_indic.body.shadow.color = lv_color_hsv_to_rgb(_hue, 20, 90);
|
||||
bar_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 80);
|
||||
bar_indic.body.grad_color = lv_color_hsv_to_rgb(_hue, 40, 80);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user