mirror of https://github.com/status-im/codimd.git
refactor: fix lint on public/js/lib/syncscroll.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
This commit is contained in:
parent
cc93ace031
commit
be527765bd
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue