From cc974181557ba7d41fb352d88decacca6626ff24 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sat, 24 Jun 2023 22:23:57 +0200 Subject: [PATCH] Allow the cursor to not be within bounds when dragging boxes Signed-off-by: Username404 --- common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt b/common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt index c73bfa2..6106b10 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt @@ -20,7 +20,7 @@ object ClickGui: SnowyScreen() { override fun mouseDragged(d: Double, e: Double, i: Int, f: Double, g: Double): Boolean { if (i == GLFW.GLFW_MOUSE_BUTTON_LEFT) { components.forEach { - if (it.isWithinBounds(d, e) && !isDragging) { + if (it.isWithinBounds(d.minus(f), e.minus(g)) && !isDragging) { isDragging = true it.x = d.minus(f) + (d - (it.x + it.width)) it.y = e.minus(g) + (e - (it.y + it.height))