mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-15 02:50:23 -07:00
Fix sizing of XP Widgets
This commit is contained in:
parent
03a205f64b
commit
3392d61d9e
1 changed files with 7 additions and 3 deletions
|
|
@ -163,7 +163,8 @@ object XPTrackerView : View, OnUpdateCallback, OnXPUpdateCallback {
|
|||
xpWidget = createXPWidget(skillId, previousXpSnapshot)
|
||||
xpWidgets[skillId] = xpWidget
|
||||
|
||||
val wrapped = wrappedWidget(xpWidget.container)
|
||||
// Create new widget
|
||||
val wrapped = wrappedWidget(xpWidget.container, padding = 0, innerPadding = 6)
|
||||
val popupMenu = removeXPWidgetMenu(wrapped, skillId)
|
||||
wrapped.attachPopupMenu(popupMenu, includeChildren = true)
|
||||
|
||||
|
|
@ -383,7 +384,7 @@ object XPTrackerView : View, OnUpdateCallback, OnXPUpdateCallback {
|
|||
fun createXPWidget(skillId: Int, previousXp: Int): XPWidget {
|
||||
val widgetPanel = WidgetPanel(
|
||||
widgetWidth = ViewConstants.DEFAULT_WIDGET_SIZE.width,
|
||||
widgetHeight = ViewConstants.DEFAULT_WIDGET_SIZE.height,
|
||||
widgetHeight = 56,
|
||||
addDefaultPadding = false
|
||||
)
|
||||
|
||||
|
|
@ -435,7 +436,7 @@ object XPTrackerView : View, OnUpdateCallback, OnXPUpdateCallback {
|
|||
)
|
||||
}
|
||||
|
||||
fun wrappedWidget(component: Component, padding: Int = 7): Container {
|
||||
fun wrappedWidget(component: Component, padding: Int = 7, innerPadding: Int = 0): Container {
|
||||
val outerPanelSize = Dimension(
|
||||
component.preferredSize.width + 2 * padding,
|
||||
component.preferredSize.height + 2 * padding
|
||||
|
|
@ -447,6 +448,9 @@ object XPTrackerView : View, OnUpdateCallback, OnXPUpdateCallback {
|
|||
val innerPanel = JPanel(BorderLayout()).apply {
|
||||
background = WIDGET_COLOR
|
||||
setFixedSize(component.preferredSize)
|
||||
if (innerPadding > 0) {
|
||||
border = BorderFactory.createEmptyBorder(innerPadding, innerPadding, innerPadding, innerPadding)
|
||||
}
|
||||
add(component, BorderLayout.CENTER)
|
||||
}
|
||||
val gbc = GridBagConstraints().apply {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue