mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
much better ux
This commit is contained in:
parent
a536b311e4
commit
92450e071d
2 changed files with 5 additions and 7 deletions
|
@ -3061,8 +3061,8 @@ function Ace2Inner() {
|
||||||
if (isPageUp) {
|
if (isPageUp) {
|
||||||
top.console.log('page up');
|
top.console.log('page up');
|
||||||
// go to the top of the visible content
|
// go to the top of the visible content
|
||||||
rep.selStart[0] -= visibleLineRange[1] - visibleLineRange[0];
|
rep.selStart[0] -= visibleLineRange[1] - visibleLineRange[0] + 1;
|
||||||
rep.selEnd[0] -= visibleLineRange[1] - visibleLineRange[0];
|
rep.selEnd[0] -= visibleLineRange[1] - visibleLineRange[0] + 1;
|
||||||
// if the new rep is beyond the viewport, put the caret on the last line
|
// if the new rep is beyond the viewport, put the caret on the last line
|
||||||
if (rep.selStart[0] < 0) {
|
if (rep.selStart[0] < 0) {
|
||||||
rep.selStart = [0, 0];
|
rep.selStart = [0, 0];
|
||||||
|
@ -3073,11 +3073,10 @@ function Ace2Inner() {
|
||||||
if (isPageDown) {
|
if (isPageDown) {
|
||||||
top.console.log('pag edown');
|
top.console.log('pag edown');
|
||||||
// go to the bottom of the last visible content
|
// go to the bottom of the last visible content
|
||||||
if(rep.selStart[0] === 0){
|
if (rep.selStart[0] === 0) {
|
||||||
rep.selStart[0] += visibleLineRange[1] - visibleLineRange[0] - 1;
|
rep.selStart[0] += visibleLineRange[1] - visibleLineRange[0] - 1;
|
||||||
rep.selEnd[0] += visibleLineRange[1] - visibleLineRange[0] - 1;
|
rep.selEnd[0] += visibleLineRange[1] - visibleLineRange[0] - 1;
|
||||||
}else{
|
} else {
|
||||||
// handle if we're on first line as it will do weird things.
|
|
||||||
rep.selStart[0] += visibleLineRange[1] - visibleLineRange[0];
|
rep.selStart[0] += visibleLineRange[1] - visibleLineRange[0];
|
||||||
rep.selEnd[0] += visibleLineRange[1] - visibleLineRange[0];
|
rep.selEnd[0] += visibleLineRange[1] - visibleLineRange[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,13 +280,12 @@ Scroll.prototype.scrollNodeVerticallyIntoView = function (rep, innerHeight, isPa
|
||||||
// to inside of the viewport. Tested on IE, Firefox, Chrome in releases from 2015 until now
|
// to inside of the viewport. Tested on IE, Firefox, Chrome in releases from 2015 until now
|
||||||
// So, when the line scrolled gets outside of the viewport we let the browser handle it.
|
// So, when the line scrolled gets outside of the viewport we let the browser handle it.
|
||||||
const linePosition = caretPosition.getPosition();
|
const linePosition = caretPosition.getPosition();
|
||||||
|
|
||||||
if (isPageUp) {
|
if (isPageUp) {
|
||||||
// redraw entire page into view putting rep.selStart[0] at top left
|
// redraw entire page into view putting rep.selStart[0] at top left
|
||||||
const distanceOfTopOfViewport = linePosition.top - viewport.top;
|
const distanceOfTopOfViewport = linePosition.top - viewport.top;
|
||||||
const pixelsToScroll =
|
const pixelsToScroll =
|
||||||
distanceOfTopOfViewport - this._getPixelsRelativeToPercentageOfViewport(innerHeight, true);
|
distanceOfTopOfViewport - this._getPixelsRelativeToPercentageOfViewport(innerHeight, true);
|
||||||
this._scrollYPage(pixelsToScroll);
|
this._scrollYPage(pixelsToScroll - linePosition.height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue