From 2463a5126bee7d03093825dee8911ac87a8fae61 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Fri, 25 Sep 2015 18:17:08 +0800 Subject: [PATCH] Fixed syncScrollToView using wrong variable, added magic number 10 on building scrollMap --- public/js/syncscroll.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js index 30ff43c..8ca9f84 100644 --- a/public/js/syncscroll.js +++ b/public/js/syncscroll.js @@ -221,7 +221,7 @@ function buildMapInner(syncBack) { if (t !== 0) { nonEmptyList.push(t); } - _scrollMap[t] = Math.round($el.offset().top + offset); + _scrollMap[t] = Math.round($el.offset().top + offset - 10); } nonEmptyList.push(linesCount); @@ -297,7 +297,7 @@ function syncScrollToView(event, _lineNo) { var textHeight = editor.defaultTextHeight(); lineNo = Math.floor(scrollInfo.top / textHeight); //if reach bottom, then scroll to end - if (scrollInfo.height > scrollInfo.clientHeight && scrollInfo.top + scrollInfo.clientHeight >= scrollInfo.height - defaultTextHeight) { + if (scrollInfo.height > scrollInfo.clientHeight && scrollInfo.top + scrollInfo.clientHeight >= scrollInfo.height - textHeight) { posTo = ui.area.view[0].scrollHeight - ui.area.view.height(); } else { topDiffPercent = (scrollInfo.top % textHeight) / textHeight;