From 8f9578633c16941263cdc3174bd9df2a4fdffd0a Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Tue, 23 Aug 2022 12:53:06 +0800 Subject: [PATCH] KeyHandler // +isIntonationKey. --- Source/Modules/ControllerModules/KeyHandler_Core.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Modules/ControllerModules/KeyHandler_Core.swift b/Source/Modules/ControllerModules/KeyHandler_Core.swift index 5f0112c6..e67ad368 100644 --- a/Source/Modules/ControllerModules/KeyHandler_Core.swift +++ b/Source/Modules/ControllerModules/KeyHandler_Core.swift @@ -381,6 +381,16 @@ public class KeyHandler { return (rawData, rawDataSansIntonation, hasIntonation) } + /// 檢測某個傳入的按鍵訊號是否為聲調鍵。 + /// - Parameter input: 傳入的按鍵訊號。 + /// - Returns: 判斷結果:是否為聲調鍵。 + func isIntonationKey(_ input: InputSignal) -> Bool { + var theComposer = composer // 複製一份用來做實驗。 + theComposer.clear() // 清空各種槽的內容。 + theComposer.receiveKey(fromCharCode: input.charCode) + return theComposer.hasToneMarker(withNothingElse: true) + } + // MARK: - Extracted methods and functions (Megrez). /// 將輸入法偏好設定同步至語言模組內。