better handling of line heights
parent
2fff1c473f
commit
26c733e237
|
@ -356,13 +356,14 @@ Scroll.prototype.movePage = function (direction) {
|
||||||
const buffer = 25;
|
const buffer = 25;
|
||||||
// we need to remember that lineoffset needs to be removed too..
|
// we need to remember that lineoffset needs to be removed too..
|
||||||
let offset = linePosition.bottom - viewport.top;
|
let offset = linePosition.bottom - viewport.top;
|
||||||
|
let lineHeight = linePosition.top - linePosition.bottom;
|
||||||
let pixelsToScroll = viewport.top - viewport.bottom + offset;
|
let pixelsToScroll = viewport.top - viewport.bottom + offset;
|
||||||
if (direction === 'up') {
|
if (direction === 'up') {
|
||||||
// buffer pixels unscrolled our safety net here. You can't use the current or previous
|
// buffer pixels unscrolled our safety net here. You can't use the current or previous
|
||||||
// line height because it might be a very long line..
|
// line height because it might be a very long line..
|
||||||
pixelsToScroll = -Math.abs(pixelsToScroll + buffer/2);
|
pixelsToScroll = -Math.abs(pixelsToScroll - lineHeight);
|
||||||
} else {
|
} else {
|
||||||
pixelsToScroll = Math.abs(pixelsToScroll + buffer/2);
|
pixelsToScroll = Math.abs(pixelsToScroll - lineHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.outerWin.scrollBy(0, pixelsToScroll);
|
this.outerWin.scrollBy(0, pixelsToScroll);
|
||||||
|
|
Loading…
Reference in New Issue