From 6df2c16cc92a5c999bd2c2747590c93c645f2ca6 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 22 Dec 2014 13:44:37 +0100 Subject: [PATCH] ActivityMonitor: allow legend to use full width... ...for the last item when an odd number of items is used in a graph. Fixes #7262. --- src/apps/activitymonitor/ActivityView.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/apps/activitymonitor/ActivityView.cpp b/src/apps/activitymonitor/ActivityView.cpp index 581ec17ac7..10cdc1c269 100644 --- a/src/apps/activitymonitor/ActivityView.cpp +++ b/src/apps/activitymonitor/ActivityView.cpp @@ -1271,9 +1271,11 @@ ActivityView::_LegendFrameAt(BRect frame, int32 index) const { int32 column = index & 1; int32 row = index / 2; - if (column == 0) - frame.right = frame.left + floorf(frame.Width() / 2) - 5; - else + if (column == 0) { + // The last item, if it is on the first column, can use the full width. + if (index < fSources.CountItems() - 1) + frame.right = frame.left + floorf(frame.Width() / 2) - 5; + } else frame.left = frame.right - floorf(frame.Width() / 2) + 5; BAutolock _(fSourcesLock);