fix: restore sidebar header and balance footer sizing
This commit is contained in:
@@ -70,6 +70,30 @@ private enum WindowLayoutCheck {
|
||||
sawIntermediateFrame = false
|
||||
}
|
||||
|
||||
static func sidebarHeaderIsVisible(in window: NSWindow) -> Bool {
|
||||
guard let content = window.contentView else { return false }
|
||||
let header = NSRect(x: content.bounds.maxX - 84,
|
||||
y: content.isFlipped ? content.bounds.minY : content.bounds.maxY - 32,
|
||||
width: 84, height: 32)
|
||||
guard let bitmap = content.bitmapImageRepForCachingDisplay(in: header) else { return false }
|
||||
content.cacheDisplay(in: header, to: bitmap)
|
||||
let scale = CGFloat(bitmap.pixelsWide) / header.width
|
||||
// Each control must paint a visible glyph, not merely exist in the view tree.
|
||||
return (0..<3).allSatisfy { index in
|
||||
var visiblePixels = 0
|
||||
for x in Int(CGFloat(index * 28) * scale)..<Int(CGFloat(index * 28 + 24) * scale) {
|
||||
for y in 0..<bitmap.pixelsHigh {
|
||||
if let color = bitmap.colorAt(x: x, y: y)?.usingColorSpace(.deviceRGB),
|
||||
color.alphaComponent > 0.5,
|
||||
min(color.redComponent, color.greenComponent, color.blueComponent) > 0.5 {
|
||||
visiblePixels += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
return visiblePixels >= 8
|
||||
}
|
||||
}
|
||||
|
||||
static func advance() {
|
||||
let model = PlayerModel.shared
|
||||
guard ContinuousClock.now < deadline else { finish("Window layout did not settle at step \(step)"); return }
|
||||
@@ -95,6 +119,9 @@ private enum WindowLayoutCheck {
|
||||
if windowIdentity == nil { windowIdentity = ObjectIdentifier(window) }
|
||||
guard ObjectIdentifier(window) == windowIdentity else { finish("Transition replaced the playback window"); return }
|
||||
window.layoutIfNeeded()
|
||||
if model.showsQueue && !model.isCompact && !sidebarHeaderIsVisible(in: window) {
|
||||
finish("Sidebar pin, Cast or settings glyph is not visible at step \(step)"); return
|
||||
}
|
||||
switch step % 8 {
|
||||
case 0, 4:
|
||||
if step > 0 {
|
||||
|
||||
Reference in New Issue
Block a user