Avoid rendering attempts outside the canvas

pull/97081/head
Alex Dima 2020-05-06 16:02:40 +02:00
parent e4de071f18
commit 4c6b933234
No known key found for this signature in database
GPG Key ID: 6E58D7B045760DA0
1 changed files with 2 additions and 1 deletions

View File

@ -263,7 +263,8 @@ class MinimapLayout {
const computedSliderRatio = (maxMinimapSliderTop) / (scrollHeight - viewportHeight);
const sliderTop = (scrollTop * computedSliderRatio);
const sliderNeeded = (maxMinimapSliderTop > 0);
return new MinimapLayout(scrollTop, scrollHeight, sliderNeeded, computedSliderRatio, sliderTop, sliderHeight, 1, lineCount);
const maxLinesFitting = Math.floor(options.canvasInnerHeight / options.minimapLineHeight);
return new MinimapLayout(scrollTop, scrollHeight, sliderNeeded, computedSliderRatio, sliderTop, sliderHeight, 1, Math.min(lineCount, maxLinesFitting));
}
// The visible line count in a viewport can change due to a number of reasons: