mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-10 10:20:44 -07:00
Better alt canvas logic
This commit is contained in:
parent
1de6638a12
commit
3a33995006
1 changed files with 34 additions and 36 deletions
|
|
@ -308,23 +308,17 @@ class plugin : Plugin() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initAltCanvas(){
|
|
||||||
if (frame != null) {
|
|
||||||
altCanvas = AltCanvas().apply {
|
|
||||||
preferredSize = Dimension(FIXED_WIDTH, FIXED_HEIGHT)
|
|
||||||
}
|
|
||||||
altCanvas?.let { frame.add(it) }
|
|
||||||
moveAltCanvasToFront()
|
|
||||||
frame.setComponentZOrder(rightPanelWrapper, 2)
|
|
||||||
}
|
|
||||||
updateDisplaySettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateDisplaySettings() {
|
private fun updateDisplaySettings() {
|
||||||
val mode = GetWindowMode()
|
val mode = GetWindowMode()
|
||||||
val currentScrollPaneWidth = if (mainContentPanel.isVisible) NAVBAR_WIDTH + MAIN_CONTENT_WIDTH else NAVBAR_WIDTH
|
val currentScrollPaneWidth = if (mainContentPanel.isVisible) NAVBAR_WIDTH + MAIN_CONTENT_WIDTH else NAVBAR_WIDTH
|
||||||
lastUIOffset = uiOffset
|
lastUIOffset = uiOffset
|
||||||
|
|
||||||
|
if(mode != WindowMode.FIXED) {
|
||||||
|
destroyAltCanvas()
|
||||||
|
} else if (useScaledFixed && altCanvas == null) {
|
||||||
|
initAltCanvas()
|
||||||
|
}
|
||||||
|
|
||||||
when (mode) {
|
when (mode) {
|
||||||
WindowMode.FIXED -> {
|
WindowMode.FIXED -> {
|
||||||
if (frame.width < FIXED_WIDTH + currentScrollPaneWidth + uiOffset) {
|
if (frame.width < FIXED_WIDTH + currentScrollPaneWidth + uiOffset) {
|
||||||
|
|
@ -373,33 +367,29 @@ class plugin : Plugin() {
|
||||||
StoreData("kondoLaunchMinimized", launchMinimized)
|
StoreData("kondoLaunchMinimized", launchMinimized)
|
||||||
StoreData("kondoUIOffset", uiOffset)
|
StoreData("kondoUIOffset", uiOffset)
|
||||||
StoreData("kondoScaledFixed", useScaledFixed)
|
StoreData("kondoScaledFixed", useScaledFixed)
|
||||||
if(altCanvas == null && useScaledFixed){
|
if(lastUIOffset != uiOffset || useScaledFixed){
|
||||||
initAltCanvas()
|
|
||||||
} else if(altCanvas != null && !useScaledFixed){
|
|
||||||
destroyAltCanvas()
|
|
||||||
}
|
|
||||||
if(lastUIOffset != uiOffset){
|
|
||||||
updateDisplaySettings()
|
updateDisplaySettings()
|
||||||
reloadInterfaces = true
|
reloadInterfaces = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun initAltCanvas(){
|
||||||
|
if(GetWindowMode() != WindowMode.FIXED || altCanvas != null) return
|
||||||
|
if (frame != null) {
|
||||||
|
altCanvas = AltCanvas().apply {
|
||||||
|
preferredSize = Dimension(FIXED_WIDTH, FIXED_HEIGHT)
|
||||||
|
}
|
||||||
|
altCanvas?.let { frame.add(it) }
|
||||||
|
moveAltCanvasToFront()
|
||||||
|
frame.setComponentZOrder(rightPanelWrapper, 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun destroyAltCanvas(){
|
private fun destroyAltCanvas(){
|
||||||
|
if (altCanvas == null) return
|
||||||
moveCanvasToFront()
|
moveCanvasToFront()
|
||||||
frame.remove(altCanvas)
|
frame.remove(altCanvas)
|
||||||
altCanvas = null
|
altCanvas = null
|
||||||
updateDisplaySettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun searchHiscore(username: String): Runnable {
|
|
||||||
return Runnable {
|
|
||||||
setActiveView(HiscoresView.VIEW_NAME)
|
|
||||||
val customSearchField = hiScoreView?.let { HiscoresView.CustomSearchField(it) }
|
|
||||||
|
|
||||||
customSearchField?.searchPlayer(username) ?: run {
|
|
||||||
println("searchView is null or CustomSearchField creation failed.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun moveAltCanvasToFront(){
|
private fun moveAltCanvasToFront(){
|
||||||
|
|
@ -416,6 +406,17 @@ class plugin : Plugin() {
|
||||||
frame.setComponentZOrder(rightPanelWrapper, 0)
|
frame.setComponentZOrder(rightPanelWrapper, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun searchHiscore(username: String): Runnable {
|
||||||
|
return Runnable {
|
||||||
|
setActiveView(HiscoresView.VIEW_NAME)
|
||||||
|
val customSearchField = hiScoreView?.let { HiscoresView.CustomSearchField(it) }
|
||||||
|
|
||||||
|
customSearchField?.searchPlayer(username) ?: run {
|
||||||
|
println("searchView is null or CustomSearchField creation failed.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun restoreSettings(){
|
private fun restoreSettings(){
|
||||||
themeName = (GetData("kondoTheme") as? String) ?: "RUNELITE"
|
themeName = (GetData("kondoTheme") as? String) ?: "RUNELITE"
|
||||||
useLiveGEPrices = (GetData("kondoUseRemoteGE") as? Boolean) ?: true
|
useLiveGEPrices = (GetData("kondoUseRemoteGE") as? Boolean) ?: true
|
||||||
|
|
@ -490,9 +491,6 @@ class plugin : Plugin() {
|
||||||
} else {
|
} else {
|
||||||
setActiveView(XPTrackerView.VIEW_NAME)
|
setActiveView(XPTrackerView.VIEW_NAME)
|
||||||
}
|
}
|
||||||
if(useScaledFixed) {
|
|
||||||
initAltCanvas()
|
|
||||||
}
|
|
||||||
initialized = true
|
initialized = true
|
||||||
pluginsReloaded = true
|
pluginsReloaded = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue