Fix initial clip preview selection
This commit is contained in:
@@ -250,8 +250,13 @@ struct ContentView: View {
|
|||||||
SettingsStore.save(newSettings)
|
SettingsStore.save(newSettings)
|
||||||
}
|
}
|
||||||
.onChange(of: processor.project) { project in
|
.onChange(of: processor.project) { project in
|
||||||
if selectedClipID == nil {
|
guard let project else {
|
||||||
selectedClipID = project?.clips.first?.id
|
selectedClipID = nil
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let orderedClips = orderedProjectClips(project.clips)
|
||||||
|
if selectedClipID == nil || !orderedClips.contains(where: { $0.id == selectedClipID }) {
|
||||||
|
selectedClipID = orderedClips.first?.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onChange(of: settings.sortMode) { sortMode in
|
.onChange(of: settings.sortMode) { sortMode in
|
||||||
@@ -409,6 +414,7 @@ struct ContentView: View {
|
|||||||
|
|
||||||
return VStack(alignment: .leading, spacing: 8) {
|
return VStack(alignment: .leading, spacing: 8) {
|
||||||
ClipPreviewView(clip: liveClip)
|
ClipPreviewView(clip: liveClip)
|
||||||
|
.id(liveClip.sourcePath)
|
||||||
.frame(height: 180)
|
.frame(height: 180)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 6))
|
.clipShape(RoundedRectangle(cornerRadius: 6))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user