-
Notifications
You must be signed in to change notification settings - Fork 161
add price source and sorting buttons to /pv sack page #1039
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
Conversation
jani270
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some style things, also might wanna move the buttons more into the middle and down?
src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt
Outdated
Show resolved
Hide resolved
lineargraph
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works nicely. Feel free to merge.
| object KotlinRenderUtils { | ||
|
|
||
| @JvmStatic | ||
| fun renderItemStackButton(button: Rectangle, item: ItemStack, texture: ResourceLocation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like taking in a Rectangle here is a bit misleading, since the actual dimensions of the rectangle are entirely ignored (not used for the texture or centering the itemstack.
| if (priceSourceButtonRect.contains(mouseX, mouseY)) { | ||
| currentPriceSource = PriceSource.values()[(currentPriceSource.ordinal + 1) % PriceSource.values().size] | ||
| Utils.playPressSound() | ||
| getData() | ||
| } | ||
|
|
||
| if (sortButtonRect.contains(mouseX, mouseY)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point we might as well add a utility like
inline fun <reified E : Enum<E>> E.nextEnum(): E {
val values = enumValues<E>()
return values[(ordinal + 1) % values.size]
}
Not really needed here tho.
| // Lazy initialisation to allow for guiLeft and guiTop to be initialized first | ||
| private val priceSourceButtonRect by lazy { Rectangle(guiLeft + 54, guiTop + 155, 20, 20) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this breaks if the window gets resized. Then again, we don't have any mechanism for invalidating these rects, so this will be fine.
closes #934
closes #935