feat(coords) support negative percentage, e.g. lv_pct(-50)

This commit is contained in:
Gabor Kiss-Vamosi
2021-04-28 13:55:29 +02:00
parent f7b42ac8b4
commit bed49e5e05
+4 -4
View File
@@ -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);