fix(panel): draggable header and configurable translation text size

Add a native AppKit drag grip to the non-activating panel header; it accepts the first mouse and calls performDrag, so the panel can be moved before it becomes key. Keep a moved position while the panel stays visible and only recenter near the cursor when it is shown again (DeepL-like transient position).

Add persisted translationFontSize (default 17 pt, range 12–28) to AppSettings and PanelConfiguration, apply it to the translation text, and expose a native Settings stepper. Add English/German strings and AppSettings clamp/round-trip tests.

Verified: make verify green; synthetic double-copy opened the panel, dragging the grip moved the window, and a 22 pt capture showed the larger translation text.
This commit is contained in:
schihei committed 2026-11-26 14:35:34 +01:00
1 parent 2cce12ff17
commit 40733473c5
12 files changed
+98 -5

No files matched your search

@@ -17,6 +17,7 @@ struct AppSettingsTests {
#expect(settings.maxCharactersLatin == 4000)
#expect(settings.maxCharactersCJK == 2000)
#expect(settings.numCtx == 8192)
#expect(settings.translationFontSize == 17)
#expect(!settings.autoCopy)
#expect(!settings.hasCompletedOnboarding)
}
@@ -28,6 +29,7 @@ struct AppSettingsTests {
settings.targetLanguage = "de"
settings.noteTarget(HyMT3Languages.german)
settings.temperature = 0.2
settings.translationFontSize = 22
settings.launchAtLogin = true
settings.hasCompletedOnboarding = true
@@ -82,6 +84,7 @@ struct AppSettingsTests {
"topK": 0,
"repeatPenalty": 9,
"keepModelLoaded": "forever",
"translationFontSize": 99,
"targetLanguage": "xx"
}
"""
@@ -96,6 +99,7 @@ struct AppSettingsTests {
#expect(decoded.topK == 1)
#expect(decoded.repeatPenalty == 2)
#expect(decoded.keepModelLoaded == HyMT3ModelPreset.defaultKeepAlive)
#expect(decoded.translationFontSize == 28)
#expect(HyMT3Languages.resolve(decoded.targetLanguage) != nil)
}
@@ -106,6 +110,7 @@ struct AppSettingsTests {
settings.topP = -1
settings.topK = 0
settings.keepModelLoaded = "forever"
settings.translationFontSize = 99
settings.autoCopy = true
settings.targetLanguage = "xx"
settings.sanitize()
@@ -115,6 +120,7 @@ struct AppSettingsTests {
#expect(settings.topP == 0)
#expect(settings.topK == 1)
#expect(settings.keepModelLoaded == HyMT3ModelPreset.defaultKeepAlive)
#expect(settings.translationFontSize == 28)
#expect(!settings.autoCopy)
#expect(HyMT3Languages.resolve(settings.targetLanguage) != nil)
}