Merge branch 'KondoKit-2.0' into 'FIXED-RESIZE'

# Conflicts:
#   plugin-playground/src/main/kotlin/KondoKit/ScrollablePanel.kt
This commit is contained in:
downthecrop 2024-10-28 23:41:42 +00:00
commit 4ebba194dc
2 changed files with 8 additions and 4 deletions

View file

@ -18,6 +18,7 @@ class ScrollablePanel(private val content: JPanel) : JPanel() {
private var scrollbarY = 0
private var showScrollbar = false
private var draggingScrollPill = false
private var lastSize = 0
// Define a buffer for the view height (extra space for smoother scrolling)
private val viewBuffer = -30
@ -69,6 +70,8 @@ class ScrollablePanel(private val content: JPanel) : JPanel() {
Timer().schedule(object : TimerTask() {
override fun run() {
updateScrollbar()
if(lastSize != content.preferredSize.height.coerceAtLeast(frame.height + viewBuffer))
handleResize()
}
}, 0, 1000)
@ -85,9 +88,10 @@ class ScrollablePanel(private val content: JPanel) : JPanel() {
// Ensure the ScrollablePanel resizes with the frame
bounds = Rectangle(0, 0, 242, frame.height)
// Dynamically update content bounds and scrollbar on frame resize with buffer
content.bounds = Rectangle(0, 0, 242, content.preferredSize.height.coerceAtLeast(frame.height + viewBuffer))
showScrollbar = content.height > frame.height
// Dynamically update content bounds and scrollbar on frame resize with buffer
lastSize = content.preferredSize.height.coerceAtLeast(frame.height + viewBuffer)
content.bounds = Rectangle(0, 0, 242, lastSize)
showScrollbar = content.height > frame.height
currentOffsetY = 0

View file

@ -60,7 +60,7 @@ object Themes {
ThemeType.SARADOMIN -> Theme(
widgetColor = Color(62, 53, 41),
titleBarColor = Color(111, 93, 69).darker(),
viewBackgroundColor = Color(111, 93, 69),
viewBackgroundColor = Color(101, 85, 63),
primaryColor = Color(180, 150, 120),
secondaryColor = Color(230, 210, 190),
popupBackground = Color(70, 56, 42),