Skip to content

Commit f2430e1

Browse files
committed
make text not glitch out when hovering
1 parent dc93417 commit f2430e1

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

src/main/kotlin/mynameisjeff/skyblockclientupdater/gui/elements/ModUpdateComponent.kt

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import cc.polyfrost.oneconfig.libs.elementa.dsl.childOf
1010
import cc.polyfrost.oneconfig.libs.elementa.dsl.constrain
1111
import cc.polyfrost.oneconfig.libs.elementa.dsl.toConstraint
1212
import cc.polyfrost.oneconfig.libs.universal.ChatColor
13+
import cc.polyfrost.oneconfig.libs.universal.UMatrixStack
1314
import mynameisjeff.skyblockclientupdater.SkyClientUpdater
1415
import mynameisjeff.skyblockclientupdater.UpdateChecker
1516
import mynameisjeff.skyblockclientupdater.data.UpdateMod
@@ -34,6 +35,14 @@ class ModUpdateComponent(
3435
color = SkyClientUpdater.accentColor.toConstraint()
3536
} childOf this
3637

38+
private var heldAction: (() -> Unit)? = null
39+
40+
override fun afterDraw(matrixStack: UMatrixStack) {
41+
super.afterDraw(matrixStack)
42+
heldAction?.invoke()
43+
heldAction = null
44+
}
45+
3746
init {
3847
seperatorContainer.constrain {
3948
width = seperatorText.constraints.width
@@ -68,27 +77,31 @@ class ModUpdateComponent(
6877
}
6978
}
7079
}.onMouseEnter {
71-
when (update.type) {
72-
UpdateMod.Type.UPDATING -> {
73-
newFileText.setText("${ChatColor.GREEN}${update.name} ${ChatColor.WHITE}(skip)")
74-
}
75-
UpdateMod.Type.TEMP_DISABLE -> {
76-
newFileText.setText("${ChatColor.RED}${update.name} ${ChatColor.WHITE}(ignore)")
77-
}
78-
UpdateMod.Type.DISABLE -> {
79-
newFileText.setText("${ChatColor.GREEN}${update.name}")
80+
heldAction = {
81+
when (update.type) {
82+
UpdateMod.Type.UPDATING -> {
83+
newFileText.setText("${ChatColor.GREEN}${ChatColor.STRIKETHROUGH}${update.name} ${ChatColor.WHITE}(skip)")
84+
}
85+
UpdateMod.Type.TEMP_DISABLE -> {
86+
newFileText.setText("${ChatColor.RED}${ChatColor.STRIKETHROUGH}${update.name} ${ChatColor.WHITE}(ignore)")
87+
}
88+
UpdateMod.Type.DISABLE -> {
89+
newFileText.setText("${ChatColor.GREEN}${ChatColor.STRIKETHROUGH}${update.name}")
90+
}
8091
}
8192
}
8293
}.onMouseLeave {
83-
when (update.type) {
84-
UpdateMod.Type.UPDATING -> {
85-
newFileText.setText("${ChatColor.GREEN}${update.name}")
86-
}
87-
UpdateMod.Type.TEMP_DISABLE -> {
88-
newFileText.setText("${ChatColor.GREEN}${ChatColor.STRIKETHROUGH}${update.name} ${ChatColor.WHITE}(skipping)")
89-
}
90-
UpdateMod.Type.DISABLE -> {
91-
newFileText.setText("${ChatColor.RED}${ChatColor.STRIKETHROUGH}${update.name} ${ChatColor.WHITE}(ignored)")
94+
heldAction = {
95+
when (update.type) {
96+
UpdateMod.Type.UPDATING -> {
97+
newFileText.setText("${ChatColor.GREEN}${update.name}")
98+
}
99+
UpdateMod.Type.TEMP_DISABLE -> {
100+
newFileText.setText("${ChatColor.GREEN}${ChatColor.STRIKETHROUGH}${update.name} ${ChatColor.WHITE}(skipping)")
101+
}
102+
UpdateMod.Type.DISABLE -> {
103+
newFileText.setText("${ChatColor.RED}${ChatColor.STRIKETHROUGH}${update.name} ${ChatColor.WHITE}(ignored)")
104+
}
92105
}
93106
}
94107
}

0 commit comments

Comments
 (0)