From 9edf3eaf8a43e65051a8ca221bb743a103101304 Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Thu, 4 Jun 2026 11:57:08 +0200 Subject: [PATCH] Make review panel resize content --- Sources/GrowthLapse/ContentView.swift | 105 ++++++++++++++------------ 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/Sources/GrowthLapse/ContentView.swift b/Sources/GrowthLapse/ContentView.swift index 9502959..31aa7d9 100644 --- a/Sources/GrowthLapse/ContentView.swift +++ b/Sources/GrowthLapse/ContentView.swift @@ -394,18 +394,20 @@ struct ContentView: View { } } } - .frame(minWidth: 240, idealWidth: 300, maxWidth: 340, minHeight: 220, maxHeight: 300) + .frame(minWidth: 240, idealWidth: 300, maxWidth: 340, maxHeight: .infinity) if let clip = selectedClip { clipEditor(clip) } else { Text("Kein Clip ausgewählt") .foregroundStyle(.secondary) - .frame(maxWidth: .infinity, minHeight: 220) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) } } + .frame(maxHeight: .infinity, alignment: .top) } .padding(10) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) .background(Color(nsColor: .controlBackgroundColor)) .clipShape(RoundedRectangle(cornerRadius: 8)) .overlay( @@ -422,55 +424,60 @@ struct ContentView: View { set: { processor.updateClip(clip, segmentStart: $0) } ) - return VStack(alignment: .leading, spacing: 8) { - ClipPreviewView(clip: liveClip) - .id(liveClip.sourcePath) - .frame(height: 180) - .clipShape(RoundedRectangle(cornerRadius: 6)) + return GeometryReader { proxy in + let previewHeight = min(max(150, proxy.size.height - 160), 420) - Text(liveClip.displayName) - .font(.subheadline.weight(.semibold)) - .lineLimit(2) + VStack(alignment: .leading, spacing: 8) { + ClipPreviewView(clip: liveClip) + .id(liveClip.sourcePath) + .frame(height: previewHeight) + .clipShape(RoundedRectangle(cornerRadius: 6)) - HStack { - Text("Segmentstart") - Spacer() - Text("\(formattedNumber(startBinding.wrappedValue)) s / max \(formattedNumber(maxStart)) s") - .font(.body.monospacedDigit()) - .foregroundStyle(.secondary) + Text(liveClip.displayName) + .font(.subheadline.weight(.semibold)) + .lineLimit(2) + + HStack { + Text("Segmentstart") + Spacer() + Text("\(formattedNumber(startBinding.wrappedValue)) s / max \(formattedNumber(maxStart)) s") + .font(.body.monospacedDigit()) + .foregroundStyle(.secondary) + } + + SegmentTimelineView(clip: liveClip) + .frame(height: 42) + .help("Blau ist das verwendete Segmentfenster. Der markierte rechte Bereich kann nicht als Startpunkt gewählt werden, weil das Segment sonst über das Videoende hinauslaufen würde.") + + if maxStart > 0 { + Slider(value: startBinding, in: 0...maxStart, step: 0.1) + } else { + Slider(value: .constant(0), in: 0...1) + .disabled(true) + } + + HStack { + Button("-1 s") { + processor.updateClip(clip, segmentStart: startBinding.wrappedValue - 1) + } + Button("-0,5 s") { + processor.updateClip(clip, segmentStart: startBinding.wrappedValue - 0.5) + } + Button("Zur Mitte") { + processor.updateClip(clip, segmentStart: max(0, (liveClip.duration - liveClip.segmentLength) / 2 + settings.startOffset)) + } + Button("+0,5 s") { + processor.updateClip(clip, segmentStart: startBinding.wrappedValue + 0.5) + } + Button("+1 s") { + processor.updateClip(clip, segmentStart: startBinding.wrappedValue + 1) + } + } + .disabled(processor.state.isRunning || maxStart <= 0) } - - SegmentTimelineView(clip: liveClip) - .frame(height: 42) - .help("Blau ist das verwendete Segmentfenster. Der markierte rechte Bereich kann nicht als Startpunkt gewählt werden, weil das Segment sonst über das Videoende hinauslaufen würde.") - - if maxStart > 0 { - Slider(value: startBinding, in: 0...maxStart, step: 0.1) - } else { - Slider(value: .constant(0), in: 0...1) - .disabled(true) - } - - HStack { - Button("-1 s") { - processor.updateClip(clip, segmentStart: startBinding.wrappedValue - 1) - } - Button("-0,5 s") { - processor.updateClip(clip, segmentStart: startBinding.wrappedValue - 0.5) - } - Button("Zur Mitte") { - processor.updateClip(clip, segmentStart: max(0, (liveClip.duration - liveClip.segmentLength) / 2 + settings.startOffset)) - } - Button("+0,5 s") { - processor.updateClip(clip, segmentStart: startBinding.wrappedValue + 0.5) - } - Button("+1 s") { - processor.updateClip(clip, segmentStart: startBinding.wrappedValue + 1) - } - } - .disabled(processor.state.isRunning || maxStart <= 0) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) } - .frame(maxWidth: .infinity, alignment: .topLeading) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) } private func currentClip(id: UUID) -> GrowthLapseProjectClip? { @@ -656,7 +663,7 @@ private struct ResizableVerticalStack: View { VStack(spacing: 0) { top() - .frame(height: clampedTopHeight) + .frame(height: clampedTopHeight, alignment: .top) .clipped() SplitHandle() @@ -678,7 +685,7 @@ private struct ResizableVerticalStack: View { .help("Ziehen, um Clip-Nachbearbeitung und Log größer oder kleiner zu machen.") bottom() - .frame(height: max(minBottomHeight, availableHeight - clampedTopHeight)) + .frame(height: max(minBottomHeight, availableHeight - clampedTopHeight), alignment: .top) .clipped() } .onAppear {