summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorWu Cheng-Han2015-09-25 18:17:08 +0800
committerWu Cheng-Han2015-09-25 18:17:08 +0800
commit2463a5126bee7d03093825dee8911ac87a8fae61 (patch)
tree8ec21391e4c9af88063ab4a85ac335deb1b4f1d3 /public
parentfe3950ec9c92a97ae2238d0e5ed57f57baa594f3 (diff)
Fixed syncScrollToView using wrong variable, added magic number 10 on building scrollMap
Diffstat (limited to 'public')
-rw-r--r--public/js/syncscroll.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js
index 30ff43ce..8ca9f845 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;