Skip to content

Commit 3d9eb1f

Browse files
authored
Window: Fix incorrect logic in dragging code
These `if`s used to be early returns and were improperly inverted in c199a84. This is why our integration tests were no longer able to dismiss notifications by dragging them off-screen, because the tests were moving the mouse perfectly horizontally, so no drag event was ever emitted. GitHub: #165
1 parent f9c95e8 commit 3d9eb1f

File tree

1 file changed

+2
-2
lines changed
  • src/main/kotlin/gg/essential/elementa/components

1 file changed

+2
-2
lines changed

src/main/kotlin/gg/essential/elementa/components/Window.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,13 @@ class Window @JvmOverloads constructor(
334334
if (currentMouseButton != -1) {
335335
val (mouseX, mouseY) = getMousePosition()
336336
if (version >= ElementaVersion.v2) {
337-
if (prevDraggedMouseX != mouseX && prevDraggedMouseY != mouseY) {
337+
if (prevDraggedMouseX != mouseX || prevDraggedMouseY != mouseY) {
338338
prevDraggedMouseX = mouseX
339339
prevDraggedMouseY = mouseY
340340
dragMouse(mouseX, mouseY, currentMouseButton)
341341
}
342342
} else {
343-
if (prevDraggedMouseX != mouseX.toInt().toFloat() && prevDraggedMouseY != mouseY.toInt().toFloat()) {
343+
if (prevDraggedMouseX != mouseX.toInt().toFloat() || prevDraggedMouseY != mouseY.toInt().toFloat()) {
344344
prevDraggedMouseX = mouseX.toInt().toFloat()
345345
prevDraggedMouseY = mouseY.toInt().toFloat()
346346
@Suppress("DEPRECATION")

0 commit comments

Comments
 (0)