Pane size is saved in-memory to preserve it when switching between tabs

This commit is contained in:
Abdelilah El Aissaoui 2024-01-10 17:33:21 +01:00
parent bc862b4635
commit 76a8422ac6
No known key found for this signature in database
GPG key ID: 7587FC860F594869
2 changed files with 6 additions and 2 deletions

View file

@ -252,8 +252,8 @@ fun MainContentView(
val rebaseInteractiveState by tabViewModel.rebaseInteractiveState.collectAsState()
val density = LocalDensity.current.density
var firstWidth by remember { mutableStateOf(180f) }
var thirdWidth by remember { mutableStateOf(360f) }
var firstWidth by remember(tabViewModel) { mutableStateOf(tabViewModel.firstPaneWidth) }
var thirdWidth by remember(tabViewModel) { mutableStateOf(tabViewModel.thirdPaneWidth) }
TripleVerticalSplitPanel(
modifier = Modifier.fillMaxSize(),
@ -370,6 +370,7 @@ fun MainContentView(
if (newWidth > 150) {
firstWidth = newWidth
tabViewModel.firstPaneWidth = firstWidth
}
},
onThirdSizeDrag = {
@ -377,6 +378,7 @@ fun MainContentView(
if (newWidth > 150) {
thirdWidth = newWidth
tabViewModel.thirdPaneWidth = thirdWidth
}
},
)

View file

@ -70,6 +70,8 @@ class TabViewModel @Inject constructor(
private val tabsManager: TabsManager,
private val tabScope: CoroutineScope,
) {
var firstPaneWidth = 220f
var thirdPaneWidth = 360f
var initialPath: String? = null // Stores the path that should be opened when the tab is selected
val errorsManager: ErrorsManager = tabState.errorsManager
val selectedItem: StateFlow<SelectedItem> = tabState.selectedItem