feat(scale): set tick drawing order (#6185)

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
Carlos Diaz
2024-06-20 14:07:39 -06:00
committed by GitHub
parent ec80fe49fa
commit acfe1ba0cd
5 changed files with 236 additions and 191 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

+13
View File
@@ -33,6 +33,19 @@ Set ranges
The minor and major range (values of each tick) are configured with :cpp:expr:`lv_scale_set_range(scale, minor_range, major_range)`.
Tick drawing order
------------------
You can set the drawing of the ticks on top of the main line with :cpp:expr:`lv_scale_set_draw_ticks_on_top(scale, true)`. The default
drawing order is below the main line.
This is a scale with the ticks being drawn below of the main line (default):
.. image:: /misc/scale_ticks_below.png
This is an scale with the ticks being drawn at the top of the main line:
.. image:: /misc/scale_ticks_on_top.png
Configure ticks
---------------
File diff suppressed because it is too large Load Diff
+8
View File
@@ -82,6 +82,7 @@ typedef struct {
uint32_t major_tick_every : 15;
uint32_t label_enabled : 1;
uint32_t post_draw : 1;
uint32_t draw_ticks_on_top : 1;
/* Round scale */
uint32_t angle_range;
int32_t rotation;
@@ -199,6 +200,13 @@ void lv_scale_set_text_src(lv_obj_t * obj, const char * txt_src[]);
*/
void lv_scale_set_post_draw(lv_obj_t * obj, bool en);
/**
* Draw the scale ticks on top of all parts
* @param obj pointer to a scale object
* @param en true: enable draw ticks on top of all parts
*/
void lv_scale_set_draw_ticks_on_top(lv_obj_t * obj, bool en);
/**
* Add a section to the given scale
* @param obj pointer to a scale object