ctlTooltip // Disable vertical display on macOS 10.11 and 10.12.

- These versions of macOS don't draw NSAttributedStrings well.
This commit is contained in:
ShikiSuen 2022-09-09 23:19:25 +08:00
parent 624ada4294
commit 23b5428383
2 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ extension ctlInputMethod {
x: lineHeightRect.origin.x + lineHeightRect.size.width + 5, y: lineHeightRect.origin.y x: lineHeightRect.origin.x + lineHeightRect.size.width + 5, y: lineHeightRect.origin.y
) )
} }
var tooltipContentDirection: NSAttributedTextView.writingDirection = { let tooltipContentDirection: NSAttributedTextView.writingDirection = {
if mgrPrefs.alwaysShowTooltipTextsHorizontally { return .horizontal } if mgrPrefs.alwaysShowTooltipTextsHorizontally { return .horizontal }
return isVerticalTyping ? .vertical : .horizontal return isVerticalTyping ? .vertical : .horizontal
}() }()

View File

@ -28,6 +28,7 @@ public class ctlTooltip: NSWindowController {
public var direction: NSAttributedTextView.writingDirection = .horizontal { public var direction: NSAttributedTextView.writingDirection = .horizontal {
didSet { didSet {
if #unavailable(macOS 10.13) { direction = .horizontal }
messageText.direction = direction messageText.direction = direction
} }
} }
@ -59,7 +60,6 @@ public class ctlTooltip: NSWindowController {
direction: NSAttributedTextView.writingDirection = .horizontal direction: NSAttributedTextView.writingDirection = .horizontal
) { ) {
self.direction = direction self.direction = direction
messageText.direction = self.direction
self.tooltip = tooltip self.tooltip = tooltip
window?.orderFront(nil) window?.orderFront(nil)
set(windowTopLeftPoint: point, bottomOutOfScreenAdjustmentHeight: heightDelta) set(windowTopLeftPoint: point, bottomOutOfScreenAdjustmentHeight: heightDelta)