Compare commits

..

3 commits

Author SHA1 Message Date
downthecrop
dbde09f319 Merge branch 'KondoKit-2.0' into 'master'
KondoKit 2.0

See merge request 2009scape/rt4-client!28
2024-11-03 18:39:03 +00:00
downthecrop
77c5528fc1 always update display settings 2024-11-03 10:25:50 -08:00
downthecrop
3a33995006 Better alt canvas logic 2024-11-03 10:24:11 -08:00

View file

@ -308,23 +308,17 @@ class plugin : Plugin() {
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() {
val mode = GetWindowMode()
val currentScrollPaneWidth = if (mainContentPanel.isVisible) NAVBAR_WIDTH + MAIN_CONTENT_WIDTH else NAVBAR_WIDTH
lastUIOffset = uiOffset
if(mode != WindowMode.FIXED) {
destroyAltCanvas()
} else if (useScaledFixed && altCanvas == null) {
initAltCanvas()
}
when (mode) {
WindowMode.FIXED -> {
if (frame.width < FIXED_WIDTH + currentScrollPaneWidth + uiOffset) {
@ -373,33 +367,29 @@ class plugin : Plugin() {
StoreData("kondoLaunchMinimized", launchMinimized)
StoreData("kondoUIOffset", uiOffset)
StoreData("kondoScaledFixed", useScaledFixed)
if(altCanvas == null && useScaledFixed){
initAltCanvas()
} else if(altCanvas != null && !useScaledFixed){
destroyAltCanvas()
}
if(lastUIOffset != uiOffset){
updateDisplaySettings()
reloadInterfaces = true
}
updateDisplaySettings()
}
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(){
if (altCanvas == null) return
moveCanvasToFront()
frame.remove(altCanvas)
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(){
@ -416,6 +406,17 @@ class plugin : Plugin() {
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(){
themeName = (GetData("kondoTheme") as? String) ?: "RUNELITE"
useLiveGEPrices = (GetData("kondoUseRemoteGE") as? Boolean) ?: true
@ -490,9 +491,6 @@ class plugin : Plugin() {
} else {
setActiveView(XPTrackerView.VIEW_NAME)
}
if(useScaledFixed) {
initAltCanvas()
}
initialized = true
pluginsReloaded = true
}