Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Hot/Classes/InfoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,22 @@ public class InfoViewController: NSViewController
self.graphView?.addData( speed: 100, temperature: self.temperature )
}

self.graphViewHeight.constant = self.graphView?.canDisplay ?? false ? 100 : 0
let newGraphHeight: CGFloat = self.graphView?.canDisplay ?? false ? 100 : 0

if self.graphViewHeight.constant != newGraphHeight
{
self.graphViewHeight.constant = newGraphHeight

// The InfoViewController's view is hosted inside an NSMenuItem (see
// ApplicationDelegate.applicationDidFinishLaunching). NSMenu measures
// the custom view once and does not observe later Auto Layout changes,
// so when the graph height flips from 0 -> 100 the menu item's host
// frame stays at the original (smaller) size and clips the top of the
// graph. Force a layout pass and propagate the new fitting size to the
// view's frame so the menu picks up the change.
self.view.layoutSubtreeIfNeeded()
self.view.frame.size = self.view.fittingSize
}

self.onUpdate?()
}
Expand Down