From 20368fcd913d5038fd8bd01b12da900c460c6cef Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sat, 17 Jun 2023 14:40:16 +0800 Subject: [PATCH] SessionCtl // Extract resetCandidateWindowOrigin(). --- .../Sources/Shared/Protocols/CtlCandidateProtocol.swift | 1 + Source/Modules/SessionCtl_HandleDisplay.swift | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Packages/vChewing_Shared/Sources/Shared/Protocols/CtlCandidateProtocol.swift b/Packages/vChewing_Shared/Sources/Shared/Protocols/CtlCandidateProtocol.swift index 5c7f6836..6391891e 100644 --- a/Packages/vChewing_Shared/Sources/Shared/Protocols/CtlCandidateProtocol.swift +++ b/Packages/vChewing_Shared/Sources/Shared/Protocols/CtlCandidateProtocol.swift @@ -14,6 +14,7 @@ public protocol CtlCandidateDelegate { func candidatePairHighlightChanged(at index: Int) func candidatePairRightClicked(at index: Int, action: CandidateContextMenuAction) func candidates(_ sender: Any!) -> [Any]! + func resetCandidateWindowOrigin() @discardableResult func reverseLookup(for value: String) -> [String] var selectionKeys: String { get } var isVerticalTyping: Bool { get } diff --git a/Source/Modules/SessionCtl_HandleDisplay.swift b/Source/Modules/SessionCtl_HandleDisplay.swift index cf12c3a5..6b32d537 100644 --- a/Source/Modules/SessionCtl_HandleDisplay.swift +++ b/Source/Modules/SessionCtl_HandleDisplay.swift @@ -144,6 +144,10 @@ public extension SessionCtl { candidateUI?.delegate = self // 會自動觸發田所選字窗的資料重載。 candidateUI?.visible = true + resetCandidateWindowOrigin() + } + + func resetCandidateWindowOrigin() { if isVerticalTyping { candidateUI?.set( windowTopLeftPoint: NSPoint(