Skip to content

Commit e63be6e

Browse files
committed
Fixes #48 - allow scrolling the main editor while on top of the minimap
1 parent ba71d64 commit e63be6e

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

SCXcodeMinimap/SCXcodeMinimapScrollView.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@
1010

1111
@interface SCXcodeMinimapScrollView : NSScrollView
1212

13+
- (instancetype)initWithFrame:(CGRect)frame
14+
editorScrollView:(NSScrollView *)scrollView;
15+
1316
@end

SCXcodeMinimap/SCXcodeMinimapScrollView.m

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,27 @@
88

99
#import "SCXcodeMinimapScrollView.h"
1010

11+
@interface SCXcodeMinimapScrollView ()
12+
13+
@property (nonatomic, strong) NSScrollView *editorScrollView;
14+
15+
@end
16+
1117
@implementation SCXcodeMinimapScrollView
1218

19+
- (instancetype)initWithFrame:(CGRect)frame
20+
editorScrollView:(NSScrollView *)scrollView
21+
{
22+
if(self = [super initWithFrame:frame]) {
23+
_editorScrollView = scrollView;
24+
}
25+
26+
return self;
27+
}
28+
1329
- (void)scrollWheel:(NSEvent *)theEvent
1430
{
15-
// Disable the scroll wheel on top of the minimap
31+
[self.editorScrollView scrollWheel:theEvent];
1632
}
1733

1834
@end

SCXcodeMinimap/SCXcodeMinimapView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ - (instancetype)initWithEditor:(IDESourceCodeEditor *)editor
116116
[self setWantsLayer:YES];
117117
[self setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin | NSViewWidthSizable | NSViewHeightSizable];
118118

119-
self.scrollView = [[SCXcodeMinimapScrollView alloc] initWithFrame:self.bounds];
119+
self.scrollView = [[SCXcodeMinimapScrollView alloc] initWithFrame:self.bounds editorScrollView:self.editor.scrollView];
120120
[self.scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
121121
[self.scrollView setDrawsBackground:NO];
122122
[self.scrollView setMinMagnification:0.0f];

0 commit comments

Comments
 (0)