mirror of
https://github.com/pawelorzech/FastMemos.git
synced 2026-01-30 04:04:31 +00:00
feat: Update macOS deployment target and redesign the note window with a borderless style and custom glass effect.
This commit is contained in:
parent
77252f828d
commit
6eb93a5ea0
2 changed files with 9 additions and 37 deletions
|
|
@ -258,7 +258,7 @@
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
MACOSX_DEPLOYMENT_TARGET = 26.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
|
@ -315,7 +315,7 @@
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
MACOSX_DEPLOYMENT_TARGET = 26.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class NotePanel: NSPanel {
|
||||||
|
|
||||||
super.init(
|
super.init(
|
||||||
contentRect: NSRect(x: 0, y: 0, width: 500, height: 280),
|
contentRect: NSRect(x: 0, y: 0, width: 500, height: 280),
|
||||||
styleMask: [.titled, .closable, .resizable, .fullSizeContentView],
|
styleMask: [.borderless, .fullSizeContentView],
|
||||||
backing: .buffered,
|
backing: .buffered,
|
||||||
defer: false
|
defer: false
|
||||||
)
|
)
|
||||||
|
|
@ -29,11 +29,8 @@ class NotePanel: NSPanel {
|
||||||
self.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
self.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
||||||
self.backgroundColor = .clear
|
self.backgroundColor = .clear
|
||||||
self.isOpaque = false
|
self.isOpaque = false
|
||||||
|
self.hasShadow = true
|
||||||
|
|
||||||
// Hide traffic light buttons
|
|
||||||
self.standardWindowButton(.closeButton)?.isHidden = true
|
|
||||||
self.standardWindowButton(.miniaturizeButton)?.isHidden = true
|
|
||||||
self.standardWindowButton(.zoomButton)?.isHidden = true
|
|
||||||
|
|
||||||
// Set minimum size
|
// Set minimum size
|
||||||
self.minSize = NSSize(width: 400, height: 200)
|
self.minSize = NSSize(width: 400, height: 200)
|
||||||
|
|
@ -42,32 +39,12 @@ class NotePanel: NSPanel {
|
||||||
// Center on screen
|
// Center on screen
|
||||||
self.center()
|
self.center()
|
||||||
|
|
||||||
// Create visual effect view for frosted glass
|
|
||||||
let visualEffectView = NSVisualEffectView()
|
|
||||||
visualEffectView.material = .hudWindow
|
|
||||||
visualEffectView.blendingMode = .behindWindow
|
|
||||||
visualEffectView.state = .active
|
|
||||||
visualEffectView.wantsLayer = true
|
|
||||||
visualEffectView.layer?.cornerRadius = 16
|
|
||||||
visualEffectView.layer?.masksToBounds = true
|
|
||||||
|
|
||||||
let contentView = NoteWindowView(appState: appState, closeWindow: { [weak self] in
|
let contentView = NoteWindowView(appState: appState, closeWindow: { [weak self] in
|
||||||
self?.orderOut(nil)
|
self?.orderOut(nil)
|
||||||
})
|
})
|
||||||
|
|
||||||
hostingView = NSHostingView(rootView: contentView)
|
hostingView = NSHostingView(rootView: contentView)
|
||||||
hostingView?.translatesAutoresizingMaskIntoConstraints = false
|
self.contentView = hostingView
|
||||||
visualEffectView.addSubview(hostingView!)
|
|
||||||
|
|
||||||
// Constrain hosting view to fill the visual effect view
|
|
||||||
NSLayoutConstraint.activate([
|
|
||||||
hostingView!.leadingAnchor.constraint(equalTo: visualEffectView.leadingAnchor),
|
|
||||||
hostingView!.trailingAnchor.constraint(equalTo: visualEffectView.trailingAnchor),
|
|
||||||
hostingView!.topAnchor.constraint(equalTo: visualEffectView.topAnchor),
|
|
||||||
hostingView!.bottomAnchor.constraint(equalTo: visualEffectView.bottomAnchor)
|
|
||||||
])
|
|
||||||
|
|
||||||
self.contentView = visualEffectView
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func showWindow() {
|
func showWindow() {
|
||||||
|
|
@ -77,11 +54,6 @@ class NotePanel: NSPanel {
|
||||||
})
|
})
|
||||||
hostingView?.rootView = contentView
|
hostingView?.rootView = contentView
|
||||||
|
|
||||||
// Hide traffic light buttons again (in case they reset)
|
|
||||||
self.standardWindowButton(.closeButton)?.isHidden = true
|
|
||||||
self.standardWindowButton(.miniaturizeButton)?.isHidden = true
|
|
||||||
self.standardWindowButton(.zoomButton)?.isHidden = true
|
|
||||||
|
|
||||||
self.center()
|
self.center()
|
||||||
self.makeKeyAndOrderFront(nil)
|
self.makeKeyAndOrderFront(nil)
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
|
@ -208,9 +180,9 @@ struct NoteWindowView: View {
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 16)
|
.padding(.horizontal, 16)
|
||||||
.padding(.vertical, 12)
|
.padding(.vertical, 12)
|
||||||
.background(.ultraThinMaterial)
|
|
||||||
}
|
}
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 16))
|
.padding(4)
|
||||||
|
.glassEffect(.regular, in: .rect(cornerRadius: 20))
|
||||||
.frame(minWidth: 400, minHeight: 200)
|
.frame(minWidth: 400, minHeight: 200)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
visibility = appState.defaultVisibility
|
visibility = appState.defaultVisibility
|
||||||
|
|
@ -219,8 +191,8 @@ struct NoteWindowView: View {
|
||||||
.onExitCommand {
|
.onExitCommand {
|
||||||
closeWindow()
|
closeWindow()
|
||||||
}
|
}
|
||||||
.animation(.easeInOut(duration: 0.2), value: showSuccess)
|
.animation(Animation.easeInOut(duration: 0.2), value: showSuccess)
|
||||||
.animation(.easeInOut(duration: 0.2), value: errorMessage)
|
.animation(Animation.easeInOut(duration: 0.2), value: errorMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var wordCount: Int {
|
private var wordCount: Int {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue