fix: panel may re-center when searching
This commit is contained in:
1 parent
9f3e20a826
commit
a1f8b18888
1 file changed
+2
-7
@@ -6,7 +6,6 @@ class TilesPanel: NSPanel {
|
||||
static var maxPossibleAppIconSize = NSSize.zero
|
||||
static var shared: TilesPanel!
|
||||
private var frozenTopCenter: NSPoint?
|
||||
private var highWaterWidth: CGFloat = 0
|
||||
private var highWaterHeight: CGFloat = 0
|
||||
|
||||
convenience init() {
|
||||
@@ -56,21 +55,17 @@ class TilesPanel: NSPanel {
|
||||
resetFrozenPosition()
|
||||
return
|
||||
}
|
||||
if size.width > highWaterWidth || size.height > highWaterHeight {
|
||||
if size.height > highWaterHeight {
|
||||
NSScreen.preferred.repositionPanel(self)
|
||||
highWaterWidth = size.width
|
||||
highWaterHeight = size.height
|
||||
frozenTopCenter = NSPoint(x: frame.midX, y: frame.maxY)
|
||||
} else if let topCenter = frozenTopCenter {
|
||||
let x = topCenter.x - size.width * 0.5
|
||||
let y = topCenter.y - size.height
|
||||
setFrameOrigin(NSPoint(x: x, y: y))
|
||||
setFrameOrigin(NSPoint(x: topCenter.x - size.width * 0.5, y: topCenter.y - size.height))
|
||||
}
|
||||
}
|
||||
|
||||
func resetFrozenPosition() {
|
||||
frozenTopCenter = nil
|
||||
highWaterWidth = 0
|
||||
highWaterHeight = 0
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user