Skip to content

Commit

Permalink
Merge branch 'dev' into phlpsong/disabled_tab_swiftui
Browse files Browse the repository at this point in the history
  • Loading branch information
phlpsong committed Jan 20, 2024
2 parents 93e2fe6 + 25b651c commit b1a1df8
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions Easydict/NewApp/View/SettingView/SettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,25 @@ struct SettingView: View {
func resizeWindowFrame() {
guard let window else { return }

let originalFrame = window.frame
let newSize = switch selection {
case .general, .privacy, .about, .disabled:
CGSize(width: 500, height: 520)
case .service:
CGSize(width: 800, height: 520)
// Disable zoom button, ref: https://stackoverflow.com/a/66039864/8378840
window.standardWindowButton(.zoomButton)?.isEnabled = false

// Keep the settings page windows all the same width to avoid strange animations.
let maxWidth = 650
let height = switch selection {
case .general:
maxWidth
case .service, .disabled:
500
case .privacy:
320
case .about:
450
}

let newSize = CGSize(width: maxWidth, height: height)

let originalFrame = window.frame
let newY = originalFrame.origin.y + originalFrame.size.height - newSize.height
let newRect = NSRect(origin: CGPoint(x: originalFrame.origin.x, y: newY), size: newSize)

Expand Down

0 comments on commit b1a1df8

Please sign in to comment.