From df4f308005528111f8417c03efe95f1c2cee36bd Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Wed, 10 Jan 2024 20:05:21 +0100 Subject: Add crash recovery page to PV --- .../kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin') diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt index d44b7721..1882dac4 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt @@ -31,6 +31,12 @@ data class Rectangle( val x: Int, val y: Int, val width: Int, val height: Int, ) { + val centerX: Int + get() = x + width / 2 + val centerY: Int + get() = y + height / 2 + + /** * The left edge of this rectangle (Low X) */ @@ -69,7 +75,7 @@ data class Rectangle( /** * Check if this rectangle contains the given coordinate */ - fun contains(x1: Int, y1: Int) :Boolean{ + fun contains(x1: Int, y1: Int): Boolean { return left <= x1 && x1 < left + width && top <= y1 && y1 < top + height } } -- cgit