Skip to content

Commit c5b74af

Browse files
committed
Fix issue where day background was drawn incorrectly if minHour was set
1 parent 6e967d0 commit c5b74af

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/main/java/com/alamkanak/weekview/DayBackgroundDrawer.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ internal class DayBackgroundDrawer(
7171
canvas: Canvas
7272
) {
7373
val now = now()
74-
val beforeNow = (now.hour + now.minute / MINUTES_PER_HOUR) * config.hourHeight
74+
val hour = now.hour - config.minHour
75+
val hourFraction = now.minute / MINUTES_PER_HOUR
76+
77+
val beforeNow = (hour + hourFraction) * config.hourHeight
7578
canvas.drawRect(startX, startY, endX, startY + beforeNow, pastPaint)
7679
canvas.drawRect(startX, startY + beforeNow, endX, height, futurePaint)
7780
}

0 commit comments

Comments
 (0)