From 624ada429483b101993d58ee77336a3869047ad8 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Fri, 9 Sep 2022 12:50:50 +0800 Subject: [PATCH] ctlIME // +alwaysShowTooltipTextsHorizontally. --- .../ctlInputMethod_HandleDisplay.swift | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift index d4f71d4f..40e49585 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift @@ -32,16 +32,15 @@ extension ctlInputMethod { finalOrigin = NSPoint( x: lineHeightRect.origin.x + lineHeightRect.size.width + 5, y: lineHeightRect.origin.y ) - ctlInputMethod.tooltipInstance.show( - tooltip: tooltip, at: finalOrigin, - bottomOutOfScreenAdjustmentHeight: delta, direction: .vertical - ) - } else { - ctlInputMethod.tooltipInstance.show( - tooltip: tooltip, at: finalOrigin, - bottomOutOfScreenAdjustmentHeight: delta, direction: .horizontal - ) } + var tooltipContentDirection: NSAttributedTextView.writingDirection = { + if mgrPrefs.alwaysShowTooltipTextsHorizontally { return .horizontal } + return isVerticalTyping ? .vertical : .horizontal + }() + ctlInputMethod.tooltipInstance.show( + tooltip: tooltip, at: finalOrigin, + bottomOutOfScreenAdjustmentHeight: delta, direction: tooltipContentDirection + ) } func show(candidateWindowWith state: IMEStateProtocol) {