Compare commits
2 Commits
89c7295abb
...
3bdff50f4d
Author | SHA1 | Date | |
---|---|---|---|
3bdff50f4d | |||
dd3a08f47d |
@ -657,16 +657,9 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
||||
this.renderBackground(graphics, mouseX, mouseY, partialTick)
|
||||
|
||||
super.hoveredSlot = null
|
||||
|
||||
var hovered = false
|
||||
|
||||
for (panel in panels) {
|
||||
if (hovered) {
|
||||
panel.unsetHovered()
|
||||
} else if (panel.tickHovered0(mouseXf, mouseYf)) {
|
||||
hovered = true
|
||||
}
|
||||
}
|
||||
|
||||
panels.forEach { hovered = it.tickHovered0(mouseXf, mouseYf, hovered) }
|
||||
panels.forEach { it.tickHovered1() }
|
||||
panels.forEach { it.tickHovered2() }
|
||||
|
||||
|
@ -1006,9 +1006,16 @@ open class EditablePanel<out S : Screen>(
|
||||
/**
|
||||
* Determining whenever panel is hovered or not
|
||||
*/
|
||||
fun tickHovered0(mouseX: Float, mouseY: Float): Boolean {
|
||||
fun tickHovered0(mouseX: Float, mouseY: Float, somethingElseHovered: Boolean): Boolean {
|
||||
if (isRemoved)
|
||||
return false
|
||||
return somethingElseHovered
|
||||
else if (somethingElseHovered) {
|
||||
if (parent == null)
|
||||
updateAbsolutePosition()
|
||||
|
||||
unsetHovered()
|
||||
return true
|
||||
}
|
||||
|
||||
val potentiallyHovered: Boolean
|
||||
|
||||
@ -1025,14 +1032,7 @@ open class EditablePanel<out S : Screen>(
|
||||
|
||||
if (potentiallyHovered) {
|
||||
var hit = false
|
||||
|
||||
for (child in visibleChildrenInternal) {
|
||||
if (hit) {
|
||||
child.unsetHovered()
|
||||
} else if (child.tickHovered0(mouseX, mouseY)) {
|
||||
hit = true
|
||||
}
|
||||
}
|
||||
visibleChildrenInternal.forEach { hit = it.tickHovered0(mouseX, mouseY, hit) }
|
||||
|
||||
pendingIsHovered =
|
||||
!hit &&
|
||||
@ -1404,7 +1404,14 @@ open class EditablePanel<out S : Screen>(
|
||||
|
||||
for (child in visibleChildrenInternal) {
|
||||
when (child.dock) {
|
||||
Dock.NONE, Dock.FILL -> {} // do nothing
|
||||
Dock.NONE -> {
|
||||
width = maxOf(width, child.x + child.width)
|
||||
height = maxOf(height, child.y + child.height)
|
||||
}
|
||||
|
||||
Dock.FILL -> {
|
||||
throw RuntimeException()
|
||||
} // do nothing
|
||||
|
||||
Dock.LEFT, Dock.RIGHT -> {
|
||||
if (previousDock != 1) {
|
||||
|
@ -22,7 +22,7 @@ class Panel2Widget<out S: Screen, out P : EditablePanel<S>>(
|
||||
|
||||
val wrap = MGUIGraphics(graphics)
|
||||
|
||||
panel.tickHovered0(xFloat, yFloat)
|
||||
panel.tickHovered0(xFloat, yFloat, false)
|
||||
panel.tickHovered1()
|
||||
panel.tickHovered2()
|
||||
panel.render(wrap, xFloat, yFloat, partialTick)
|
||||
|
Loading…
Reference in New Issue
Block a user