Fix binding android wheel to mouse button breaking everything
This commit is contained in:
parent
743f9b64f1
commit
d32cffe86b
@ -45,6 +45,20 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
||||
|
||||
private var clickOnce = false
|
||||
|
||||
private fun resetState() {
|
||||
selectedFeature = null
|
||||
lastSelectedFeature = null
|
||||
lastSelectedDegree = null
|
||||
lastSelectProgress.clear()
|
||||
clickOnce = false
|
||||
holdIt = null
|
||||
}
|
||||
|
||||
private fun ohNoIHaveHitSomethingNastyInMinecraftCode() {
|
||||
grabbedInput = false
|
||||
resetState()
|
||||
}
|
||||
|
||||
override fun setDown(isDown: Boolean) {
|
||||
val old = this.isDown
|
||||
super.setDown(isDown)
|
||||
@ -77,17 +91,24 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
||||
}
|
||||
}
|
||||
|
||||
selectedFeature = null
|
||||
lastSelectedFeature = null
|
||||
lastSelectedDegree = null
|
||||
lastSelectProgress.clear()
|
||||
clickOnce = false
|
||||
holdIt = null
|
||||
resetState()
|
||||
}
|
||||
}
|
||||
|
||||
fun onMouseClick(event: InputEvent.MouseButton.Pre) {
|
||||
// fix binding wheel menu to mouse button not calling back setIsDown(false)
|
||||
if (isDown && event.action == 0 && key.type == InputConstants.Type.MOUSE && InputConstants.Type.MOUSE.getOrCreate(event.button) == key) {
|
||||
isDown = false
|
||||
return
|
||||
}
|
||||
|
||||
if (grabbedInput) {
|
||||
if (minecraft.screen != null) {
|
||||
// whoopsie
|
||||
ohNoIHaveHitSomethingNastyInMinecraftCode()
|
||||
return
|
||||
}
|
||||
|
||||
clickOnce = true
|
||||
event.isCanceled = true
|
||||
|
||||
@ -298,7 +319,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
||||
renderWheel(event)
|
||||
|
||||
if (minecraft.screen != null) {
|
||||
isDown = false
|
||||
ohNoIHaveHitSomethingNastyInMinecraftCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user