Hi there, I need to set the gap for the labels on a round lv_scale object. I’ve read through the docs and I can’t see how to do it.
In v8, the function for the major ticks had a parameter label_gap
:
lv_meter_set_scale_major_ticks(lv_obj_t *obj, lv_meter_scale_t *scale, uint16_t nth, uint16_t width, uint16_t len, lv_color_t color, int16_t label_gap)
But I can’t see something similar for the lv_scale. Can someone illuminate me? Is there a style property I can use?
Thanks,
Tim
I had a look in the code and it looks like it’s not implemented in styles yet (v9.1). See the todo here:
/* Find the center of the scale */
lv_point_t center_point;
int32_t radius_edge = LV_MIN(lv_area_get_width(&scale_area) / 2U, lv_area_get_height(&scale_area) / 2U);
center_point.x = scale_area.x1 + radius_edge;
center_point.y = scale_area.y1 + radius_edge;
/* Major tick */
major_tick_dsc.raw_end = 0;
uint32_t label_gap = LV_SCALE_DEFAULT_LABEL_GAP; /* TODO: Add to style properties */
uint32_t tick_idx = 0;
uint32_t major_tick_idx = 0;
for(tick_idx = 0; tick_idx < scale->total_tick_count; tick_idx++) {
/* A major tick is the one which has a label in it */
bool is_major_tick = false;
if(tick_idx % scale->major_tick_every == 0) is_major_tick = true;
if(is_major_tick) major_tick_idx++;
const int32_t tick_value = lv_map(tick_idx, 0U, scale->total_tick_count - 1, scale->range_min, scale->range_max);
Not sure if there’s any way to set this at the moment.