Edge snap fix

This commit is contained in:
downthecrop 2025-11-21 17:05:40 -08:00
parent 5240963743
commit 0c1e445a95
2 changed files with 64 additions and 39 deletions

View file

@ -320,10 +320,27 @@ class plugin : Plugin() {
}
private fun updateDisplaySettings() {
val applyDisplaySettings = {
val mode = GetWindowMode()
val currentScrollPaneWidth = if (mainContentPanel.isVisible) NAVBAR_WIDTH + MAIN_CONTENT_WIDTH else NAVBAR_WIDTH
lastUIOffset = uiOffset
// Ensure the scroll wrapper stays attached on the EAST edge even if the game resets the layout
rightPanelWrapper?.let { wrapper ->
val needsLayoutReset = frame.layout !is BorderLayout
val needsAttach = wrapper.parent != frame
if (needsLayoutReset || needsAttach) {
wrapper.parent?.remove(wrapper)
frame.layout = BorderLayout()
frame.add(wrapper, BorderLayout.EAST)
if (altCanvas != null) {
moveAltCanvasToFront()
} else {
moveCanvasToFront()
}
}
}
if(mode != WindowMode.FIXED) {
destroyAltCanvas()
} else if (useScaledFixed && altCanvas == null) {
@ -366,6 +383,14 @@ class plugin : Plugin() {
rightPanelWrapper?.isDoubleBuffered = true
rightPanelWrapper?.revalidate()
rightPanelWrapper?.repaint()
frame.validate()
}
if (SwingUtilities.isEventDispatchThread()) {
applyDisplaySettings()
} else {
SwingUtilities.invokeLater { applyDisplaySettings() }
}
}
fun OnKondoValueUpdated(){