diff --git a/Captuocr/RecognizeBoxViewModel.swift b/Captuocr/RecognizeBoxViewModel.swift index b887367..21ab031 100644 --- a/Captuocr/RecognizeBoxViewModel.swift +++ b/Captuocr/RecognizeBoxViewModel.swift @@ -16,9 +16,9 @@ class RecognizeBoxViewModel { extension RecognizeBoxViewController { func bindViewModel() { - if let setting = AppDelegate.container.resolve(Settings.self) { - textArea.font = NSFont.userFont(ofSize: CGFloat(setting.appearence.fontsize)) - } + combineLatest(viewmodel.recognizedText, viewmodel.image).observeNext { (_) in + self.performFontSize() + }.dispose(in: imageArea.reactive.bag) viewmodel.recognizedText.bind(to: textArea.reactive.string).dispose(in: layout.bag) viewmodel.image.map { (base64) -> NSImage? in if let data = Data(base64Encoded: base64, options: Data.Base64DecodingOptions(rawValue: 0)) { @@ -27,4 +27,10 @@ extension RecognizeBoxViewController { return nil }.bind(to: imageArea.reactive.image) } + + func performFontSize() { + if let setting = AppDelegate.container.resolve(Settings.self) { + textArea.font = NSFont.userFont(ofSize: CGFloat(setting.appearence.fontsize)) + } + } }