fix(panel): enlarge drag surface to the header block

The 18x28 grip was too small. Wrap the grip, icon, title and language subtitle in a 44 pt-high native performDrag area; the SwiftUI content is hit-testing-disabled so the whole left header block starts a window drag. Make the grip a visible 24x32 capsule with an open-hand cursor and a localized tooltip.

Verified: make verify green; a synthetic drag starting on the title area moved the panel by the full delta, and the panel screenshot confirms the larger grip and 17 pt translation text.
This commit is contained in:
schihei committed 2026-11-26 14:42:58 +01:00
1 parent 40733473c5
commit f466e6dd1c
5 files changed
+26 -19

No files matched your search

+22 -17
View File
@@ -41,27 +41,32 @@ struct PanelView: View {
private var header: some View {
HStack(spacing: 10) {
ZStack {
Image(systemName: "line.3.horizontal")
.font(.caption2)
.foregroundStyle(.tertiary)
.allowsHitTesting(false)
ZStack(alignment: .leading) {
WindowDragArea()
HStack(spacing: 10) {
Image(systemName: "line.3.horizontal")
.font(.system(size: 12, weight: .semibold))
.foregroundStyle(.secondary)
.frame(width: 24, height: 32)
.background(.quaternary, in: RoundedRectangle(cornerRadius: 7))
Image(systemName: "character.bubble")
.font(.title2)
.foregroundStyle(.tint)
VStack(alignment: .leading, spacing: 1) {
Text(String(localized: "Translate"))
.font(.headline)
Text("\(sourceLanguageLabel) → \(model.configuration.target.localizedDisplayName)")
.font(.caption)
.foregroundStyle(.secondary)
}
}
.allowsHitTesting(false)
}
.frame(width: 18, height: 28)
.frame(height: 44)
.contentShape(Rectangle())
.help(String(localized: "Drag to move panel"))
.accessibilityLabel(String(localized: "Move panel"))
Image(systemName: "character.bubble")
.font(.title2)
.foregroundStyle(.tint)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 1) {
Text(String(localized: "Translate"))
.font(.headline)
Text("\(sourceLanguageLabel) → \(model.configuration.target.localizedDisplayName)")
.font(.caption)
.foregroundStyle(.secondary)
}
Spacer()
Button {
showLanguagePicker.toggle()
@@ -11,6 +11,7 @@
"Quit Sprachmittler" = "Sprachmittler beenden";
"Translate" = "Übersetzen";
"Move panel" = "Panel verschieben";
"Drag to move panel" = "Zum Verschieben ziehen";
"Translation text size" = "Schriftgröße der Übersetzung";
"Source" = "Quelle";
"Settings" = "Einstellungen";
@@ -11,6 +11,7 @@
"Quit Sprachmittler" = "Quit Sprachmittler";
"Translate" = "Translate";
"Move panel" = "Move panel";
"Drag to move panel" = "Drag to move panel";
"Translation text size" = "Translation text size";
"Source" = "Source";
"Settings" = "Settings";