Compare commits

..

No commits in common. "3bdff50f4dd1db0d588615eda8b9d81914093f74" and "89c7295abb64b9f1fdda52d38e8cde530a0eb823" have entirely different histories.

3 changed files with 21 additions and 21 deletions

View File

@ -657,9 +657,16 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
this.renderBackground(graphics, mouseX, mouseY, partialTick) this.renderBackground(graphics, mouseX, mouseY, partialTick)
super.hoveredSlot = null super.hoveredSlot = null
var hovered = false var hovered = false
panels.forEach { hovered = it.tickHovered0(mouseXf, mouseYf, hovered) }
for (panel in panels) {
if (hovered) {
panel.unsetHovered()
} else if (panel.tickHovered0(mouseXf, mouseYf)) {
hovered = true
}
}
panels.forEach { it.tickHovered1() } panels.forEach { it.tickHovered1() }
panels.forEach { it.tickHovered2() } panels.forEach { it.tickHovered2() }

View File

@ -1006,16 +1006,9 @@ open class EditablePanel<out S : Screen>(
/** /**
* Determining whenever panel is hovered or not * Determining whenever panel is hovered or not
*/ */
fun tickHovered0(mouseX: Float, mouseY: Float, somethingElseHovered: Boolean): Boolean { fun tickHovered0(mouseX: Float, mouseY: Float): Boolean {
if (isRemoved) if (isRemoved)
return somethingElseHovered return false
else if (somethingElseHovered) {
if (parent == null)
updateAbsolutePosition()
unsetHovered()
return true
}
val potentiallyHovered: Boolean val potentiallyHovered: Boolean
@ -1032,7 +1025,14 @@ open class EditablePanel<out S : Screen>(
if (potentiallyHovered) { if (potentiallyHovered) {
var hit = false var hit = false
visibleChildrenInternal.forEach { hit = it.tickHovered0(mouseX, mouseY, hit) }
for (child in visibleChildrenInternal) {
if (hit) {
child.unsetHovered()
} else if (child.tickHovered0(mouseX, mouseY)) {
hit = true
}
}
pendingIsHovered = pendingIsHovered =
!hit && !hit &&
@ -1404,14 +1404,7 @@ open class EditablePanel<out S : Screen>(
for (child in visibleChildrenInternal) { for (child in visibleChildrenInternal) {
when (child.dock) { when (child.dock) {
Dock.NONE -> { Dock.NONE, Dock.FILL -> {} // do nothing
width = maxOf(width, child.x + child.width)
height = maxOf(height, child.y + child.height)
}
Dock.FILL -> {
throw RuntimeException()
} // do nothing
Dock.LEFT, Dock.RIGHT -> { Dock.LEFT, Dock.RIGHT -> {
if (previousDock != 1) { if (previousDock != 1) {

View File

@ -22,7 +22,7 @@ class Panel2Widget<out S: Screen, out P : EditablePanel<S>>(
val wrap = MGUIGraphics(graphics) val wrap = MGUIGraphics(graphics)
panel.tickHovered0(xFloat, yFloat, false) panel.tickHovered0(xFloat, yFloat)
panel.tickHovered1() panel.tickHovered1()
panel.tickHovered2() panel.tickHovered2()
panel.render(wrap, xFloat, yFloat, partialTick) panel.render(wrap, xFloat, yFloat, partialTick)