From 5537042e611e1f47cb5d37c6b4684111922e8412 Mon Sep 17 00:00:00 2001 From: zhiayang Date: Fri, 3 Jun 2022 00:47:31 +0800 Subject: [PATCH] 0.17.11: actually fix the appearing-wrongly bug --- MoeStreamer.xcodeproj/project.pbxproj | 4 ++-- MoeStreamer/src/ui/MainView.swift | 5 ++++- MoeStreamer/src/ui/ViewController.swift | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/MoeStreamer.xcodeproj/project.pbxproj b/MoeStreamer.xcodeproj/project.pbxproj index cdc4cbe..d57c746 100644 --- a/MoeStreamer.xcodeproj/project.pbxproj +++ b/MoeStreamer.xcodeproj/project.pbxproj @@ -673,7 +673,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 0.17.10; + MARKETING_VERSION = 0.17.11; PRODUCT_BUNDLE_IDENTIFIER = com.zhiayang.MoeStreamer; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; @@ -708,7 +708,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 0.17.10; + MARKETING_VERSION = 0.17.11; PRODUCT_BUNDLE_IDENTIFIER = com.zhiayang.MoeStreamer; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; diff --git a/MoeStreamer/src/ui/MainView.swift b/MoeStreamer/src/ui/MainView.swift index 7595080..4f0846e 100644 --- a/MoeStreamer/src/ui/MainView.swift +++ b/MoeStreamer/src/ui/MainView.swift @@ -38,6 +38,9 @@ class SubViewKind : ObservableObject struct MainView : View { + static let VIEW_WIDTH: CGFloat = 320 + static let VIEW_HEIGHT: CGFloat = 128 + @Environment(\.colorScheme) var colourScheme: ColorScheme @@ -289,7 +292,7 @@ struct MainView : View } .padding(.trailing, -12) } - .frame(width: 320, height: 128, alignment: .leading) + .frame(width: MainView.VIEW_WIDTH, height: MainView.VIEW_HEIGHT, alignment: .leading) .padding(.horizontal, 16) .onAppear { if let x: Bool = Settings.get(.shouldAutoRefresh()), x { diff --git a/MoeStreamer/src/ui/ViewController.swift b/MoeStreamer/src/ui/ViewController.swift index 1e2190a..57a8523 100644 --- a/MoeStreamer/src/ui/ViewController.swift +++ b/MoeStreamer/src/ui/ViewController.swift @@ -123,7 +123,6 @@ class ViewController : NSObject, NSPopoverDelegate statusBarButton.action = #selector(togglePopover(sender:)) statusBarButton.target = self - popover.contentSize = NSSize(width: 320, height: 500) popover.contentViewController = NSHostingController(rootView: self.rootView) popover.behavior = .transient popover.delegate = self @@ -193,6 +192,7 @@ class ViewController : NSObject, NSPopoverDelegate func showPopover() { + self.popover.contentSize = NSSize(width: MainView.VIEW_WIDTH, height: MainView.VIEW_HEIGHT) self.popover.show(relativeTo: statusBarButton.bounds, of: statusBarButton, preferredEdge: NSRectEdge.minY) self.popover.contentViewController?.view.window?.makeKey()