fix(macos): lock menu width on hover

This commit is contained in:
Peter Steinberger
2025-12-27 01:50:13 +01:00
parent 8aff3979db
commit acd3f7dba7
2 changed files with 5 additions and 3 deletions

View File

@@ -73,6 +73,7 @@
- Menu bar session/node sections no longer reflow while open, keeping hover highlights aligned. - Menu bar session/node sections no longer reflow while open, keeping hover highlights aligned.
- Menu hover highlights now span the full width (including submenu arrows). - Menu hover highlights now span the full width (including submenu arrows).
- Menu session rows now refresh while open without width changes (no more stuck “Loading sessions…”). - Menu session rows now refresh while open without width changes (no more stuck “Loading sessions…”).
- Menu width no longer grows on hover when moving the mouse across rows.
- macOS node timeouts now share a single async timeout helper for consistent behavior. - macOS node timeouts now share a single async timeout helper for consistent behavior.
### Nodes & Canvas ### Nodes & Canvas

View File

@@ -25,7 +25,8 @@ final class HighlightedMenuItemHostView: NSView {
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
override var intrinsicContentSize: NSSize { override var intrinsicContentSize: NSSize {
self.hosting.fittingSize let size = self.hosting.fittingSize
return NSSize(width: self.targetWidth, height: size.height)
} }
override func updateTrackingAreas() { override func updateTrackingAreas() {
@@ -79,11 +80,11 @@ final class HighlightedMenuItemHostView: NSView {
} }
private func updateSizing() { private func updateSizing() {
let width = max(1, self.superview?.bounds.width ?? self.targetWidth) let width = max(1, self.targetWidth)
self.targetWidth = width
self.hosting.frame.size.width = width self.hosting.frame.size.width = width
let size = self.hosting.fittingSize let size = self.hosting.fittingSize
self.frame = NSRect(origin: .zero, size: NSSize(width: width, height: size.height)) self.frame = NSRect(origin: .zero, size: NSSize(width: width, height: size.height))
self.invalidateIntrinsicContentSize()
} }
} }