diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index e56fb4bc77..90b6138304 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -247,10 +247,10 @@ void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align #define LV_COORD_SET_SPEC(x) ((x) | _LV_COORD_TYPE_SPEC) /*Special coordinates*/ -#define LV_PCT(x) LV_COORD_SET_SPEC(x) -#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && _LV_COORD_PLAIN(x) <= 1000) ? true : false) -#define LV_COORD_GET_PCT(x) _LV_COORD_PLAIN(x) -#define LV_SIZE_CONTENT LV_COORD_SET_SPEC(1001) +#define LV_PCT(x) (x < 0 ? LV_COORD_SET_SPEC(1000 - (x)) : LV_COORD_SET_SPEC(x)) +#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && _LV_COORD_PLAIN(x) <= 2000) ? true : false) +#define LV_COORD_GET_PCT(x) (_LV_COORD_PLAIN(x) > 1000 ? 1000 - _LV_COORD_PLAIN(x) : _LV_COORD_PLAIN(x)) +#define LV_SIZE_CONTENT LV_COORD_SET_SPEC(2001) LV_EXPORT_CONST_INT(LV_SIZE_CONTENT);