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
11 changes: 11 additions & 0 deletions DYWrappingMatrix.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ - (void)awakeFromNib {
selector:@selector(resize:)
name:NSViewFrameDidChangeNotification
object:self.enclosingScrollView];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(resize:) name:NSApplicationDidChangeScreenParametersNotification object:nil];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(resize:) name:NSWindowDidChangeScreenNotification object:self.window];
[self.enclosingScrollView.contentView setPostsBoundsChangedNotifications:YES];
NSUserDefaults *udf = NSUserDefaults.standardUserDefaults;
float padding = [udf floatForKey:@"thumbPadding"];
Expand Down Expand Up @@ -541,6 +543,15 @@ - (void)mouseDown:(NSEvent *)theEvent {
}

- (void)resize:(id)anObject { // called by notification center
// ensure our width matches the clip view, otherwise we might not be using all available space
// (or worse, be wider than the clip view and have horizontal scrollbars)
NSRect frame = self.frame;
float w = self.superview.bounds.size.width;
if (fabs(frame.size.width - w) > 1.0) {
frame.size.width = w;
self.frame = frame;
}

[self calculateCellSizes];
NSSize mySize = self.frame.size;
NSUInteger numRows = numCells == 0 ? 0 : (numCells-1)/numCols + 1;
Expand Down