Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f3dbfb

Browse files
committed
Considering text container insets in offset calculations, moved size menu item title to its own constant.
1 parent1699c5a commit2f3dbfb

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

‎SCXcodeMinimap/SCXcodeMinimap.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
NSString *constkShowMinimapMenuItemTitle =@"Show Minimap";
5454
NSString *constkHideMinimapMenuItemTitle =@"Hide Minimap";
5555

56+
NSString *constkSizeMenuItemTitle =@"Size";
57+
5658
NSString *constkHighlightBreakpointsMenuItemTitle =@"Highlight breakpoints";
5759
NSString *constkHighlightIssuesMenuItemTitle =@"Highlight issues";
5860
NSString *constkHighlightSelectedSymbolMenuItemTitle =@"Highlight selected symbol";
@@ -131,7 +133,7 @@ - (void)createMenuItem
131133
[sizeViewsetAutoresizingMask:NSViewMinXMargin | NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin];
132134

133135
NSTextField *sizeViewTitleLabel = [[NSTextFieldalloc]initWithFrame:NSMakeRect(18.0f,0.0f,50.0f,20.0f)];
134-
[sizeViewTitleLabelsetStringValue:@"Size"];
136+
[sizeViewTitleLabelsetStringValue:kSizeMenuItemTitle];
135137
[sizeViewTitleLabelsetFont:[NSFontsystemFontOfSize:14]];
136138
[sizeViewTitleLabelsetBezeled:NO];
137139
[sizeViewTitleLabelsetDrawsBackground:NO];

‎SCXcodeMinimap/SCXcodeMinimapView.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,15 +529,14 @@ - (void)updateOffset
529529
return;
530530
}
531531

532-
CGFloat ratio = (adjustedMinimapContentHeight / adjustedEditorContentHeight) * (1 / self.scrollView.magnification);
533-
CGPoint offset =NSMakePoint(self.editor.scrollView.contentView.bounds.origin.x,
534-
MAX(0,floorf(self.editor.scrollView.contentView.bounds.origin.y * ratio * self.scrollView.magnification)));
535-
536-
[self.scrollView.documentViewscrollPoint:offset];
532+
CGFloat editorYOffset =CGRectGetMinY(self.editor.scrollView.contentView.bounds) +ABS(CGRectGetMinY(self.editorTextView.frame));
537533

534+
CGFloat ratio = (adjustedMinimapContentHeight / adjustedEditorContentHeight) * (1 / self.scrollView.magnification);
535+
[self.scrollView.documentViewscrollPoint:NSMakePoint(self.editor.scrollView.contentView.bounds.origin.x,
536+
MAX(0,floorf(editorYOffset * ratio *self.scrollView.magnification)))];
538537

539538
ratio = (editorTextHeight - self.selectionView.bounds.size.height) / adjustedEditorContentHeight;
540-
selectionViewFrame.origin.y =self.editor.scrollView.contentView.bounds.origin.y * ratio;
539+
selectionViewFrame.origin.y =editorYOffset * ratio;
541540

542541
[self.selectionViewsetFrame:selectionViewFrame];
543542
}
@@ -569,6 +568,7 @@ - (void)handleMouseEvent:(NSEvent *)theEvent
569568

570569
NSRect neededRect = [self.editorTextView.layoutManagerboundingRectForGlyphRange:activeRangeinTextContainer:self.editorTextView.textContainer];
571570
neededRect.origin.y =MAX(0, neededRect.origin.y -CGRectGetHeight(self.editor.containerView.bounds) /2);
571+
neededRect.origin.y +=CGRectGetMinY(self.editorTextView.frame);
572572

573573
BOOL shouldAnimateContentOffset = (theEvent.type !=NSLeftMouseDragged);
574574

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp