Allow the cursor to not be within bounds when dragging boxes

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2023-06-24 22:23:57 +02:00
parent 21acec50cd
commit cc97418155
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ object ClickGui: SnowyScreen() {
override fun mouseDragged(d: Double, e: Double, i: Int, f: Double, g: Double): Boolean { override fun mouseDragged(d: Double, e: Double, i: Int, f: Double, g: Double): Boolean {
if (i == GLFW.GLFW_MOUSE_BUTTON_LEFT) { if (i == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
components.forEach { components.forEach {
if (it.isWithinBounds(d, e) && !isDragging) { if (it.isWithinBounds(d.minus(f), e.minus(g)) && !isDragging) {
isDragging = true isDragging = true
it.x = d.minus(f) + (d - (it.x + it.width)) it.x = d.minus(f) + (d - (it.x + it.width))
it.y = e.minus(g) + (e - (it.y + it.height)) it.y = e.minus(g) + (e - (it.y + it.height))