Skip to content

Commit 8d841d3

Browse files
committed
Put an upper limit on the temperature graph bar widths.
1 parent f054d66 commit 8d841d3

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Graph Views/XRGTemperatureView.m

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,29 @@ - (void)drawGraph {
302302
float min = 0;
303303
float max = [[XRGTemperatureMiner shared] maxSpeedForFan:sensor];
304304

305-
CGContextFillRect(gc.CGContext, CGRectMake(barRect.origin.x, barRect.origin.y, MAX(1, ((locationValue - min) / (max - min)) * barRect.size.width), (i == 0) ? barRect.size.height : floor(barRect.size.height - 1)));
305+
CGContextFillRect(
306+
gc.CGContext,
307+
CGRectMake(
308+
barRect.origin.x,
309+
barRect.origin.y,
310+
MIN(MAX(1, ((locationValue - min) / (max - min)) * barRect.size.width), barRect.size.width),
311+
(i == 0) ? barRect.size.height : floor(barRect.size.height - 1)
312+
)
313+
);
306314
}
307315
else {
308316
float min = temperatureMin;
309317
float max = temperatureMax;
310318

311-
CGContextFillRect(gc.CGContext, CGRectMake(barRect.origin.x, barRect.origin.y, MAX(1, ((locationValue - min) / (max - min)) * barRect.size.width), (i == 0) ? barRect.size.height : floor(barRect.size.height - 1)));
319+
CGContextFillRect(
320+
gc.CGContext,
321+
CGRectMake(
322+
barRect.origin.x,
323+
barRect.origin.y,
324+
MIN(MAX(1, ((locationValue - min) / (max - min)) * barRect.size.width), barRect.size.width),
325+
(i == 0) ? barRect.size.height : floor(barRect.size.height - 1)
326+
)
327+
);
312328
}
313329

314330
[[appSettings borderColor] set];

0 commit comments

Comments
 (0)