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";
+1 -1
View File
@@ -554,7 +554,7 @@ stateDiagram-v2
| Onboarding | `NSWindow` (not a SwiftUI `Window` scene) | Ollama reachable + version, Hy-MT3 installed, target language, optional Accessibility for Replace; each with a fix button |
| Diagnostics | Window from the menu | Server version, model digests, last 50 timings and error kinds; copy as text; no text or translations |
Panel keyboard: **Esc** close, **⌘C** copy translation, **⌘↩** Replace, **⌘R** retry, **⌘,** Settings. The panel becomes key only when clicked; the source app keeps focus until then. The header has a drag grip; moving the panel keeps its position while it stays open, and a newly shown panel is placed near the cursor (DeepL-like transient position). The translation text size is a Settings value.
Panel keyboard: **Esc** close, **⌘C** copy translation, **⌘↩** Replace, **⌘R** retry, **⌘,** Settings. The panel becomes key only when clicked; the source app keeps focus until then. The left header block and its drag grip move the panel; moving it keeps its position while it stays open, and a newly shown panel is placed near the cursor (DeepL-like transient position). The translation text size is a Settings value.
Accessibility: every control has an `accessibilityLabel`; the panel exposes source and translation as read-only text elements; full keyboard navigation; respects Reduce Motion and Increase Contrast.
+1 -1
View File
@@ -150,4 +150,4 @@ Legend: `[ ]` open · `[~]` in progress · `[x]` done · `[!]` blocked (explain)
2026-11-26 · T8.5 · Added `scripts/release.sh` (archive unsigned, Developer ID sign, notarise/staple, DMG, `--dry-run`) and `make release`.
2026-11-26 · T8.6 · The compatibility matrix remains a manual 10-app pass; no untested cell is claimed.
2026-11-26 · T8.5 · Added a sibling-family app icon (`make icon`), `CFBundleIconName`/asset catalog wiring, `make install` from the Release build, and `make dmg`/`scripts/make-dmg.sh` with a mounted-image signature check. Dry-run release and local DMG/install were verified.
2026-11-26 · M4 polish · Added a header drag grip backed by an AppKit `performDrag` area; the panel keeps a moved position while visible and only recenters near the cursor when shown again. Added a persisted `translationFontSize` setting (default 17 pt, 12–28) with a Settings stepper and applied it to the translation text.
2026-11-26 · M4 polish · Enlarged the drag surface to the whole left header block, with a visible grip backed by an AppKit `performDrag` area; the panel keeps a moved position while visible and only recenters near the cursor when shown again. Added a persisted `translationFontSize` setting (default 17 pt, 12–28) with a Settings stepper and applied it to the translation text.