Fix weird tab appearance at certain resolutions

There's 1 physical pixel of error creeping in somewhere which was being
displayed below the selected tab. Workaround it by using a tab texture
which has transparent pixels below the bottom of the select tabs.
This commit is contained in:
Shadowfacts 2021-03-06 19:10:24 -05:00
parent 1c405f8623
commit 2198b5e10d
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import net.shadowfacts.cacao.geometry.Axis
import net.shadowfacts.cacao.geometry.Point
import net.shadowfacts.cacao.geometry.Rect
import net.shadowfacts.cacao.geometry.Size
import net.shadowfacts.cacao.util.Color
import net.shadowfacts.cacao.util.MouseButton
import net.shadowfacts.cacao.util.texture.NinePatchTexture
import net.shadowfacts.cacao.util.texture.Texture
@ -239,7 +240,7 @@ class TabViewController<T: TabViewController.Tab>(
padding = 2.0
) {
companion object {
val BACKGROUND = Identifier("textures/gui/container/creative_inventory/tabs.png")
val BACKGROUND = Identifier("phycon:textures/gui/tabs.png")
}
private var selected = false
@ -293,7 +294,7 @@ class TabViewController<T: TabViewController.Tab>(
val u = when {
superview == null -> 0
frame.left == 0.0 -> 0
frame.right == superview!!.bounds.right -> 140
frame.right == superview!!.bounds.right -> 56
else -> 28
}
backgroundView.texture = Texture(BACKGROUND, u, v)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB