Skip to content

Commit

Permalink
Fix scroller sync when scroll-past-end is off
Browse files Browse the repository at this point in the history
Fix #217.
  • Loading branch information
uranusjr committed Dec 13, 2014
1 parent 884561d commit 98bf7c3
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion MacDown/Code/View/MPEditorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@
#import "MPEditorView.h"


NS_INLINE BOOL MPAreRectsEqual(NSRect r1, NSRect r2)
{
return (r1.origin.x == r2.origin.x && r1.origin.y == r2.origin.y
&& r1.size.width == r2.size.width
&& r1.size.height == r2.size.height);
}


@interface MPEditorView ()

@property NSRect contentRect;
@property (nonatomic) NSRect contentRect;
@property CGFloat trailingHeight;

@end


@implementation MPEditorView

@synthesize contentRect = _contentRect;
@synthesize scrollsPastEnd = _scrollsPastEnd;

- (BOOL)scrollsPastEnd
Expand All @@ -38,9 +47,21 @@ - (void)setScrollsPastEnd:(BOOL)scrollsPastEnd
[self updateContentGeometry];
}];
}
else
{
// Clears contentRect to fallback to self.frame.
self.contentRect = NSZeroRect;
}
}
}

- (NSRect)contentRect
{
if (MPAreRectsEqual(_contentRect, NSZeroRect))
return self.frame;
return _contentRect;
}

- (void)setFrameSize:(NSSize)newSize
{
if (self.scrollsPastEnd)
Expand Down

0 comments on commit 98bf7c3

Please sign in to comment.