Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Font size changing did not take effect before restarting program
Browse files Browse the repository at this point in the history
  • Loading branch information
sfragrance committed Dec 4, 2017
1 parent 66a401c commit 498f309
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Captuocr/RecognizeBoxViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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))
}
}
}

0 comments on commit 498f309

Please sign in to comment.