Zonble: Tooltip UI // multiple bug fixes.
- Stop Tooltip UI from running out of the screen. - Discourage user-phrase when replacement is ON. - Typo Fix.
This commit is contained in:
parent
8f97f7c518
commit
671aed70de
|
@ -1424,13 +1424,17 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
|
|||
if (!length) {
|
||||
[self _hideTooltip];
|
||||
}
|
||||
else if (Preferences.phraseReplacementEnabled) {
|
||||
NSString *message = [NSString stringWithFormat:NSLocalizedString(@"⚠︎ Phrase replacement mode enabled, interfering user phrase entry.", @""), text];
|
||||
[self _showTooltip:message client:client];
|
||||
}
|
||||
else if (length == 1) {
|
||||
NSString *messsage = [NSString stringWithFormat:NSLocalizedString(@"\"%@\" length must ≥ 2 for a user phrase.", @""), text];
|
||||
[self _showTooltip:messsage client:client];
|
||||
NSString *message = [NSString stringWithFormat:NSLocalizedString(@"\"%@\" length must ≥ 2 for a user phrase.", @""), text];
|
||||
[self _showTooltip:message client:client];
|
||||
}
|
||||
else {
|
||||
NSString *messsage = [NSString stringWithFormat:NSLocalizedString(@"\"%@\" selected. ENTER to add user phrase.", @""), text];
|
||||
[self _showTooltip:messsage client:client];
|
||||
NSString *message = [NSString stringWithFormat:NSLocalizedString(@"\"%@\" selected. ENTER to add user phrase.", @""), text];
|
||||
[self _showTooltip:message client:client];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,12 +54,47 @@ public class TooltipController: NSWindowController {
|
|||
window?.orderOut(nil)
|
||||
}
|
||||
|
||||
private func set(windowLocation location: NSPoint) {
|
||||
var newPoint = location
|
||||
if location.y > 5 {
|
||||
newPoint.y -= 5
|
||||
private func set(windowLocation windowTopLeftPoint: NSPoint) {
|
||||
|
||||
var adjustedPoint = windowTopLeftPoint
|
||||
adjustedPoint.y -= 5
|
||||
|
||||
var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.zero
|
||||
for screen in NSScreen.screens {
|
||||
let frame = screen.visibleFrame
|
||||
if windowTopLeftPoint.x >= frame.minX &&
|
||||
windowTopLeftPoint.x <= frame.maxX &&
|
||||
windowTopLeftPoint.y >= frame.minY &&
|
||||
windowTopLeftPoint.y <= frame.maxY {
|
||||
screenFrame = frame
|
||||
break
|
||||
}
|
||||
}
|
||||
window?.setFrameTopLeftPoint(newPoint)
|
||||
|
||||
let windowSize = window?.frame.size ?? NSSize.zero
|
||||
|
||||
// bottom beneath the screen?
|
||||
if adjustedPoint.y - windowSize.height < screenFrame.minY {
|
||||
adjustedPoint.y = screenFrame.minY + windowSize.height
|
||||
}
|
||||
|
||||
// top over the screen?
|
||||
if adjustedPoint.y >= screenFrame.maxY {
|
||||
adjustedPoint.y = screenFrame.maxY - 1.0
|
||||
}
|
||||
|
||||
// right
|
||||
if adjustedPoint.x + windowSize.width >= screenFrame.maxX {
|
||||
adjustedPoint.x = screenFrame.maxX - windowSize.width
|
||||
}
|
||||
|
||||
// left
|
||||
if adjustedPoint.x < screenFrame.minX {
|
||||
adjustedPoint.x = screenFrame.minX
|
||||
}
|
||||
|
||||
window?.setFrameTopLeftPoint(adjustedPoint)
|
||||
|
||||
}
|
||||
|
||||
private func adjustSize() {
|
||||
|
|
|
@ -32,3 +32,4 @@
|
|||
"There should not be duplicated keys." = "There should not be duplicated keys.";
|
||||
"Please specify at least 4 candidate keys." = "Please specify at least 4 candidate keys.";
|
||||
"Maximum 15 candidate keys allowed." = "Maximum 15 candidate keys allowed.";
|
||||
"⚠︎ Phrase replacement mode enabled, interfering user phrase entry." = "⚠︎ Phrase replacement mode enabled, interfering user phrase entry.";
|
||||
|
|
|
@ -32,3 +32,4 @@
|
|||
"There should not be duplicated keys." = "言選り用キー陣列に同じキーの重複登録はできません。";
|
||||
"Please specify at least 4 candidate keys." = "言選り用キー陣列に少なくとも4つのキーをご登録ください。";
|
||||
"Maximum 15 candidate keys allowed." = "言選り用キー陣列には最多15つキー登録できます。";
|
||||
"⚠︎ Phrase replacement mode enabled, interfering user phrase entry." = "⚠︎ 言葉置換機能稼働中、新添付言葉にも影響。";
|
||||
|
|
|
@ -32,3 +32,4 @@
|
|||
"There should not be duplicated keys." = "选字键不得重复。";
|
||||
"Please specify at least 4 candidate keys." = "请至少指定四个选字键。";
|
||||
"Maximum 15 candidate keys allowed." = "选字键最多只能指定十五个。";
|
||||
"⚠︎ Phrase replacement mode enabled, interfering user phrase entry." = "⚠︎ 语汇置换功能已启用,会波及语汇自订。";
|
||||
|
|
|
@ -32,3 +32,4 @@
|
|||
"There should not be duplicated keys." = "選字鍵不得重複。";
|
||||
"Please specify at least 4 candidate keys." = "請至少指定四個選字鍵。";
|
||||
"Maximum 15 candidate keys allowed." = "選字鍵最多只能指定十五個。";
|
||||
"⚠︎ Phrase replacement mode enabled, interfering user phrase entry." = "⚠︎ 語彙置換功能已啟用,會波及語彙自訂。";
|
||||
|
|
Loading…
Reference in New Issue