From 2ede293f10cdbf9267f48823930950d31be83767 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 27 Jan 2009 08:24:56 -0800 Subject: [PATCH] Fix pixel snapping for minor ticks It's a tiny tweak to the axis-expansion code to get it to think about minor ticks as well as major ticks. --- acre.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acre.c b/acre.c index 6cd3a0b..8ba639e 100644 --- a/acre.c +++ b/acre.c @@ -164,6 +164,7 @@ acre_add_data (acre_t *acre, acre_data_t *data) #define ACRE_PAD (ACRE_FONT_SIZE) #define ACRE_TICK_MAJOR_SIZE 6 #define ACRE_TICK_MINOR_SIZE 3 +#define ACRE_TICK_MINOR_DIVISIONS 5 #define ACRE_X_TICK_VALUE_PAD 2 #define ACRE_Y_TICK_VALUE_PAD 4 @@ -378,7 +379,7 @@ _expand_range_for_width (double *axis_min, double *axis_max, int pixel_size) range = *axis_max - *axis_min; step = _step_for_range (range); - pixel_step = step * pixel_size / range; + pixel_step = step * pixel_size / range / ACRE_TICK_MINOR_DIVISIONS; /* We expand the range by the ratio of the pixel step to the floor * of the pixel_step. @@ -512,14 +513,13 @@ _draw_ticks (acre_t *acre, { cairo_t *cr = acre->cr; double t, step, sub_step; - int minor_divisions = 5; cairo_save (cr); _set_transform_to_data_space (acre); step = _step_for_range (axis_max - axis_min); - sub_step = step / minor_divisions; + sub_step = step / ACRE_TICK_MINOR_DIVISIONS; for (t = (floor (axis_min / sub_step) + 1) * sub_step; t <= axis_max; -- 2.43.0