Skip to content

Commit 2463a51

Browse files
committed
Fixed syncScrollToView using wrong variable, added magic number 10 on building scrollMap
1 parent fe3950e commit 2463a51

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

public/js/syncscroll.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function buildMapInner(syncBack) {
221221
if (t !== 0) {
222222
nonEmptyList.push(t);
223223
}
224-
_scrollMap[t] = Math.round($el.offset().top + offset);
224+
_scrollMap[t] = Math.round($el.offset().top + offset - 10);
225225
}
226226

227227
nonEmptyList.push(linesCount);
@@ -297,7 +297,7 @@ function syncScrollToView(event, _lineNo) {
297297
var textHeight = editor.defaultTextHeight();
298298
lineNo = Math.floor(scrollInfo.top / textHeight);
299299
//if reach bottom, then scroll to end
300-
if (scrollInfo.height > scrollInfo.clientHeight && scrollInfo.top + scrollInfo.clientHeight >= scrollInfo.height - defaultTextHeight) {
300+
if (scrollInfo.height > scrollInfo.clientHeight && scrollInfo.top + scrollInfo.clientHeight >= scrollInfo.height - textHeight) {
301301
posTo = ui.area.view[0].scrollHeight - ui.area.view.height();
302302
} else {
303303
topDiffPercent = (scrollInfo.top % textHeight) / textHeight;

0 commit comments

Comments
 (0)