Skip to content

Commit edf85f4

Browse files
Merge pull request #214 from amosproj/gui/fix/path-state-no-rerender
fixed setting of file picker paths in state to not rerender
2 parents dc9c37f + 3b344ba commit edf85f4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

GUI/src/main/kotlin/ui/components/diffScreen/SaveCollageButton.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ fun saveCollageCallback(
5151
if (!savePath.endsWith(".png")) {
5252
savePath = "$savePath.png"
5353
}
54-
state.value = state.value.copy(saveCollagePath = savePath)
54+
state.value.saveCollagePath = savePath
5555
navigator.createCollage(savePath)
5656
}

GUI/src/main/kotlin/ui/components/diffScreen/SaveInsertedFramesButton.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fun saveInsertedFramesCallback(
6565
return
6666
}
6767
}
68-
state.value = state.value.copy(saveInsertionsPath = savePath)
68+
state.value.saveInsertionsPath = savePath
6969

7070
createInsertionsExport(savePath, navigator.getInsertedFrames())
7171
}

GUI/src/main/kotlin/ui/components/general/ProjectManager.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fun handleOpenProject(
8484
) {
8585
val file = File(path).readLines()
8686
state.value = JsonMapper.mapper.readValue<AppState>(file.joinToString(""))
87-
state.value = state.value.copy(openProjectPath = path)
87+
state.value.openProjectPath = path
8888
}
8989

9090
/**
@@ -100,7 +100,8 @@ fun handleSaveProject(
100100
if (!savePath.endsWith(".json")) {
101101
savePath = "$savePath.json"
102102
}
103-
state.value = state.value.copy(saveProjectPath = savePath)
103+
state.value.saveProjectPath = savePath
104+
104105
val jsonData = JsonMapper.mapper.writeValueAsString(state.value)
105106
File(savePath).writeText(jsonData)
106107
}

GUI/src/main/kotlin/ui/components/general/SaveableImage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private fun saveBitmapAsPng(
109109
savePath = "$savePath.png"
110110
}
111111
// remember path for next time opening the file chooser
112-
state.value = state.value.copy(saveFramePath = savePath)
112+
state.value.saveFramePath = savePath
113113
val file = File(savePath)
114114
if (file.exists()) {
115115
val overwrite = showOverwriteConfirmation()

0 commit comments

Comments
 (0)