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:
parent
21acec50cd
commit
cc97418155
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue