Skip to content

Commit db5a56d

Browse files
committed
Add mouseMoved passthrough for guiSpellcasting (fix #21)
1 parent daa565e commit db5a56d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Common/src/main/kotlin/gay/object/hexdebug/gui/splicing/SplicingTableScreen.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,13 @@ class SplicingTableScreen(
489489
return super.mouseClicked(mouseX, mouseY, button)
490490
}
491491

492+
override fun mouseMoved(mouseX: Double, mouseY: Double) {
493+
if (hasStaffItem && isInStaffGrid(mouseX, mouseY, button = null)) {
494+
guiSpellcasting.mouseMoved(mouseX, mouseY)
495+
}
496+
super.mouseMoved(mouseX, mouseY)
497+
}
498+
492499
override fun mouseDragged(mouseX: Double, mouseY: Double, button: Int, dragX: Double, dragY: Double): Boolean {
493500
if (hasStaffItem && isInStaffGrid(mouseX, mouseY, button)) {
494501
guiSpellcasting.mouseDragged(mouseX, mouseY, button, dragX, dragY)
@@ -511,10 +518,10 @@ class SplicingTableScreen(
511518
super.onClose()
512519
}
513520

514-
private fun isInStaffGrid(mouseX: Double, mouseY: Double, button: Int) =
521+
private fun isInStaffGrid(mouseX: Double, mouseY: Double, button: Int?) =
515522
staffMinX <= mouseX && mouseX <= staffMaxX && staffMinY <= mouseY && mouseY <= staffMaxY
516523
// avoid interacting with the grid when inserting the staff item...
517-
&& hasClickedOutside(mouseX, mouseY, leftPos, topPos, button)
524+
&& (button == null || hasClickedOutside(mouseX, mouseY, leftPos, topPos, button))
518525
// or when clicking the clear grid button
519526
&& !(clearGridButton?.testHitbox(mouseX, mouseY) ?: false)
520527

0 commit comments

Comments
 (0)