Fix cursor wars between panels when grabbing mouse input
This commit is contained in:
parent
70ec49e546
commit
c69781c22c
@ -672,6 +672,9 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
panel.render(wrap, mouseXf, mouseYf, partialTick)
|
panel.render(wrap, mouseXf, mouseYf, partialTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!panels.asReversed().any { it.updateCursor0() })
|
||||||
|
panels.asReversed().any { it.updateCursor1() }
|
||||||
|
|
||||||
RenderSystem.depthFunc(GL11.GL_LESS)
|
RenderSystem.depthFunc(GL11.GL_LESS)
|
||||||
MinecraftForge.EVENT_BUS.post(Background(this, graphics, mouseX, mouseY))
|
MinecraftForge.EVENT_BUS.post(Background(this, graphics, mouseX, mouseY))
|
||||||
RenderSystem.disableDepthTest()
|
RenderSystem.disableDepthTest()
|
||||||
|
@ -900,10 +900,24 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
if (scissor) {
|
if (scissor) {
|
||||||
popScissorRect()
|
popScissorRect()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHovered || grabMouseInput) {
|
|
||||||
cursorType.setTo()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateCursor0(): Boolean {
|
||||||
|
if (grabMouseInput) {
|
||||||
|
cursorType.setTo()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return children.any { it.updateCursor0() }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateCursor1(): Boolean {
|
||||||
|
if (isHovered) {
|
||||||
|
cursorType.setTo()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return children.any { it.updateCursor1() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateAbsolutePosition() {
|
fun updateAbsolutePosition() {
|
||||||
|
Loading…
Reference in New Issue
Block a user