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