Opening pattern or task frames now block inputs to main panel

This commit is contained in:
DBotThePony 2023-03-08 17:05:40 +07:00
parent c4b36d497f
commit b37df1c347
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -172,9 +172,13 @@ class MatterPanelScreen(
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean { override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
if (isPatternView) { if (isPatternView) {
if (minecraft?.player?.isSpectator != true) if (minecraft?.player?.isSpectator != true)
menu.patternsFiltered.getOrNull(index)?.let(this@MatterPanelScreen::openPattern) menu.patternsFiltered.getOrNull(index)?.let(this@MatterPanelScreen::openPattern)?.let {
frame.blockingWindow = it
}
} else { } else {
menu.tasksFiltered.getOrNull(index)?.let(this@MatterPanelScreen::openTask) menu.tasksFiltered.getOrNull(index)?.let(this@MatterPanelScreen::openTask)?.let {
frame.blockingWindow = it
}
} }
return true return true
@ -190,7 +194,7 @@ class MatterPanelScreen(
return frame return frame
} }
private fun openTask(task: IReplicationTask<*>) { private fun openTask(task: IReplicationTask<*>): FramePanel<MatterPanelScreen> {
val frame = FramePanel.padded(this, null, 170f, 20f, TranslatableComponent("otm.gui.matter_panel.task")) val frame = FramePanel.padded(this, null, 170f, 20f, TranslatableComponent("otm.gui.matter_panel.task"))
frame.closeOnEscape = true frame.closeOnEscape = true
@ -232,9 +236,11 @@ class MatterPanelScreen(
popup(frame) popup(frame)
frame.toScreenCenter() frame.toScreenCenter()
return frame
} }
private fun openPattern(pattern: IPatternState) { private fun openPattern(pattern: IPatternState): FramePanel<MatterPanelScreen> {
val frame = FramePanel.padded(this, null, 213f, (ButtonPanel.HEIGHT + 3f) * 4f + 38f, TranslatableComponent("otm.gui.matter_panel.task")) val frame = FramePanel.padded(this, null, 213f, (ButtonPanel.HEIGHT + 3f) * 4f + 38f, TranslatableComponent("otm.gui.matter_panel.task"))
frame.closeOnEscape = true frame.closeOnEscape = true
@ -418,6 +424,8 @@ class MatterPanelScreen(
} }
frame.toScreenCenter() frame.toScreenCenter()
return frame
} }
companion object { companion object {