Skip to content

Commit

Permalink
MenuBarSearchPanel set frame size
Browse files Browse the repository at this point in the history
Without setting the frame size, on the first opening of the search panel it is shown at the top right of the screen.

Signed-off-by: Toni Förster <[email protected]>
  • Loading branch information
stonerl committed Aug 9, 2024
1 parent b6bdc04 commit 4fb79b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Ice/MenuBarSearch/MenuBarSearchPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ class MenuBarSearchPanel: NSPanel {
return
}

// important that we set the navigation before updating the cache
// Set the desired frame size for the panel before positioning
let panelSize = CGSize(width: 600, height: 400)
setFrame(NSRect(origin: .zero, size: panelSize), display: false)

// Important that we set the navigation before updating the cache
appState.navigationState.isSearchPresented = true

await appState.imageCache.updateCache()
Expand Down Expand Up @@ -97,6 +101,7 @@ class MenuBarSearchPanel: NSPanel {
mouseDownMonitor?.start()
keyDownMonitor?.start()

// Calculate the top-left position
let topLeft = CGPoint(
x: screen.frame.midX - frame.width / 2,
y: screen.frame.midY + (frame.height / 2) + (screen.frame.height / 8)
Expand Down

0 comments on commit 4fb79b0

Please sign in to comment.