mirror of https://github.com/status-im/codimd.git
Fixed syncScrollToView using wrong variable, added magic number 10 on building scrollMap
This commit is contained in:
parent
fe3950ec9c
commit
2463a5126b
|
@ -221,7 +221,7 @@ function buildMapInner(syncBack) {
|
||||||
if (t !== 0) {
|
if (t !== 0) {
|
||||||
nonEmptyList.push(t);
|
nonEmptyList.push(t);
|
||||||
}
|
}
|
||||||
_scrollMap[t] = Math.round($el.offset().top + offset);
|
_scrollMap[t] = Math.round($el.offset().top + offset - 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
nonEmptyList.push(linesCount);
|
nonEmptyList.push(linesCount);
|
||||||
|
@ -297,7 +297,7 @@ function syncScrollToView(event, _lineNo) {
|
||||||
var textHeight = editor.defaultTextHeight();
|
var textHeight = editor.defaultTextHeight();
|
||||||
lineNo = Math.floor(scrollInfo.top / textHeight);
|
lineNo = Math.floor(scrollInfo.top / textHeight);
|
||||||
//if reach bottom, then scroll to end
|
//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();
|
posTo = ui.area.view[0].scrollHeight - ui.area.view.height();
|
||||||
} else {
|
} else {
|
||||||
topDiffPercent = (scrollInfo.top % textHeight) / textHeight;
|
topDiffPercent = (scrollInfo.top % textHeight) / textHeight;
|
||||||
|
|
Loading…
Reference in New Issue