Skip to content

Commit

Permalink
Fix next event being scaled by accessibility (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakerwreah committed Nov 11, 2024
1 parent 993237f commit 4c232e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Calendr.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.14.4;
MARKETING_VERSION = 1.14.5;
PRODUCT_BUNDLE_IDENTIFIER = br.paker.Calendr;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Calendr/Config/Calendr-Bridging-Header.h";
Expand Down Expand Up @@ -1515,7 +1515,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.14.4;
MARKETING_VERSION = 1.14.5;
PRODUCT_BUNDLE_IDENTIFIER = br.paker.Calendr;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Calendr/Config/Calendr-Bridging-Header.h";
Expand Down
20 changes: 6 additions & 14 deletions Calendr/MenuBar/NextEventView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class NextEventView: NSView {
private let viewModel: NextEventViewModel

private let colorBar = NSView()
private let nextEventTitle = Label()
private let nextEventTime = Label()
private let nextEventTitle: Label
private let nextEventTime: Label
private let nextEventView = NSStackView()

init(viewModel: NextEventViewModel) {
Expand All @@ -32,6 +32,10 @@ class NextEventView: NSView {
.map { $0 ? max($1 - 10, 0) : 0 }
.distinctUntilChanged()

let font = NSFont.systemFont(ofSize: 10)
nextEventTitle = Label(font: font, scaling: viewModel.textScaling)
nextEventTime = Label(font: font, scaling: viewModel.textScaling)

super.init(frame: .zero)

configureLayout()
Expand Down Expand Up @@ -71,18 +75,6 @@ class NextEventView: NSView {

private func setUpBindings() {

let fontSizeObservable = viewModel.textScaling
.map { NSFont.systemFont(ofSize: 10 * CGFloat($0)) }
.share(replay: 1)

fontSizeObservable
.bind(to: nextEventTitle.rx.font)
.disposed(by: disposeBag)

fontSizeObservable
.bind(to: nextEventTime.rx.font)
.disposed(by: disposeBag)

Observable.combineLatest(
viewModel.barStyle,
viewModel.barColor.map(\.cgColor)
Expand Down

0 comments on commit 4c232e3

Please sign in to comment.