Add ignoreWhenSizingToContents
This commit is contained in:
parent
aa2e053c26
commit
6105328e85
@ -1384,6 +1384,9 @@ open class EditablePanel<out S : Screen>(
|
||||
parent?.updateBounds()
|
||||
}
|
||||
|
||||
open val ignoreWhenSizingToContents: Boolean
|
||||
get() = false
|
||||
|
||||
/**
|
||||
* Attempts to tightly fit dimensions to all children
|
||||
*/
|
||||
@ -1405,8 +1408,10 @@ open class EditablePanel<out S : Screen>(
|
||||
for (child in visibleChildrenInternal) {
|
||||
when (child.dock) {
|
||||
Dock.NONE -> {
|
||||
width = maxOf(width, child.x + child.width)
|
||||
height = maxOf(height, child.y + child.height)
|
||||
if (!child.ignoreWhenSizingToContents) {
|
||||
width = maxOf(width, child.x + child.width)
|
||||
height = maxOf(height, child.y + child.height)
|
||||
}
|
||||
}
|
||||
|
||||
Dock.FILL -> {
|
||||
|
@ -34,6 +34,9 @@ open class FramePanel<out S : Screen>(
|
||||
var isActive = tabs.isEmpty()
|
||||
protected set
|
||||
|
||||
override val ignoreWhenSizingToContents: Boolean
|
||||
get() = true
|
||||
|
||||
init {
|
||||
tabs.add(this)
|
||||
}
|
||||
@ -197,6 +200,9 @@ open class FramePanel<out S : Screen>(
|
||||
close()
|
||||
}
|
||||
|
||||
override val ignoreWhenSizingToContents: Boolean
|
||||
get() = true
|
||||
|
||||
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
if (isPressed) {
|
||||
CLOSE_BUTTON_PRESSED.render(graphics, 0f, 0f, width, height)
|
||||
@ -223,6 +229,9 @@ open class FramePanel<out S : Screen>(
|
||||
isActive = !isActive
|
||||
}*/
|
||||
|
||||
override val ignoreWhenSizingToContents: Boolean
|
||||
get() = true
|
||||
|
||||
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
/*if (isPressed) {
|
||||
HELP_BUTTON_PRESSED.render(graphics, 0f, 0f, width, height)
|
||||
|
@ -339,6 +339,9 @@ class DeviceControls<out S : MatteryScreen<*>>(
|
||||
|
||||
private var upgradeWindow: FramePanel<S>? = null
|
||||
|
||||
override val ignoreWhenSizingToContents: Boolean
|
||||
get() = true
|
||||
|
||||
private val buttons = ArrayList<EditablePanel<S>>()
|
||||
|
||||
private fun alignButtons() {
|
||||
|
Loading…
Reference in New Issue
Block a user