Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Mark label as selected when programatically calling selectCategory() #73

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/main/kotlin/gg/essential/vigilance/gui/CategoryLabel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ class CategoryLabel(private val gui: SettingsGui, internal val category: Categor

fun select() {
gui.selectCategory(category)

isSelected = true
text.animate {
setColorAnimation(Animations.OUT_EXP, 0.5f, VigilancePalette.textActive.toConstraint())
}
}

fun deselect() {
Expand All @@ -67,4 +62,11 @@ class CategoryLabel(private val gui: SettingsGui, internal val category: Categor
setColorAnimation(Animations.OUT_EXP, 0.5f, VigilancePalette.text.toConstraint())
}
}

fun markSelected() {
isSelected = true
text.animate {
setColorAnimation(Animations.OUT_EXP, 0.5f, VigilancePalette.textActive.toConstraint())
}
}
Comment on lines +65 to +71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For symmetry I think we should also make a markDeselected (or have this method accept a selected: Boolean) which the current deselect calls, and then slap a @Deprecated on select and deselect because we shouldn't be using them any more, they only exist for backwards compatibility, we should always be using gui.selectCategory (which will in turn only use the mark* method(s)).

}