refactor: fix lint on public/js/lib/syncscroll.js

Signed-off-by: BoHong Li <raccoon@hackmd.io>
This commit is contained in:
BoHong Li 2019-08-02 01:02:44 +08:00
parent cc93ace031
commit be527765bd
No known key found for this signature in database
GPG Key ID: 06770355DC9ECD38
1 changed files with 8 additions and 8 deletions

View File

@ -174,12 +174,12 @@ const buildMap = _.throttle(buildMapInner, buildMapThrottle)
// Optimizations are required only for big texts.
function buildMapInner (callback) {
if (!viewArea || !markdownArea) return
let i, offset, nonEmptyList, pos, a, b, _lineHeightMap, linesCount, acc, _scrollMap
let i, pos, a, b, acc
offset = viewArea.scrollTop() - viewArea.offset().top
_scrollMap = []
nonEmptyList = []
_lineHeightMap = []
const offset = viewArea.scrollTop() - viewArea.offset().top
const _scrollMap = []
const nonEmptyList = []
const _lineHeightMap = []
viewTop = 0
viewBottom = viewArea[0].scrollHeight - viewArea.height()
@ -200,7 +200,7 @@ function buildMapInner (callback) {
acc += Math.round(h / lineHeight)
}
_lineHeightMap.push(acc)
linesCount = acc
const linesCount = acc
for (i = 0; i < linesCount; i++) {
_scrollMap.push(-1)
@ -350,11 +350,11 @@ export function syncScrollToView (event, preventAnimate) {
}
if (viewScrolling) return
let lineNo, posTo
let posTo
let topDiffPercent, posToNextDiff
const scrollInfo = editor.getScrollInfo()
const textHeight = editor.defaultTextHeight()
lineNo = Math.floor(scrollInfo.top / textHeight)
const lineNo = Math.floor(scrollInfo.top / textHeight)
// if reach the last line, will start lerp to the bottom
const diffToBottom = (scrollInfo.top + scrollInfo.clientHeight) - (scrollInfo.height - textHeight)
if (scrollInfo.height > scrollInfo.clientHeight && diffToBottom > 0) {