mirror of
https://github.com/discourse/discourse.git
synced 2025-03-27 10:05:46 +08:00
Fix scrollmap included NaN values.
This commit is contained in:
parent
9f0798682e
commit
ab839d134b
@ -231,21 +231,21 @@ export default Ember.Component.extend({
|
|||||||
|
|
||||||
let position = 0;
|
let position = 0;
|
||||||
|
|
||||||
_.times(numberOfLines, currentLineNumber => {
|
for (let i = 1; i < numberOfLines; i++) {
|
||||||
if (scrollMap[currentLineNumber] !== -1) {
|
if (scrollMap[i] !== -1) {
|
||||||
position++;
|
position++;
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let top = nonEmptyList[position];
|
let top = nonEmptyList[position];
|
||||||
let bottom = nonEmptyList[position + 1];
|
let bottom = nonEmptyList[position + 1];
|
||||||
|
|
||||||
scrollMap[currentLineNumber] =
|
scrollMap[i] =
|
||||||
((
|
((
|
||||||
scrollMap[bottom] * (currentLineNumber - top) +
|
scrollMap[bottom] * (i - top) +
|
||||||
scrollMap[top] * (bottom - currentLineNumber)
|
scrollMap[top] * (bottom - i)
|
||||||
) / (bottom - top)).toFixed(2);
|
) / (bottom - top)).toFixed(2);
|
||||||
});
|
};
|
||||||
|
|
||||||
return scrollMap;
|
return scrollMap;
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user