diff --git a/widgets/graph.c b/widgets/graph.c index 3e659997..a28733b1 100644 --- a/widgets/graph.c +++ b/widgets/graph.c @@ -99,12 +99,14 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset, if(!widget->user_supplied_y) widget->area.y = 0; - margin_top = (int) ((widget->statusbar->height * (1 - d->height)) / 2 + 0.5 + widget->area.y); left_offset = widget->area.x + d->padding_left; + /* box = the graph inside the rectangle */ if(!(d->box_height)) d->box_height = (int) (widget->statusbar->height * d->height + 0.5) - 2; + margin_top = (int)((widget->statusbar->height - (d->box_height + 2)) / 2 + 0.5) + widget->area.y; + rectangle.x = left_offset; rectangle.y = margin_top; rectangle.width = d->size + 2; diff --git a/widgets/progressbar.c b/widgets/progressbar.c index 56b01096..793514ad 100644 --- a/widgets/progressbar.c +++ b/widgets/progressbar.c @@ -75,15 +75,15 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, d->width, offset, widget->alignment); - if(!widget->user_supplied_y) widget->area.y = 0; + /* TODO: maybe prevent (use Data-values) to calculate that stuff below over and over again */ /* data for the first rectangle (data-bar) to draw */ if(d->vertical) { pb_width = (int) ((d->width - d->padding - (d->gap * (d->data_items - 1))) / d->data_items + 0.5); - pb_height = (int) (widget->statusbar->height * d->height); + pb_height = (int) (widget->statusbar->height * d->height + 0.5); pb_y = widget->area.y + (int)((widget->statusbar->height - pb_height) / 2 + 0.5); } else /* horizontal */